From 649ed45965b65c86553f7e89c4790a91ddb74deb Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 19 Feb 2020 08:36:19 +0100 Subject: [PATCH] kvm: fix exception in volume statts after storage migration (#3884) On kvm, the 'path' of volume is the file name on primary storage. we should use 'path' instead of 'uuid' in volume statistics. Fixes: #3878 --- server/src/main/java/com/cloud/server/StatsCollector.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java b/server/src/main/java/com/cloud/server/StatsCollector.java index b2ccfe274a5..4ec32b63ec5 100644 --- a/server/src/main/java/com/cloud/server/StatsCollector.java +++ b/server/src/main/java/com/cloud/server/StatsCollector.java @@ -928,13 +928,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc List volumes = _volsDao.findByPoolId(pool.getId(), null); List volumeLocators = new ArrayList(); for (VolumeVO volume : volumes) { - if (volume.getFormat() == ImageFormat.QCOW2) { - if (pool.isManaged()) { - volumeLocators.add(volume.getPath()); - } else { - volumeLocators.add(volume.getUuid()); - } - } else if (volume.getFormat() == ImageFormat.VHD) { + if (volume.getFormat() == ImageFormat.QCOW2 || volume.getFormat() == ImageFormat.VHD) { volumeLocators.add(volume.getPath()); } else if (volume.getFormat() == ImageFormat.OVA) { volumeLocators.add(volume.getChainInfo());