Hello Antoni Segura Puimedon, Dan Kenigsberg, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/34617 to review the following change. Change subject: caps: Additional ppc64 hardware information ...................................................................... caps: Additional ppc64 hardware information Includes extra information (manufacturer and product name) about ppc64 hosts in the getVdsHardwareInfo command. This extra information is obtained from the device tree and skipped in case it is missing. Change-Id: I8f67a830740b64bc246f680f2c7a18a4293f4cc2 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1149262 Signed-off-by: Vitor de Lima <vdel...@redhat.com> Reviewed-on: http://gerrit.ovirt.org/33857 Reviewed-by: Antoni Segura Puimedon <asegu...@redhat.com> Reviewed-by: Dan Kenigsberg <dan...@redhat.com> --- M vdsm/ppc64HardwareInfo.py 1 file changed, 16 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/34617/1 diff --git a/vdsm/ppc64HardwareInfo.py b/vdsm/ppc64HardwareInfo.py index 1a4b30e..029eaa4 100644 --- a/vdsm/ppc64HardwareInfo.py +++ b/vdsm/ppc64HardwareInfo.py @@ -21,14 +21,21 @@ import os +def _getFromDeviceTree(treeProperty): + path = '/proc/device-tree/%s' % treeProperty + if os.path.exists(path): + with open(path) as f: + value = f.readline().rstrip('\0').replace(',', '') + return value + else: + return 'unavailable' + + @utils.memoized def getHardwareInfoStructure(): - infoStructure = {'systemProductName': 'unavailable', - 'systemSerialNumber': 'unavailable', + infoStructure = {'systemSerialNumber': 'unavailable', 'systemFamily': 'unavailable', - 'systemVersion': 'unavailable', - 'systemUUID': 'unavailable', - 'systemManufacturer': 'unavailable'} + 'systemVersion': 'unavailable'} for line in file('/proc/cpuinfo'): if line.strip() == '': @@ -42,11 +49,11 @@ elif key == 'machine': infoStructure['systemVersion'] = value - if os.path.exists('/proc/device-tree/system-id'): - with open('/proc/device-tree/system-id') as f: - vdsmId = f.readline().rstrip('\0').replace(',', '') + infoStructure['systemUUID'] = _getFromDeviceTree('system-id') - infoStructure['systemUUID'] = vdsmId + infoStructure['systemProductName'] = _getFromDeviceTree('model-name') + + infoStructure['systemManufacturer'] = _getFromDeviceTree('vendor') return infoStructure -- To view, visit http://gerrit.ovirt.org/34617 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8f67a830740b64bc246f680f2c7a18a4293f4cc2 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-3.5 Gerrit-Owner: Vitor de Lima <vdel...@redhat.com> Gerrit-Reviewer: Antoni Segura Puimedon <asegu...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches