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

[PATCH 06/16] Generalize some of the device-mapper partition handling.



---
 pyanaconda/storage/devicetree.py |   13 +++----------
 pyanaconda/storage/udev.py       |   13 ++++++++++++-
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index d129050..81cbc96 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -534,8 +534,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) and \
-           not udev_device_is_multipath_partition(info) 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
@@ -610,12 +609,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)
@@ -853,8 +847,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/pyanaconda/storage/udev.py b/pyanaconda/storage/udev.py
index 8c9d372..1f4c3d5 100644
--- a/pyanaconda/storage/udev.py
+++ b/pyanaconda/storage/udev.py
@@ -420,9 +420,13 @@ 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_dm_anaconda(info):
+    """ Return True is the device is an anaconda disk image. """
+    return udev_device_dm_subsystem_match(info, "anaconda")
+
 def udev_device_is_biosraid_member(info):
     # Note that this function does *not* identify raid sets.
     # Tests to see if device is parto of a dmraid set.
@@ -451,6 +455,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.3.2


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