[f22-branch 4/5] Fall back on mdadm info if udev info is missing for the array (#1208536)

mulkieran installerbot-noreply at redhat.com
Mon Apr 6 20:34:19 UTC 2015


From: mulhern <amulhern at redhat.com>

Related: fed#1208536

If udev didn't supply the UUID of the array the device belongs to,
which means it won't be found in the format's mdUuid, assume that
mdadm got the correct UUID and use it and also assign it to the format's
mdUuid.

Otherwise, we may end up creating a new device when one is already in
the device tree.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/devicetree.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 6676eaa..3bb1178 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1593,15 +1593,19 @@ def handleUdevMDMemberFormat(self, info, device):
         # pylint: disable=unused-argument
         log_method_call(self, name=device.name, type=device.format.type)
         md_info = blockdev.md_examine(device.path)
+
+        # Use mdadm info if udev info is missing
+        md_uuid = md_info.uuid
+        device.format.mdUuid = device.format.mdUuid or md_uuid
         md_array = self.getDeviceByUuid(device.format.mdUuid, incomplete=True)
-        if device.format.mdUuid and md_array:
+
+        if md_array:
             md_array.parents.append(device)
         else:
             # create the array with just this one member
             # level is reported as, eg: "raid1"
             md_level = md_info.level
             md_devices = md_info.num_devices
-            md_uuid = md_info.uuid
 
             if md_level is None:
                 log.warning("invalid data for %s: no RAID level", device.name)


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/a983d520baa7f5c01e415b2d1b223f03e0a687c2


More information about the anaconda-patches mailing list