[virt-tools-list] [PATCH] Attempt empty path on virDomainBlockStats
Cole Robinson
crobinso at redhat.com
Tue Feb 25 02:39:37 UTC 2014
On 02/21/2014 05:38 AM, Thorsten Behrens wrote:
> 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:
>
ACK, pushed with a small comment tweak
- Cole
More information about the virt-tools-list
mailing list