andrijapanicsb commented on code in PR #14256:
URL: https://github.com/apache/cloudstack/pull/14256#discussion_r4186713594


##########
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:
   Please see comment/response above ^^^



-- 
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]

Reply via email to