[blivet:master/rhel7 9/9] If allowing degraded array, attempt to start it (#1090009)

mulhern amulhern at redhat.com
Thu Dec 11 22:29:29 UTC 2014


Resolves: rhbz#1090009

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

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index f2032de..1c17784 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1137,6 +1137,22 @@ class DeviceTree(object):
         log.info("scanning %s (%s)...", name, sysfs_path)
         device = self.getDeviceByName(name)
         if device is None and udev.device_is_md(info):
+
+            # A degraded array may be inactive, hence with vestigial udev info.
+            # If allowing imperfect devices, need to start the array to get
+            # necessary information.
+            # If it is inactive, try to start it, and it it starts, re-get info.
+            if flags.allow_imperfect_devices:
+                state = mdraid.md_array_state(sysfs_path)
+                if state == "inactive":
+                    try:
+                        mdraid.mdrun(udev.device_get_devname(info))
+                    except MDRaidError as e:
+                        log.warning("Failed to start possibly degraded array %s: %s", name, e)
+                    else:
+                        udev.settle()
+                        info = udev.get_device(sysfs_path)
+
             device = self.getDeviceByName(
                udev.device_get_md_name(info),
                incomplete=flags.allow_imperfect_devices)
-- 
1.9.3



More information about the anaconda-patches mailing list