From ca415e7436e9715a744a7c1383baac0c8b64c41f 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 c88400b289c..1db9d67afc2 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 @@ -3095,6 +3095,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv 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;