virt-manager/530c021c-attempt-empty-path-on-virDomainBlockStats.patch

40 lines
1.5 KiB
Diff
Raw Normal View History

Subject: Attempt empty path on virDomainBlockStats
From: Thorsten Behrens tbehrens@suse.com Fri Feb 21 11:38:41 2014 +0100
Date: Mon Feb 24 21:38:20 2014 -0500:
Git: b5c3fe1da5f67e0a83a3bc5c9358cbc779157354
libvirt for some backends yields summary domain stats for empty
disk path - which saves us the looping on our side.
Index: virt-manager-1.0.0/virtManager/domain.py
===================================================================
--- virt-manager-1.0.0.orig/virtManager/domain.py
+++ virt-manager-1.0.0/virtManager/domain.py
@@ -270,6 +270,7 @@ class vmmDomain(vmmLibvirtObject):
self._enable_disk_poll = False
self._stats_disk_supported = True
self._stats_disk_skip = []
+ self._summary_disk_stats_skip = False
self.inspection = vmmInspectionData()
@@ -1769,6 +1770,18 @@ class vmmDomain(vmmLibvirtObject):
self._stats_disk_skip = []
return rd, wr
+ # Some drivers support this method for getting all usage at once
+ if not self._summary_disk_stats_skip:
+ try:
+ io = self._backend.blockStats('')
+ if io:
+ rd = io[1]
+ wr = io[3]
+ return rd, wr
+ except libvirt.libvirtError:
+ self._summary_disk_stats_skip = True
+
+ # did not work, iterate over all disks
for disk in self.get_disk_devices(refresh_if_nec=False):
dev = disk.target
if not dev: