[virt-tools-list] [PATCH] Attempt empty path on virDomainBlockStats
Thorsten Behrens
tbehrens at suse.com
Fri Feb 21 10:38:41 UTC 2014
libvirt for some backends yields summary domain stats for empty
disk path - which saves us the looping on our side.
---
Note:
- recent change for lxc driver in libvirt, will be in the 1.2.2
release
- tries only once, so hopefully acceptable for all domain flavours
virtManager/domain.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/virtManager/domain.py b/virtManager/domain.py
index 8d0c95f..8716af8 100644
--- a/virtManager/domain.py
+++ b/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
+ # attempt to retrieve summary stats for domain
+ 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:
--
1.8.4.5
More information about the virt-tools-list
mailing list