[Kimchi-devel] [PATCH] Old version of ppc64_cpu command doesn't support option --threads-per-core
thierry at linux.vnet.ibm.com
thierry at linux.vnet.ibm.com
Fri Feb 6 11:50:42 UTC 2015
From: Thierry FAUCK - IBM LTC <thierry at linux.vnet.ibm.com>
Old version of ppc64_cpu command doesn't support option
--threads-per-core and raises a start message
ValueError: invalid literal for int() with base 10: 'information)'
Solution is to get info from lscpu which sounds accurate
Remove dependency to qemu-kvm
Signed-off-by: Thierry FAUCK - IBM LTC <thierry at linux.vnet.ibm.com>
modified: contrib/DEBIAN/control.in
modified: src/kimchi/model/cpuinfo.py
---
contrib/DEBIAN/control.in | 1 -
src/kimchi/model/cpuinfo.py | 20 +++++++++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in
index 069e14b..776b033 100644
--- a/contrib/DEBIAN/control.in
+++ b/contrib/DEBIAN/control.in
@@ -14,7 +14,6 @@ Depends: python-cherrypy3 (>= 3.2.0),
libvirt-bin,
nfs-common,
python-m2crypto,
- qemu-kvm,
python-pam,
python-parted,
python-psutil (>= 0.6.0),
diff --git a/src/kimchi/model/cpuinfo.py b/src/kimchi/model/cpuinfo.py
index 3411ef5..d43f21f 100644
--- a/src/kimchi/model/cpuinfo.py
+++ b/src/kimchi/model/cpuinfo.py
@@ -80,11 +80,21 @@ class CPUInfoModel(object):
out, error, rc = run_command(['ppc64_cpu', '--cores-on'])
if not rc:
self.cores_available = int(out.split()[-1])
- out, error, rc = run_command(['ppc64_cpu', '--threads-per-core'])
- if not rc:
- self.threads_per_core = int(out.split()[-1])
- self.sockets = self.cores_present/self.threads_per_core
- self.cores_per_socket = self.cores_present/self.sockets
+ try:
+ out, error, rc = run_command(['ppc64_cpu', '--threads-per-core'])
+ if not rc:
+ self.threads_per_core = int(out.split()[-1])
+ self.sockets = self.cores_present/self.threads_per_core
+ self.cores_per_socket = self.cores_present/self.sockets
+ except:
+ out, error, rc = run_command(['sh', '-c', 'lscpu |
+ grep "Thread(s) per core:"'])
+ if not rc:
+ self.cores_present = int(out.split()[-1])
+ out, error, rc = run_command(['sh', '-c', 'lscpu |
+ grep "Core(s) per socket:"'])
+ if not rc:
+ self.cores_available = int(out.split()[-1])
else:
# Intel or AMD
self.guest_threads_enabled = True
--
1.7.9.5
More information about the Kimchi-devel
mailing list