From 649ed45965b65c86553f7e89c4790a91ddb74deb Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 19 Feb 2020 08:36:19 +0100 Subject: [PATCH 1/2] 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()); From 37d2b8537c454cdafdaf240dba37a4e1767afe2e Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 19 Feb 2020 08:42:20 +0100 Subject: [PATCH 2/2] kvm: Enable virtio drivers based on guest os display name (#3879) When we add new guest os, sometimes we missed the records in guest_os_hypervisor. However, the guest disk model (virtio/ide) is determined by record in the table. It causes the issue that some new guest os(eg Debian 8/9) uses e1000 instead of virtio nic, and ide disk instead of virtio disk. To fix the issue permanantly, pass the guest os name in guest_os if the record for kvm is not found in guest_os_hypervisor. Related commit:7ac9f00eeeb4cd37ec39efeba066e799b581b1a0 --- server/src/main/java/com/cloud/hypervisor/KVMGuru.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/com/cloud/hypervisor/KVMGuru.java b/server/src/main/java/com/cloud/hypervisor/KVMGuru.java index 2b84ff9b04d..cf29a1a55a9 100644 --- a/server/src/main/java/com/cloud/hypervisor/KVMGuru.java +++ b/server/src/main/java/com/cloud/hypervisor/KVMGuru.java @@ -132,7 +132,7 @@ public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru { guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion()); } if (guestOsMapping == null || host == null) { - to.setPlatformEmulator("Other"); + to.setPlatformEmulator(guestOS.getDisplayName() == null ? "Other" : guestOS.getDisplayName()); } else { to.setPlatformEmulator(guestOsMapping.getGuestOsName()); }