[virt-tools-list] [virt-manager PATCH 2/2] Fix an exception while a XEN domain is shutting-down

Cole Robinson crobinso at redhat.com
Wed Feb 25 15:50:59 UTC 2015


On 02/25/2015 10:34 AM, Giuseppe Scrivano wrote:
> 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 at redhat.com>
> ---
>  virtManager/domain.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virtManager/domain.py b/virtManager/domain.py
> index 2ebceaa..a7c2442 100644
> --- a/virtManager/domain.py
> +++ b/virtManager/domain.py
> @@ -1513,7 +1513,7 @@ class vmmDomain(vmmLibvirtObject):
>              pcentbase = (((cpuTime) * 100.0) /
>                           ((now - prevTimestamp) * 1000.0 * 1000.0 * 1000.0))
>              pcentHostCpu = pcentbase / hostcpus
> -            pcentGuestCpu = pcentbase / guestcpus
> +            pcentGuestCpu = guestcpus > 0 and pcentbase / guestcpus or 0
>  
>          pcentHostCpu = max(0.0, min(100.0, pcentHostCpu))
>          pcentGuestCpu = max(0.0, min(100.0, pcentGuestCpu))
> 

ACK with a comment that you've seen this on RHEL5 xen, so it isn't
inadvertently dropped in the future.

Thanks,
Cole




More information about the virt-tools-list mailing list