New patch submitted by Federico Simoncelli (fsimonce(a)redhat.com)
You can review this change at:
http://gerrit.usersys.redhat.com/720
commit b29b79bf23c41d97ff8c226b06aed5656aaa554d
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Mon Jul 18 09:31:08 2011 +0000
Use system-uuid parameter in dmidecode command
Change-Id: Id569873cadf794ea97aa95c3e1f775b2e7bce049
diff --git a/vdsm/constants.py b/vdsm/constants.py
index ae9a79b..0819f3a 100644
--- a/vdsm/constants.py
+++ b/vdsm/constants.py
@@ -51,7 +51,6 @@ P_VDSM_LOG = '@VDSMLOGDIR@'
# External programs (sorted, please keep in order).
#
EXT_ADDNETWORK = P_VDSM + 'addNetwork'
-EXT_AWK = P_BIN + 'awk'
EXT_BLOCKDEV = P_SBIN + 'blockdev'
EXT_BRCTL = P_USR_SBIN + 'brctl'
diff --git a/vdsm/utils.py b/vdsm/utils.py
index 89f786f..fd17df8 100644
--- a/vdsm/utils.py
+++ b/vdsm/utils.py
@@ -651,11 +651,10 @@ def getHostUUID():
__hostUUID = 'None'
try:
- p = subprocess.Popen(constants.EXT_SUDO + " " + constants.EXT_DMIDECODE
+ " |" +
- constants.EXT_AWK + " '/^\tUUID: /{ print $2
}'",
- close_fds=True, shell=True,
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ p = subprocess.Popen(constants.EXT_SUDO + " " +
+ constants.EXT_DMIDECODE + " -s system-uuid",
+ close_fds=True, shell=True, stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if p.returncode == 0 and 'Not' not in out:
#Avoid error string - 'Not Settable' or 'Not Present'
diff --git a/vdsm_reg/deployUtil.py b/vdsm_reg/deployUtil.py
index 7564ed0..17cef2b 100644
--- a/vdsm_reg/deployUtil.py
+++ b/vdsm_reg/deployUtil.py
@@ -38,8 +38,6 @@ P_USR_SBIN = '/usr/sbin/'
P_LIBEXEC = '/usr/libexec/'
# Executables
-EX_AWK = P_BIN + 'awk'
-EX_BASH = P_BIN + 'bash'
EX_CAT = P_BIN + 'cat'
EX_CHKCONFIG = P_SBIN + 'chkconfig'
EX_DMIDECODE = P_USR_SBIN + 'dmidecode'
@@ -218,7 +216,7 @@ def getMachineUUID():
"""
strReturn = "None"
- out, err, ret = _logExec([EX_BASH, "-c", EX_DMIDECODE + "|" +
EX_AWK + " ' /^\tUUID: /{ print $2; } '"])
+ out, err, ret = _logExec([EX_DMIDECODE + " -s system-uuid"])
if ret == 0 and "Not" not in out: #Avoid error string- 'Not
Settable' or 'Not Present'
strReturn = out.replace ("\n", "")
else: