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

mulkieran installerbot-noreply at redhat.com
Tue Apr 7 12:57:44 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/populator.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/blivet/populator.py b/blivet/populator.py
index 9e37a73..60a5073 100644
--- a/blivet/populator.py
+++ b/blivet/populator.py
@@ -1069,15 +1069,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/a6a8ce6120ea7bd214ebfe75a1a1a30ea989cf1d


More information about the anaconda-patches mailing list