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]*'))
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
08-19-2010, 01:33 PM
Ales Kozumplik
*' when filtering 'sda'
On 08/19/2010 02:58 PM, Ales Kozumplik wrote:
Resolves: rhbz#624175
---
The reporter has confirmed that a similar (though admittedly more
radical) patch fixed the problem for them.
Example of a filter rule generated with it:
09:43:30,536 INFO : Running... ['lvm', 'lvchange', '-a', 'y',
'--config', ' devices {
filter=["r|/vda[0-9]*$|","r|/vdd[0-9]*$|","r|/vda1$|","r|/vda2$|","r|/vdd1$|"]
} ', 'vg_dhcp55/lv_root']
(note that with multipath, vdd1 never makes it to the filter so there we
really need the vdd[0-9]*)
Ales
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
08-19-2010, 03:10 PM
David Lehman
*' when filtering 'sda'
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.