From f1ad3c6a42fd200aefeaf46a4b89274239236f63 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Mon, 29 May 2017 12:10:47 +0200 Subject: [PATCH] CLOUDSTACK-9929: Do not gather statistics for CDROM or FLOPPY devices Libvirt / Qemu (KVM) does not collect statistics about these either. On some systems it might even yield a 'internal error' from libvirt when attempting to gather block statistics from such devices. For example Ubuntu 16.04 (Xenial) has a issue with this. Skip them when looping through all devices. Signed-off-by: Wido den Hollander --- .../hypervisor/kvm/resource/LibvirtComputingResource.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index c26c3e2bef10..bf6bc5426926 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -3092,6 +3092,9 @@ public VmStatsEntry getVmStat(final Connect conn, final String vmName) throws Li long bytes_rd = 0; long bytes_wr = 0; for (final DiskDef disk : disks) { + if (disk.getDeviceType() == DeviceType.CDROM || disk.getDeviceType() == DeviceType.FLOPPY) { + continue; + } final DomainBlockStats blockStats = dm.blockStats(disk.getDiskLabel()); io_rd += blockStats.rd_req; io_wr += blockStats.wr_req;