Vitor de Lima has uploaded a new change for review.

Change subject: caps: Do not use lscpu on ppc64
......................................................................

caps: Do not use lscpu on ppc64

Recent libvirt versions correctly show the topology of ppc64 hosts, so
it is not required the use of 'lscpu' to obtain this information.

Change-Id: I421c82f46a433387b5d7eb1e4624b5f166ee344c
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1148092
Signed-off-by: Vitor de Lima <[email protected]>
---
M vdsm/caps.py
M vdsm/ppc64HardwareInfo.py
2 files changed, 1 insertion(+), 41 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/33872/1

diff --git a/vdsm/caps.py b/vdsm/caps.py
index b8488b4..a594010 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -190,13 +190,7 @@
 
 class CpuTopology(object):
     def __init__(self, capabilities=None):
-
-        if platform.machine() == Architecture.PPC64:
-            from ppc64HardwareInfo import \
-                getCpuTopology as getPPC64CpuTopology
-            self._topology = getPPC64CpuTopology(capabilities)
-        else:
-            self._topology = _getCpuTopology(capabilities)
+        self._topology = _getCpuTopology(capabilities)
 
     def threads(self):
         return self._topology['threads']
diff --git a/vdsm/ppc64HardwareInfo.py b/vdsm/ppc64HardwareInfo.py
index 1a4b30e..b651139 100644
--- a/vdsm/ppc64HardwareInfo.py
+++ b/vdsm/ppc64HardwareInfo.py
@@ -49,37 +49,3 @@
         infoStructure['systemUUID'] = vdsmId
 
     return infoStructure
-
-
[email protected]
-def getCpuTopology(capabilities):
-    topology = {}
-
-    if capabilities is None:
-        retcode, out, err = utils.execCmd(['lscpu'], raw=True)
-        capabilities = out
-
-    corePS = None
-    threadsPC = None
-    sockets = None
-
-    for line in capabilities.splitlines():
-        if line.strip() == '':
-            continue
-        key, value = map(str.strip, line.split(':', 1))
-
-        if key == 'Socket(s)':
-            sockets = int(value)
-        elif key == 'Thread(s) per core':
-            threadsPC = int(value)
-        elif key == 'Core(s) per socket':
-            corePS = int(value)
-
-    if corePS and threadsPC and sockets:
-        topology['sockets'] = sockets
-        topology['cores'] = corePS * sockets
-        topology['threads'] = threadsPC * corePS * sockets
-    else:
-        raise RuntimeError('Undefined topology')
-
-    return topology


-- 
To view, visit http://gerrit.ovirt.org/33872
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I421c82f46a433387b5d7eb1e4624b5f166ee344c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vitor de Lima <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to