Change in vdsm[master]: register: handle non uuid machines

dougsland at redhat.com dougsland at redhat.com
Thu Oct 15 18:09:22 UTC 2015


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: register: handle non uuid machines
......................................................................

register: handle non uuid machines

If user machines doesn't provide UUID data this patch
collects a random UUID from system.

Change-Id: I9429e46895a73178cf459d5ced5d39499e993922
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1268854
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M lib/vdsm/tool/register.py
1 file changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/47385/1

diff --git a/lib/vdsm/tool/register.py b/lib/vdsm/tool/register.py
index 47c8412..d088bfc 100644
--- a/lib/vdsm/tool/register.py
+++ b/lib/vdsm/tool/register.py
@@ -256,7 +256,17 @@
         if self.vdsm_uuid:
             self.uuid = self.vdsm_uuid
         else:
-            self.uuid = getHostUUID(legacy=False)
+            uuid_node = getHostUUID(legacy=False)
+            if uuid_node is None:
+                self.logger.debug("Collecting random UUID from system")
+                random_uuid_path = '/proc/sys/kernel/random/uuid'
+                if os.path.exists(random_uuid_path):
+                    with open(random_uuid_path, 'r') as f:
+                        self.uuid = f.readline().strip()
+                else:
+                    raise RuntimeError("Unable to determine host UUID!")
+            else:
+                self.uuid = uuid_node
 
         self.url_reg += "&uniqueId={u}".format(u=self.uuid)
 


-- 
To view, visit https://gerrit.ovirt.org/47385
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9429e46895a73178cf459d5ced5d39499e993922
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>


More information about the vdsm-patches mailing list