[node-patches] Change in ovirt-node[master]: update cpu_details to read full topology
mburns at redhat.com
mburns at redhat.com
Wed May 15 13:37:32 UTC 2013
Michael Burns has uploaded a new change for review.
Change subject: update cpu_details to read full topology
......................................................................
update cpu_details to read full topology
Hosts with multiple numa nodes can end up reporting incorrect
information in libvirt capabilities' <topology> tag.
After discussing with libvirt devs, a better way to determine
this information is through a more in depth parsing.
rhbz#927128
Change-Id: I2cb086e119b4f5c5d430072883532c404a3bb652
Signed-off-by: Mike Burns <mburns at redhat.com>
---
M src/ovirtnode/ovirtfunctions.py
1 file changed, 19 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/48/14748/1
diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index 9abbc75..41812d3 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -1555,8 +1555,21 @@
else:
cpu_model = "Unknown Model"
try:
- topologyTag = cpu.getElementsByTagName('topology')[0].toxml()
- cpu_topology = topologyTag.replace('<topology>','').replace('</topology>','').split()
+ host = dom.getElementsByTagName('host')[0]
+ cells = host.getElementsByTagName('cells')[0]
+ total_cpus = cells.getElementsByTagName('cpu').length
+
+ socketIds = []
+ siblingsIds = []
+
+ socketIds = [ proc.getAttribute('socket_id')
+ for proc in cells.getElementsByTagName('cpu')
+ if proc.getAttribute('socket_id') not in socketIds ]
+
+ siblingsIds = [ proc.getAttribute('siblings')
+ for proc in cells.getElementsByTagName('cpu')
+ if proc.getAttribute('siblings') not in siblingsIds ]
+ cpu_topology = "OK"
except:
cpu_topology = "Unknown"
status_msg += "CPU Name: %s\n" % cpu_dict["model name"].replace(" "," ")
@@ -1579,10 +1592,12 @@
if cpu_topology == "Unknown":
status_msg += "Unable to determine CPU Topology"
else:
- cpu_sockets=cpu_topology[2].split("=")[1].replace('"',"")
+ cpu_sockets = len(set(socketIds))
status_msg += "CPU Sockets: %s\n" % cpu_sockets
- cpu_cores=cpu_topology[1].split("=")[1].replace('"',"")
+ cpu_cores = len(set(siblingsIds))
status_msg += "CPU Cores: %s\n" % cpu_cores
+ cpu_threads = total_cpus
+ status_msg += "CPU Threads: %s\n" % cpu_threads
return status_msg
def get_ssh_hostkey(variant="rsa"):
--
To view, visit http://gerrit.ovirt.org/14748
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cb086e119b4f5c5d430072883532c404a3bb652
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Michael Burns <mburns at redhat.com>
More information about the node-patches
mailing list