Pradipta Banerjee has uploaded a new change for review.
Change subject: utils.py: Add hostUUID retrieval support for KVM on PPC64
......................................................................
utils.py: Add hostUUID retrieval support for KVM on PPC64
Change-Id: I7a557b096550631e340fcc61bcb3fa4c3ae73837
Signed-off-by: Pradipta Kr. Banerjee <bpradip(a)in.ibm.com>
---
M vdsm/utils.py
1 file changed, 16 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/8637/1
diff --git a/vdsm/utils.py b/vdsm/utils.py
index 0dbb342..80582d4 100644
--- a/vdsm/utils.py
+++ b/vdsm/utils.py
@@ -37,6 +37,7 @@
import functools
import stat
import glob
+import platform
import ethtool
@@ -701,19 +702,23 @@
with open(constants.P_VDSM_NODE_ID) as f:
__hostUUID = f.readline().replace("\n", "")
else:
- p = subprocess.Popen([constants.EXT_SUDO,
+ arch = platform.machine()
+ if arch == 'x86_64':
+ p = subprocess.Popen([constants.EXT_SUDO,
constants.EXT_DMIDECODE, "-s",
"system-uuid"],
- close_fds=True, stdin=subprocess.PIPE,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- out, err = p.communicate()
- out = '\n'.join( line for line in out.splitlines()
+ close_fds=True, stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = p.communicate()
+ out = '\n'.join( line for line in out.splitlines()
if not line.startswith('#') )
- if p.returncode == 0 and 'Not' not in out:
- #Avoid error string - 'Not Settable' or 'Not Present'
- __hostUUID = out.strip()
- else:
- logging.warning('Could not find host UUID.')
+ if p.returncode == 0 and 'Not' not in out:
+ #Avoid error string - 'Not Settable' or 'Not
Present'
+ __hostUUID = out.strip()
+ elif arch == 'ppc64':
+ if os.path.exists('/proc/device-tree/system-id'):
+ #eg. output IBM,03061C14A
+ __hostUUID =
file('/proc/device-tree/system-id').readline().replace(",",
"")
try:
mac = sorted(_getAllMacs())[0]
@@ -724,6 +729,7 @@
if __hostUUID != "None":
__hostUUID += "_" + mac
else:
+ logging.warning('Could not find host UUID')
__hostUUID = "_" + mac
except:
logging.error("Error retrieving host UUID", exc_info=True)
--
To view, visit
http://gerrit.ovirt.org/8637
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a557b096550631e340fcc61bcb3fa4c3ae73837
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Pradipta Banerjee <bpradip(a)in.ibm.com>