[blivet:master 09/14] Be more robust in the face of possible changes to mdadm's UUIDs.

mulhern amulhern at redhat.com
Wed Jul 16 16:56:40 UTC 2014


Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/devicelibs/mdraid.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/blivet/devicelibs/mdraid.py b/blivet/devicelibs/mdraid.py
index 36c4ee2..b8e8615 100644
--- a/blivet/devicelibs/mdraid.py
+++ b/blivet/devicelibs/mdraid.py
@@ -270,8 +270,13 @@ def mdexamine(device):
             if name == "metadata":
                 info["MD_METADATA"] = value
 
-    for k, v in ((k,v) for (k,v) in info.iteritems() if k.endswith("UUID")):
-        info[k] = canonicalizeUUID(v)
+    for k, v in ((k,info[k]) for k in ('MD_UUID', 'MD_DEV_UUID') if k in info):
+        try:
+            info[k] = canonicalizeUUID(v)
+        except ValueError as e:
+            # the unlikely event that mdadm's UUIDs cease to be proper UUIDs
+            log.warning('uuid value %s could not be canonicalized: %s', v, e)
+            info[k] = v # record the value, since mdadm provided something
 
     return info
 
-- 
1.9.3



More information about the anaconda-patches mailing list