
On 06/02/2015 09:50, thierry@linux.vnet.ibm.com wrote:
From: Thierry FAUCK - IBM LTC <thierry@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
I don't think that is related to this patch. Please, send a separated patch to remove the dependency as well as explaining why it is needed. Also if it is really need, update the docs/README.md to reflect the change.
Signed-off-by: Thierry FAUCK - IBM LTC <thierry@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:
Explicit specify the exception expected here. Also, run_command() should handle the exception and return it as 'error' value. In which scenario the code will go to the 'except' block?
+ 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