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

Vratislav Podzimek vpodzime at redhat.com
Tue May 13 06:43:10 UTC 2014


On Mon, 2014-05-12 at 18:03 +0200, Artur Paszkiewicz wrote:
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/storage/devicetree.py b/storage/devicetree.py
> index 310f955..4427206 100644
> --- a/storage/devicetree.py
> +++ b/storage/devicetree.py
> @@ -943,7 +943,7 @@ 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]):
> +                if re.match("isw_[a-z]*_%s" % md_name, re.sub('[ \t]', '_', self.exclusiveDisks[i]).replace('/', '-')):
I think the re.sub() call should be moved onto a separate line before
the re.match() call. Otherwise this and the other patch both look good
to me.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list