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
--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
08-24-2010, 05:08 PM
Ales Kozumplik
mpath: filter member partitions wiser in lvm.
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))
+ # slice off the "/dev/" part, lvm filter cares only about the rest
+ partitions_paths = [p[5:] for p in partitions_paths]
+ map(lvm.lvm_cc_addFilterRejectRegexp, partitions_paths)
return
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
08-24-2010, 05:10 PM
Ales Kozumplik
mpath: filter member partitions wiser in lvm.
On 08/19/2010 08:05 PM, Ales Kozumplik wrote:
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.
Sending an updated version, the only added part is the
# slice off the "/dev/" part, lvm filter cares only
about the rest
partitions_paths = [p[5:] for p in partitions_paths]
.
I have one log from IBM available for the original patch and it seems to
be working okay (except the '/dev/' part of course):
16:58:25,413 DEBUG : adding partitions on /dev/sdi to the lvm ignore list
16:58:25,450 DEBUG : lvm filter: adding /dev/sdi1 to the reject list
16:58:25,451 DEBUG : lvm filter: adding /dev/sdi2 to the reject list
16:58:25,451 DEBUG : lvm filter: adding /dev/sdi3 to the reject list
Then when lvm is called:
16:58:30,078 INFO : Running... ['lvm', 'lvchange', '-a', 'y',
'--config', ' devices {
filter=["r|/sda$|","r|/sdc$|","r|//dev/sdc1$|","r|//dev/sdc2$|","r|//dev/sdc3$|","r|/sdi$|","r|//dev/sdi1$|","r|//dev/sdi2$|","r|//dev/sdi3$|","r|/sdd$|","r|/sdf$|","r|/sdb$|","r|//dev/sdb1$|","r|//dev/sdb2$|","r|//dev/sdb3$|","r|/sdh$|","r|//dev/sdh1$|","r|//dev/sdh2$|","r|//dev/sdh3$|"]
} ', 'vg_jabulanlp4/lv_root']
(notice how the sdi* devices are there)
Ales
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
08-24-2010, 05:14 PM
David Cantrell
mpath: filter member partitions wiser in lvm.
On Tue, 24 Aug 2010, Ales Kozumplik wrote:
On 08/19/2010 08:05 PM, Ales Kozumplik wrote:
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.
Sending an updated version, the only added part is the
# slice off the "/dev/" part, lvm filter cares only about the
rest
partitions_paths = [p[5:] for p in partitions_paths]
.
I have one log from IBM available for the original patch and it seems to be
working okay (except the '/dev/' part of course):
16:58:25,413 DEBUG : adding partitions on /dev/sdi to the lvm ignore list
16:58:25,450 DEBUG : lvm filter: adding /dev/sdi1 to the reject list
16:58:25,451 DEBUG : lvm filter: adding /dev/sdi2 to the reject list
16:58:25,451 DEBUG : lvm filter: adding /dev/sdi3 to the reject list
Then when lvm is called:
16:58:30,078 INFO : Running... ['lvm', 'lvchange', '-a', 'y', '--config',
' devices {
filter=["r|/sda$|","r|/sdc$|","r|//dev/sdc1$|","r|//dev/sdc2$|","r|//dev/sdc3$|","r|/sdi$|","r|//dev/sdi1$|","r|//dev/sdi2$|","r|//dev/sdi3$|","r|/sdd$|","r|/sdf$|","r|/sdb$|","r|//dev/sdb1$|","r|//dev/sdb2$|","r|//dev/sdb3$|","r|/sdh$|","r|//dev/sdh1$|","r|//dev/sdh2$|","r|//dev/sdh3$|"]
} ', 'vg_jabulanlp4/lv_root']
(notice how the sdi* devices are there)
Ack. Good find, IBM will be pleased.
--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list