[master 3/7] Use udev to find name of md members' container.
dwlehman
installerbot-noreply at redhat.com
Wed Aug 5 17:49:51 UTC 2015
From: David Lehman <dlehman at redhat.com>
mdadm examine doesn't give the name of the container a member disk
belongs to. An easy way to find it is to iterate over the udev device
list and find a match by UUID and level.
Related: rhbz#1245191
---
blivet/populator.py | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/blivet/populator.py b/blivet/populator.py
index 9f82e9f..7aaf3e1 100644
--- a/blivet/populator.py
+++ b/blivet/populator.py
@@ -1158,8 +1158,30 @@ def handleUdevMDMemberFormat(self, info, device):
# if MD_METADATA is missing, assume metadata version is 0.90
md_metadata = md_info.metadata or "0.90"
md_name = None
+
+ # check the list of devices udev knows about to see if the array
+ # this device belongs to is already active
+ # XXX This is mainly for containers now since their name/device is
+ # not given by mdadm examine as we run it.
+ for dev in udev.get_devices():
+ if not udev.device_is_md(dev):
+ continue
+
+ try:
+ dev_uuid = udev.device_get_md_uuid(dev)
+ dev_level = udev.device_get_md_level(dev)
+ except KeyError:
+ continue
+
+ if dev_uuid is None or dev_level is None:
+ continue
+
+ if dev_uuid == md_uuid and dev_level == md_level:
+ md_name = udev.device_get_md_name(dev)
+ break
+
md_path = md_info.device or ""
- if md_path:
+ if md_path and not md_name:
md_name = devicePathToName(md_path)
if re.match(r'md\d+$', md_name):
# md0 -> 0
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/215f0b6f520dac19bacdd5b94954f707f7bfd8c0
More information about the anaconda-patches
mailing list