[PATCH] Kimchi Problems with psutils 3.0.1

From: Stephan Conrad <stephan.conrad@gmail.com> Hi, psutils 3.0.1 has removed some depricated functions and vaiables. I made a Patch that kimchi can run with this version of psutil. Regards Stephan Stephan Conrad (1): Patched kimchi for psutils 3.0.1 src/kimchi/model/host.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.4.4

From: Stephan Conrad <stephan.conrad@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() + -- 2.4.4

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@gmail.com wrote:
From: Stephan Conrad <stephan.conrad@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() +
participants (2)
-
Aline Manera
-
stephan.conrad@gmail.com