[PATCH] Fix devicelibs.dm.device_is_multipath support for new udev rules.

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

 



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']
+
+    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):
-- 
1.6.5.2

_______________________________________________
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