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

[rhel6-branch 2/5] Generalize some of the device-mapper partition handling.



From: David Lehman <dlehman redhat com>

Related: rhbz#709653
---
 storage/devicetree.py |   13 +++----------
 storage/udev.py       |    9 ++++++++-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 773667b..0d48dda 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -950,8 +950,7 @@ class DeviceTree(object):
         # udev/sysfs, we have to define what is a disk in terms of what is
         # not a disk.
         if udev_device_is_disk(info) and \
-           not udev_device_is_dmraid_partition(info, self) and \
-           not udev_device_is_multipath_partition(info, self) and \
+           not udev_device_is_dm_partition(info) and \
            not udev_device_is_dm_lvm(info) and \
            not udev_device_is_dm_crypt(info) and \
            not (udev_device_is_md(info) and
@@ -1026,12 +1025,7 @@ class DeviceTree(object):
             # try to get the device again now that we've got all the slaves
             device = self.getDeviceByName(name)
 
-            if device is None:
-                if udev_device_is_multipath_partition(info):
-                    diskname = udev_device_get_dm_partition_disk(info)
-                    disk = self.getDeviceByName(diskname)
-                    return self.addUdevPartitionDevice(info, disk=disk)
-                elif udev_device_is_dmraid_partition(info):
+            if device is None and udev_device_is_dm_partition(info):
                     diskname = udev_device_get_dm_partition_disk(info)
                     disk = self.getDeviceByName(diskname)
                     return self.addUdevPartitionDevice(info, disk=disk)
@@ -1301,8 +1295,7 @@ class DeviceTree(object):
         #
         if udev_device_is_multipath_member(info) and device is None:
             device = self.addUdevDiskDevice(info)
-        elif udev_device_is_dm(info) and \
-               devicelibs.dm.dm_is_multipath(info):
+        elif udev_device_is_dm(info) and udev_device_is_dm_mpath(info):
             log.debug("%s is a multipath device" % name)
             self.addUdevDMDevice(info)
         elif udev_device_is_dm(info):
diff --git a/storage/udev.py b/storage/udev.py
index de91c6d..b23e6c6 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -437,7 +437,7 @@ def udev_device_is_dm_raid(info):
     return udev_device_dm_subsystem_match(info, "dmraid")
 
 def udev_device_is_dm_mpath(info):
-    """ Return True if the device is an. """
+    """ Return True if the device is a multipath device. """
     return udev_device_dm_subsystem_match(info, "mpath")
 
 def udev_device_is_biosraid(info):
@@ -468,6 +468,13 @@ def udev_device_get_dm_partition_disk(info):
 
     return info["DM_NAME"][:p_index]
 
+def udev_device_is_dm_partition(info):
+    if not udev_device_is_dm(info):
+        return False
+
+    diskname = udev_device_get_dm_partition_disk(info)
+    return diskname not in ("", None)
+
 def udev_device_is_dmraid_partition(info):
     if not udev_device_is_dm_raid(info):
         return False
-- 
1.7.5.2


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