Re: [rhel6-branch] lvm: filter 'sda[0-9]*' when filtering 'sda'

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

 



On Thu, 2010-08-19 at 14:58 +0200, Ales Kozumplik wrote:
> Resolves: rhbz#624175
> ---
>  storage/devicelibs/lvm.py |   17 ++++++++++++-----
>  1 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/storage/devicelibs/lvm.py b/storage/devicelibs/lvm.py
> index 42fe432..7400745 100644
> --- a/storage/devicelibs/lvm.py
> +++ b/storage/devicelibs/lvm.py
> @@ -23,6 +23,7 @@
>  import os
>  import math
>  import re
> +import string
>  
>  import iutil
>  
> @@ -65,17 +66,23 @@ def _composeConfig():
>      config_args = []
>  
>      filter_string = ""
> -    rejects = config_args_data["filterRejects"]
>      # we don't need the accept for now.
>      # accepts = config_args_data["filterAccepts"]
>      # if len(accepts) > 0:
>      #   for i in range(len(rejects)):
>      #       filter_string = filter_string + ("\"a|/%s$|\", " % accepts[i])
>  
> -    if len(rejects) > 0:
> -        for i in range(len(rejects)):
> -            filter_string = filter_string + ("\"r|/%s$|\"," % rejects[i])
> -
> +    rejects = config_args_data["filterRejects"]
> +    for reject in rejects:
> +        # If reject is "sda" we want both "sda" and "sda10" rejected but not
> +        # "sdab". If reject is "sda1" we want precisely "sda1" rejected and not
> +        # "sda10"
> +        if reject[-1] in string.digits:
> +            # ends with a digit
> +            filter_string += ("\"r|/%s$|\"," % reject)
> +        else:
> +            # doesn't end with a digit so also match any number of digits
> +            filter_string += ("\"r|/%s%s$|\"," % (reject, r'[0-9]*'))

You'll want to also add r'p[0-9]*' for devices like mpatha, whose
partitions get device names like mpathap2.

Dave

>  
>      filter_string = " filter=[%s] " % filter_string.strip(",")
>  


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux