mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
domain: _update_status: Only fetch info if required
This commit is contained in:
parent
aa15d2d4a0
commit
27dcb860eb
@ -1351,17 +1351,19 @@ class vmmDomain(vmmDomainBase):
|
|||||||
self.vcpu_max_count()
|
self.vcpu_max_count()
|
||||||
|
|
||||||
def _update_status(self, status=None):
|
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:
|
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 = info[0]
|
||||||
|
|
||||||
status = self._normalize_status(status)
|
status = self._normalize_status(status)
|
||||||
|
|
||||||
if status != self.lastStatus:
|
if status != self.lastStatus:
|
||||||
|
Loading…
Reference in New Issue
Block a user