[PATCH pyblock] Don't create mappings for extended partitions (#583484)

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

 



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, simply don't create a mapping for the
extended partition at all, as there is no use for one anyways.
---
 device.py |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/device.py b/device.py
index e097222..984d802 100644
--- a/device.py
+++ b/device.py
@@ -510,7 +510,9 @@ class MultiPath:
             return
 
         for part in disk.partitions:
-            if part.active:
+            # Don't create mappings for extended partitions see the comment
+            # in RaidSet.buildPartMaps()
+            if part.active and part.type != _parted.PARTITION_EXTENDED:
                 name = "%sp%s" % (self.name, part.number)
                 bdev = BlockDev(self.prefix + self.name)
                 bdev.mode = 0600
@@ -760,7 +762,19 @@ class RaidSet:
             return
 
         for part in disk.partitions:
-            if part.active:
+            # 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:
                 name = "%sp%s" % (self.name, part.number)
                 bdev = BlockDev(self.prefix + self.name)
                 bdev.mode = 0600
-- 
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