Damans227 commented on code in PR #13286:
URL: https://github.com/apache/cloudstack/pull/13286#discussion_r4311302565


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java:
##########
@@ -663,8 +692,9 @@ public KVMPhysicalDisk getPhysicalDisk(String volumeUuid, 
KVMStoragePool pool) {
             StorageVol vol = getVolume(libvirtPool.getPool(), volumeUuid);
             KVMPhysicalDisk disk;
             LibvirtStorageVolumeDef voldef = 
getStorageVolumeDef(libvirtPool.getPool().getConnect(), vol);
+            Long allSizes = getBackingFileSizes(libvirtPool.getPool(), vol);
             disk = new KVMPhysicalDisk(vol.getPath(), vol.getName(), pool);
-            disk.setSize(vol.getInfo().allocation);
+            disk.setSize(allSizes);

Review Comment:
   makes sense if its meant to match what the vm sees. that covers it



##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java:
##########
@@ -655,6 +662,28 @@ public KVMStoragePool getStoragePool(String uuid, boolean 
refreshInfo) {
         }
     }
 
+    private Long getBackingFileSizes(StoragePool pool, StorageVol vol) throws 
LibvirtException {
+        long total = 0L;
+        Set<String> visited = new HashSet<>();
+        StorageVol current = vol;
+
+        while (current != null) {
+            total += current.getInfo().allocation;
+            String backingName = getBackingFileOfVolumeIfExists(current);
+            if (StringUtils.isBlank(backingName) || !visited.add(backingName)) 
{
+                break;
+            }
+            try {
+                current = getVolume(pool, backingName);

Review Comment:
   ok, so the refresh only runs on a broken volume. that covers it



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