[Kimchi-devel] [PATCH V2] Update host number of cpus and total physical memory
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Mar 30 17:01:40 UTC 2015
Tests are failing on Ubuntu 14.10.
Please, make sure to run "make check-local" and "make check".
.....
======================================================================
ERROR: test_get_hostinfo (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_model.py", line 1036, in test_get_hostinfo
info = inst.host_lookup()
File "/home/alinefm/kimchi/src/kimchi/model/host.py", line 105, in lookup
self.host_info['cpus'] = psutil._psplatform.get_num_cpus()
AttributeError: 'module' object has no attribute 'get_num_cpus'
======================================================================
FAIL: test_host (test_rest.HttpsRestTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_rest.py", line 1256, in test_host
self.assertEquals(sorted(keys), sorted(info.keys()))
AssertionError: Lists differ: ['cpu_model', 'cpus', 'memory'... != []
First list contains 6 additional elements.
First extra element 0:
cpu_model
- ['cpu_model', 'cpus', 'memory', 'os_codename', 'os_distro', 'os_version']
+ []
======================================================================
FAIL: test_host (test_rest.RestTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_rest.py", line 1256, in test_host
self.assertEquals(sorted(keys), sorted(info.keys()))
AssertionError: Lists differ: ['cpu_model', 'cpus', 'memory'... != []
First list contains 6 additional elements.
First extra element 0:
cpu_model
- ['cpu_model', 'cpus', 'memory', 'os_codename', 'os_distro', 'os_version']
+ []
----------------------------------------------------------------------
Ran 154 tests in 1222.661s
FAILED (failures=4, errors=2, skipped=2)
On 23/03/2015 11:28, Jose Ricardo Ziviani wrote:
> - The number of cpus and the total physical memory information
> displayed in the host section can change, so them cannot be
> static. This commit updates those values whenever a GET request
> hits the backend looking for host information.
> ---
> src/kimchi/model/host.py | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
> index 4419bb3..588bb28 100644
> --- a/src/kimchi/model/host.py
> +++ b/src/kimchi/model/host.py
> @@ -87,8 +87,8 @@ class HostModel(object):
> res['cpu_model'] = line.split(':')[1].strip()
> break
>
> - res['cpus'] = psutil.NUM_CPUS
> - res['memory'] = psutil.TOTAL_PHYMEM
> + res['cpus'] = 0
> + res['memory'] = 0L
>
> # Include IBM PowerKVM name to supported distro names
> _sup_distros = platform._supported_dists + ('ibm_powerkvm',)
> @@ -102,6 +102,8 @@ class HostModel(object):
> return res
>
> def lookup(self, *name):
> + self.host_info['cpus'] = psutil._psplatform.get_num_cpus()
> + self.host_info['memory'] = psutil.phymem_usage().total
> return self.host_info
>
> def swupdate(self, *name):
More information about the Kimchi-devel
mailing list