[PATCH] create mappings for ext. partitions like kpartx (#617593)

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

 



---
 device.py |   45 +++++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/device.py b/device.py
index 984d802..c9ccc84 100644
--- a/device.py
+++ b/device.py
@@ -510,14 +510,18 @@ class MultiPath:
             return
 
         for part in disk.partitions:
-            # Don't create mappings for extended partitions see the comment
-            # in RaidSet.buildPartMaps()
-            if part.active and part.type != _parted.PARTITION_EXTENDED:
+            if part.active:
                 name = "%sp%s" % (self.name, part.number)
                 bdev = BlockDev(self.prefix + self.name)
                 bdev.mode = 0600
-                map = _PartitionDeviceMap(0, part.geometry.length, bdev,
-                    part.geometry.start, part.number)
+                if part.type != _parted.PARTITION_EXTENDED:
+                    map = _PartitionDeviceMap(0, part.geometry.length, bdev,
+                        part.geometry.start, part.number)
+                else:
+                    # special mapping for extended partitions see the comment
+                    # in RaidSet.buildPartMaps()
+                    map = _PartitionDeviceMap(0, 2, bdev,
+                        part.geometry.start, part.number)
                 map.name = name
                 yield map
 
@@ -762,24 +766,25 @@ class RaidSet:
             return
 
         for part in disk.partitions:
-            # Various tools create different mappings for extended partitions:
-            # dmraid: Does not create a mapping for extended parts
-            # kpartx: Creates a mapping with a size of 2 sectors (*)
-            # parted: Creates a mapping with the actual extended partition size
-            #
-            # We won't recognize kpartx' 2 sector mapping as a pre-existing
-            # mapping, try to create one and fail with EBUSY. This happens ie
-            # with a livecd install. Note the kernel does the same for extended
-            # partitions on regular disk, so this is not a kpartx bug.
-            #
-            # To avoid this problem, we simply don't create a mapping for the
-            # extended partition at all, as there is no use for one anyways.
-            if part.active and part.type != _parted.PARTITION_EXTENDED:
+            if part.active:
                 name = "%sp%s" % (self.name, part.number)
                 bdev = BlockDev(self.prefix + self.name)
                 bdev.mode = 0600
-                map = _PartitionDeviceMap(0, part.geometry.length, bdev,
-                    part.geometry.start, part.number)
+                if part.type != _parted.PARTITION_EXTENDED:
+                    map = _PartitionDeviceMap(0, part.geometry.length, bdev,
+                        part.geometry.start, part.number)
+                else:
+                    # Various tools create different mappings for ext. parts:
+                    # dmraid: Does not create a mapping for extended parts
+                    # kpartx: Creates a mapping with a size of 2 sectors
+                    # parted: Creates a mapping with the actual partition size
+                    #
+                    # The kernel does the same as kpartx for regular disks.
+                    # We do as kpartx and create a 2 sector mapping, so that if
+                    # there is a pre-existing mapping (ie a livecd install), we
+                    # recognize it and don't try to create one.
+                    map = _PartitionDeviceMap(0, 2, bdev,
+                        part.geometry.start, part.number)
                 map.name = name
                 map.create()
                 self._RaidSet__parts.append(map)
-- 
1.7.0.1

_______________________________________________
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