[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 7/9] Handle md name-mangling based on hostname/homehost WRT exclusiveDisks.



If, when assembling an array, the hostname does not match the hostname
in the array metadata mdadm will append an underscore and some number
of digits to the array name. This makes it impossible to identify such
arrays based on their metadata with 100% accuracy.

Related: rhbz#681608
---
 pyanaconda/storage/devicetree.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 46394d5..ca46a8d 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -543,8 +543,13 @@ class DeviceTree(object):
                udev_device_is_md(info) and \
                udev_device_get_md_name(info):
             md_name = udev_device_get_md_name(info)
+            # mdadm may have appended _<digit>+ if the current hostname
+            # does not match the one in the array metadata
+            alt_name = re.sub("_\d+$", "", md_name)
+            raw_pattern = "isw_[a-z]*_%s"
             for i in range(0, len(self.exclusiveDisks)):
-                if re.match("isw_[a-z]*_%s" % md_name, self.exclusiveDisks[i]):
+                if re.match(raw_pattern % md_name, self.exclusiveDisks[i]) or \
+                   re.match(raw_pattern % alt_name, self.exclusiveDisks[i]):
                     self.exclusiveDisks[i] = name
                     return False
 
-- 
1.7.3.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]