Vitor de Lima has uploaded a new change for review.

Change subject: vdsm: Additional ppc64 hardware information
......................................................................

vdsm: 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 <[email protected]>
---
M vdsm/ppc64HardwareInfo.py
1 file changed, 14 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/33857/1

diff --git a/vdsm/ppc64HardwareInfo.py b/vdsm/ppc64HardwareInfo.py
index 1a4b30e..1f66f7e 100644
--- a/vdsm/ppc64HardwareInfo.py
+++ b/vdsm/ppc64HardwareInfo.py
@@ -21,6 +21,16 @@
 import os
 
 
+def getFromDeviceTree(hwInfo, key, treeProperty):
+    path = '/proc/device-tree/%s' % treeProperty
+    try:
+        with open(path) as f:
+            value = f.readline().rstrip('\0').replace(',', '')
+            hwInfo[key] = value
+    except IOError:
+        pass
+
+
 @utils.memoized
 def getHardwareInfoStructure():
     infoStructure = {'systemProductName': 'unavailable',
@@ -42,11 +52,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(',', '')
+    getFromDeviceTree(infoStructure, 'systemUUID', 'system-id')
 
-        infoStructure['systemUUID'] = vdsmId
+    getFromDeviceTree(infoStructure, 'systemProductName', 'model-name')
+
+    getFromDeviceTree(infoStructure, 'systemManufacturer', 'vendor')
 
     return infoStructure
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f67a830740b64bc246f680f2c7a18a4293f4cc2
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