mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-28 07:21:44 +03:00
Fix an exception while a XEN domain is shutting-down
I've noticed twice today that 'guestcpus' was set to 0 while the domain was shutting down. Play safe and check that 'guestcpus' is > 0 before divide by it. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
64264e8fa2
commit
ef286321f9
@ -1513,7 +1513,9 @@ class vmmDomain(vmmLibvirtObject):
|
||||
pcentbase = (((cpuTime) * 100.0) /
|
||||
((now - prevTimestamp) * 1000.0 * 1000.0 * 1000.0))
|
||||
pcentHostCpu = pcentbase / hostcpus
|
||||
pcentGuestCpu = pcentbase / guestcpus
|
||||
# Under RHEL-5.9 using a XEN HV guestcpus can be 0 during shutdown
|
||||
# so play safe and check it.
|
||||
pcentGuestCpu = guestcpus > 0 and pcentbase / guestcpus or 0
|
||||
|
||||
pcentHostCpu = max(0.0, min(100.0, pcentHostCpu))
|
||||
pcentGuestCpu = max(0.0, min(100.0, pcentGuestCpu))
|
||||
|
Loading…
Reference in New Issue
Block a user