andrijapanicsb commented on code in PR #14256:
URL: https://github.com/apache/cloudstack/pull/14256#discussion_r4186699164
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVolumesOnStorageCommandWrapper.java:
##########
@@ -65,7 +65,21 @@ public Answer execute(final GetVolumesOnStorageCommand
command, final LibvirtCom
final KVMStoragePool storagePool =
storagePoolMgr.getStoragePool(pool.getType(), pool.getUuid(), true, true);
if (StringUtils.isNotBlank(volumePath)) {
- return addVolumeByVolumePath(command, storagePool, volumePath);
+ // A Linstor volume is a DRBD device that only appears on this
host once its resource
+ // is made available here (a diskless assignment); connect it
before qemu-img inspects
+ // the device and release the diskless assignment afterwards (the
replicated data on
+ // the storage nodes is untouched). RBD needs no such step.
+ boolean linstorConnected = false;
+ if (StoragePoolType.Linstor.equals(pool.getType())) {
+ linstorConnected =
storagePoolMgr.connectPhysicalDisk(pool.getType(), pool.getUuid(), volumePath,
null);
+ }
+ try {
+ return addVolumeByVolumePath(command, storagePool, volumePath);
+ } finally {
+ if (linstorConnected) {
+ storagePoolMgr.disconnectPhysicalDisk(pool.getType(),
pool.getUuid(), volumePath);
+ }
+ }
Review Comment:
Thanks, René — good catch. Addressed in 01058cd674.
LINSTOR import listing now uses read-only controller metadata rather than
local device inspection. Resources are filtered by the pool’s resource group,
replicas are deduplicated, and format, size and in-use state no longer depend
on a local DRBD device being present.
The implementation uses paginated resource-definition, resource-view and
node-status queries, eliminating the per-volume API/qemu-img inspection loop.
Busy resources and resources whose usage cannot be established reliably are
marked as locked.
Regression tests cover remote-only replicas, resource-group filtering,
replica deduplication, pagination and unavailable/unknown usage states.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]