Change in vdsm[master]: utils: remove legacy code for uuid

dougsland at redhat.com dougsland at redhat.com
Fri Jul 31 13:03:01 UTC 2015


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: utils: remove legacy code for uuid
......................................................................

utils: remove legacy code for uuid

In 3.6 version we won't support old registration
schema. This patch removes the legacy code for collecting
UUID from host.

Change-Id: I1834eba15c7e5517a7aa62e1f32874244375036e
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 1 insertion(+), 42 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/44241/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index fccc286..f13e8a5 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -776,36 +776,10 @@
         return False
 
 
-def _getAllMacs():
-
-    # (
-    #     find /sys/class/net/*/device | while read f; do \
-    #         cat "$(dirname "$f")/address"; \
-    #     done; \
-    #     [ -d /proc/net/bonding ] && \
-    #         find /proc/net/bonding -type f -exec cat '{}' \; | \
-    #         grep 'Permanent HW addr:' | \
-    #         sed 's/.* //'
-    # ) | sed -e '/00:00:00:00/d' -e '/^$/d'
-
-    macs = []
-    for b in glob.glob('/sys/class/net/*/device'):
-        with open(os.path.join(os.path.dirname(b), "address")) as a:
-            mac = a.readline().replace("\n", "")
-        macs.append(mac)
-
-    for b in glob.glob('/proc/net/bonding/*'):
-        with open(b) as bond:
-            for line in bond:
-                if line.startswith("Permanent HW addr: "):
-                    macs.append(line.split(": ")[1].replace("\n", ""))
-
-    return set(macs) - set(["", "00:00:00:00:00:00"])
-
 __hostUUID = None
 
 
-def getHostUUID(legacy=True):
+def getHostUUID(legacy=False):
     global __hostUUID
     if __hostUUID:
         return __hostUUID
@@ -841,24 +815,9 @@
                 except IOError:
                     logging.warning('Could not find host UUID.')
 
-            if legacy:
-                try:
-                    mac = sorted(_getAllMacs())[0]
-                except:
-                    mac = ""
-                    logging.warning('Could not find host MAC.', exc_info=True)
-
-                # __hostUUID might contain the string 'None' returned
-                # from dmidecode call
-                if __hostUUID and __hostUUID is not 'None':
-                    __hostUUID += "_" + mac
-                else:
-                    __hostUUID = "_" + mac
     except:
         logging.error("Error retrieving host UUID", exc_info=True)
 
-    if legacy and not __hostUUID:
-        return 'None'
     return __hostUUID
 
 symbolerror = {}


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

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