From 27dcb860eba249ab73d6d81431437e9ef07ecb5c Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 9 Apr 2011 22:39:34 -0400 Subject: [PATCH] domain: _update_status: Only fetch info if required --- src/virtManager/domain.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py index a4d2f5cd..b1440ed3 100644 --- a/src/virtManager/domain.py +++ b/src/virtManager/domain.py @@ -1351,17 +1351,19 @@ class vmmDomain(vmmDomainBase): self.vcpu_max_count() def _update_status(self, status=None): - try: - info = self.get_info() - except libvirt.libvirtError, e: - if (hasattr(libvirt, "VIR_ERR_NO_DOMAIN") and - e.get_error_code() == getattr(libvirt, "VIR_ERR_NO_DOMAIN")): - # Possibly a transient domain that was removed on shutdown - return - raise - if status == None: + try: + info = self.get_info() + except libvirt.libvirtError, e: + if (hasattr(libvirt, "VIR_ERR_NO_DOMAIN") and + e.get_error_code() == getattr(libvirt, + "VIR_ERR_NO_DOMAIN")): + # Possibly a transient domain that was removed on shutdown + return + raise + status = info[0] + status = self._normalize_status(status) if status != self.lastStatus: