Hi, Erm, this has some issues, see below. On 11/30/2009 09:06 PM, Peter Jones wrote:
New udev rules for DM stuff use 'MAJOR' and 'MINOR' instead of 'DM_MAJOR' and 'DM_MINOR', so we need devicelibs.dm.device_is_multipath() to check for them instead. For now, this code will work with either variety. This also makes devicelibs.dm.device_is_multipath() take the whole info blob and do what it needs with it, rather than splitting it up in the calling function. --- storage/devicelibs/dm.py | 17 ++++++++++++++++- storage/devicetree.py | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py index c118d51..1689e57 100644 --- a/storage/devicelibs/dm.py +++ b/storage/devicelibs/dm.py @@ -67,7 +67,22 @@ def dm_node_from_name(map_name): log.debug("dm_node_from_name(%s) returning '%s'" % (map_name, dm_node)) return dm_node -def dm_is_multipath(major, minor): +def dm_is_multipath(info): + major = None + minor = None + + if info.has_key('MAJOR'): + major = info['MAJOR'] + elif info.has_key('DM_MAJOR'): + major = info['DM_MAJOR'] + if info.has_key('MINOR'): + major = info['MINOR'] + elif info.has_key('DM_MINOR'): + major = info['DM_MINOR'] +
These last 2 major occurences should read minor! Other then that it is ack.
+ if major is None or minor is None: + return False + for map in block.dm.maps(): dev = map.dev if dev.major == int(major) and dev.minor == int(minor): diff --git a/storage/devicetree.py b/storage/devicetree.py index 650ef96..b528ab2 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1257,7 +1257,7 @@ class DeviceTree(object): serial=udev_device_get_serial(info)) self._addDevice(device) elif udev_device_is_dm(info) and \ - devicelibs.dm.dm_is_multipath(info["DM_MAJOR"], info["DM_MINOR"]): + devicelibs.dm.dm_is_multipath(info): log.debug("%s is a multipath device" % name) self.addUdevDMDevice(info) elif udev_device_is_dm(info):
Regards, Hans _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list