[PATCH 4/4] Allow explicit requests for extended partitions. (#891861)

David Lehman dlehman at redhat.com
Thu Jul 18 14:13:47 UTC 2013


As of now this only works if you process the actions immediately after
allocating the empty extended.
---
 blivet/partitioning.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index a72c556..2a417ef 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -29,6 +29,7 @@ from pykickstart.constants import *
 
 from errors import *
 from deviceaction import *
+from flags import flags
 from devices import PartitionDevice, LUKSDevice, devicePathToName
 from formats import getFormat
 from devicelibs.lvm import get_pool_padding
@@ -591,6 +592,9 @@ def removeNewPartitions(disks, partitions):
             part.partedPartition = None
             part.disk = None
 
+    if not flags.installer_mode:
+        return
+
     for disk in disks:
         # remove empty extended so it doesn't interfere
         extended = disk.format.extendedPartition
@@ -916,6 +920,9 @@ def allocatePartitions(storage, disks, partitions, freespace):
                     # we need a primary slot and none are free on this disk
                     log.debug("no primary slots available on %s" % _disk.name)
                     continue
+            elif _part.req_partType is not None and \
+                 new_part_type != _part.req_partType:
+                new_part_type = _part.req_partType
 
             best = getBestFreeSpaceRegion(disklabel.partedDisk,
                                           new_part_type,
@@ -1066,7 +1073,8 @@ def allocatePartitions(storage, disks, partitions, freespace):
         disklabel = _disk.format
 
         # create the extended partition if needed
-        if part_type == parted.PARTITION_EXTENDED:
+        if part_type == parted.PARTITION_EXTENDED and \
+           part_type != _part.req_partType:
             log.debug("creating extended partition")
             addPartition(disklabel, free, part_type, None)
 
-- 
1.8.1.4



More information about the anaconda-patches mailing list