[PATCH 3/3] Correct and simplify handling of "bootable" partition requests.

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

 



Base everything on the request's weight. Since the weight tells us
what we need to know, we can remove the explicit check for a
bootable req from partitionCompare.
---
 pyanaconda/storage/partitioning.py |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 586817c..79a7aee 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -545,9 +545,6 @@ def partitionCompare(part1, part2):
     if part2.req_base_weight:
         ret += part2.req_base_weight
 
-    # bootable partitions to the front
-    ret -= cmp(part1.req_bootable, part2.req_bootable) * 1000
-
     # more specific disk specs to the front of the list
     # req_disks being empty is equivalent to it being an infinitely long list
     if part1.req_disks and not part2.req_disks:
@@ -1044,11 +1041,13 @@ def allocatePartitions(storage, disks, partitions, freespace, bootloader=None):
             boot_disk = req_disks.pop(boot_index)
             req_disks.insert(0, boot_disk)
 
+        boot = _part.req_base_weight > 1000
+
         log.debug("allocating partition: %s ; id: %d ; disks: %s ;\n"
                   "boot: %s ; primary: %s ; size: %dMB ; grow: %s ; "
                   "max_size: %s" % (_part.name, _part.id,
                                     [d.name for d in req_disks],
-                                    _part.req_bootable, _part.req_primary,
+                                    boot, _part.req_primary,
                                     _part.req_size, _part.req_grow,
                                     _part.req_max_size))
         free = None
@@ -1106,7 +1105,7 @@ def allocatePartitions(storage, disks, partitions, freespace, bootloader=None):
                                           new_part_type,
                                           _part.req_size,
                                           best_free=current_free,
-                                          boot=_part.req_bootable,
+                                          boot=boot,
                                           grow=_part.req_grow)
 
             if best == free and not _part.req_primary and \
@@ -1120,7 +1119,7 @@ def allocatePartitions(storage, disks, partitions, freespace, bootloader=None):
                                                   new_part_type,
                                                   _part.req_size,
                                                   best_free=current_free,
-                                                  boot=_part.req_bootable,
+                                                  boot=boot,
                                                   grow=_part.req_grow)
 
             if best and free != best:
@@ -1205,14 +1204,7 @@ def allocatePartitions(storage, disks, partitions, freespace, bootloader=None):
                                 growth)
                     free = best
 
-            # For platforms with a fake boot partition (like Apple Bootstrap or
-            # PReP) and multiple disks, we need to ensure the /boot partition
-            # ends up on the same disk as the fake one.
-            mountpoint = getattr(_part.format, "mountpoint", "")
-            if not mountpoint:
-                mountpoint = ""
-
-            if free and (_part.req_bootable or mountpoint.startswith("/boot")):
+            if free and boot:
                 # if this is a bootable partition we want to
                 # use the first freespace region large enough
                 # to satisfy the request
@@ -1238,7 +1230,7 @@ def allocatePartitions(storage, disks, partitions, freespace, bootloader=None):
             free = getBestFreeSpaceRegion(disklabel.partedDisk,
                                           part_type,
                                           _part.req_size,
-                                          boot=_part.req_bootable,
+                                          boot=boot,
                                           grow=_part.req_grow)
             if not free:
                 raise PartitioningError("not enough free space after "
-- 
1.7.3.4

_______________________________________________
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