[PATCH v2 rhel6-branch] Correct matching of md raid names containing special characters (#1096889)

Artur Paszkiewicz artur.paszkiewicz at intel.com
Tue May 13 13:25:57 UTC 2014


In md raid device names, udev replaces spaces and tabs with '_' and '/'
with '-'. Such names are returned by udev_device_get_md_name(), but in
DeviceTree.isIgnored() this is compared with names from
DeviceTree.exclusiveDisks, which are in original form. Because of this,
md raid devices with such names are not found in exclusiveDisks.

This patch adds substitution of special characters when comparing
md_name with names from exlusiveDisks.

Resolves: rhbz#1096889
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz at intel.com>
---
 storage/devicetree.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 310f955..90678a8 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -943,7 +943,10 @@ class DeviceTree(object):
                udev_device_get_md_name(info):
             md_name = udev_device_get_md_name(info)
             for i in range(0, len(self.exclusiveDisks)):
-                if re.match("isw_[a-z]*_%s" % md_name, self.exclusiveDisks[i]):
+                # Udev changes special characters in md device names
+                # Substitute them in name from exclusiveDisks before matching
+                disk_name = re.sub('[ \t]', '_', self.exclusiveDisks[i]).replace('/', '-')
+                if re.match("isw_[a-z]*_%s" % md_name, disk_name):
                     self.exclusiveDisks[i] = name
                     return False
 
-- 
1.8.4.5



More information about the anaconda-patches mailing list