[Kimchi-devel] [PATCH] Patched kimchi for psutils 3.0.1

Aline Manera alinefm at linux.vnet.ibm.com
Tue Jun 30 14:56:46 UTC 2015


Hi Stephan,

I tried this patch on major Linux distributions (RHEL7.1, Ubuntu 15.04, 
openSUSE 13.2 and Fedora 22)
and it worked fine but it fails on PowerKVM. The method 
psutil.net_io_counters() does not exist there.

Maybe you could do a verification to get the right method for network IO 
counters.
if hasattr(psutil, net_io_counters):
     # do this
else:
     # do that

But I am OK with the other 2 modifications.

On 26/06/2015 03:50, stephan.conrad at gmail.com wrote:
> From: Stephan Conrad <stephan.conrad at gmail.com>
>
> ---
>   src/kimchi/model/host.py | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
> index b2fa379..eeee04f 100644
> --- a/src/kimchi/model/host.py
> +++ b/src/kimchi/model/host.py
> @@ -102,7 +102,7 @@ class HostModel(object):
>           return res
>
>       def lookup(self, *name):
> -        cpus = psutil.NUM_CPUS
> +        cpus = 0
>
>           # psutil is unstable on how to get the number of
>           # cpus, different versions call it differently
> @@ -118,7 +118,7 @@ class HostModel(object):
>                       break
>
>           self.host_info['cpus'] = cpus
> -        self.host_info['memory'] = psutil.phymem_usage().total
> +        self.host_info['memory'] = psutil.virtual_memory().total
>           return self.host_info
>
>       def swupdate(self, *name):
> @@ -248,7 +248,7 @@ class HostStatsModel(object):
>           prev_recv_bytes = net_recv_bytes[-1] if net_recv_bytes else 0
>           prev_sent_bytes = net_sent_bytes[-1] if net_sent_bytes else 0
>
> -        net_ios = psutil.network_io_counters(True)
> +        net_ios = psutil.net_io_counters(True)
>           recv_bytes = 0
>           sent_bytes = 0
>           for key in set(netinfo.nics() +




More information about the Kimchi-devel mailing list