Hello Ayal Baron, Timothy Asir, Saggi Mizrahi, Federico Simoncelli, Dan
Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/9386
to review the following change.
Change subject: fix: sockets/cores retrieval from cpu topology
......................................................................
fix: sockets/cores retrieval from cpu topology
topology tag in capabilities from libvirt is missing in some
environment. This fix assumes default sockets and cores as 1 when
topology tag missing
Change-Id: I343db03f9cf6eefc28f993d269c6c082e7695af5
Signed-off-by: Bala.FA <[email protected]>
---
M vdsm/caps.py
1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/9386/1
diff --git a/vdsm/caps.py b/vdsm/caps.py
index fdb06b1..c77a05c 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -111,12 +111,16 @@
caps = minidom.parseString(c.getCapabilities())
host = caps.getElementsByTagName('host')[0]
cpu = host.getElementsByTagName('cpu')[0]
+ topology = cpu.getElementsByTagName('topology')
+ sockets = 1
+ cores = 1
+ if topology:
+ sockets = int(topology[0].getAttribute('sockets'))
+ cores = int(topology[0].getAttribute('cores'))
cells = host.getElementsByTagName('cells')[0]
topology = {'cells': int(cells.getAttribute('num')),
- 'sockets': int(cpu.getElementsByTagName('topology')[0].
- getAttribute('sockets')),
- 'cores': int(cpu.getElementsByTagName('topology')[0].
- getAttribute('cores')),
+ 'sockets': sockets,
+ 'cores': cores,
'threads': cells.getElementsByTagName('cpu').length}
return topology
--
To view, visit http://gerrit.ovirt.org/9386
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I343db03f9cf6eefc28f993d269c6c082e7695af5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bala.FA <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Timothy Asir <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches