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 <wido@widodh.nl>
This commit is contained in:
Wido den Hollander 2017-05-29 12:10:47 +02:00 committed by Rohit Yadav
parent a97d2505c8
commit ca415e7436
1 changed files with 3 additions and 0 deletions

View File

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