Minutes after committing c5b49fe5c62a7f062fd4d19c157e481fc514f584 I
realized 'sda' would also filter out the partition 'sdap4' on the disk
'sdap', not desirable.
This patch essentialy reverts c5b49fe5c62a7f062fd4d19c157e481fc514f584. It
goes through all partitions of a mpath member at the moment we check it's
ignored and adds the partitions explicitly to the filter list.
from ..errors import *
from constants import *
@@ -74,15 +75,7 @@ def _composeConfig():
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'p?[0-9]*'))
+ filter_string += (""r|/%s$|"," % reject)
if self.isIgnored(info):
log.debug("ignoring %s (%s)" % (name, sysfs_path))
+ if udev_device_is_multipath_member(info):
+ # last time we are seeing this mpath member is now, so make sure
+ # LVM ignores its partitions too else a duplicate VG name could
+ # harm us later during partition creation:
+ if udev_device_is_dm(info):
+ path = "/dev/mapper/%s" % name
+ else:
+ path = "/dev/%s" % name
+ log.debug("adding partitions on %s to the lvm ignore list" % path)
+ partitions_paths = []
+ try:
+ partitions_paths = [p.path
+ for p in parted.Disk(device=parted.Device(path=path)).parti tions]
+ except (_ped.IOException, _ped.DeviceException) as e:
+ log.error("Parted error scanning partitions on %s:" % path)
+ log.error(str(e))
+ map(lvm.lvm_cc_addFilterRejectRegexp, partition_paths)
return