Re: [PATCH] Don't try to create a primary partition if all slots are taken. (#519784)

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

 



Looks good,

Regards,

Hans


On 08/28/2009 06:22 AM, David Lehman wrote:
This only gets hit if there are four preexisting primary partitions on a
disk. Also cleaned up the conditionals a bit to improve clarity.
---
  storage/partitioning.py |   16 +++++++++-------
  1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/storage/partitioning.py b/storage/partitioning.py
index e44d7f4..18b5ff3 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -440,13 +440,15 @@ def getNextPartitionType(disk, no_primary=None):
      max_logicals = disk.getMaxLogicalPartitions()
      primary_count = disk.primaryPartitionCount

-    if primary_count == disk.maxPrimaryPartitionCount and \
-       extended and logical_count<  max_logicals:
-        part_type = parted.PARTITION_LOGICAL
-    elif primary_count == (disk.maxPrimaryPartitionCount - 1) and \
-         not extended and supports_extended:
-        # last chance to create an extended partition
-        part_type = parted.PARTITION_EXTENDED
+    if primary_count>= disk.maxPrimaryPartitionCount - 1:
+        if extended and logical_count<  max_logicals:
+            part_type = parted.PARTITION_LOGICAL
+        elif not extended and supports_extended:
+            # last chance to create an extended partition
+            part_type = parted.PARTITION_EXTENDED
+        elif primary_count<  disk.maxPrimaryPartitionCount and not no_primary:
+            # it's either a primary or nothing
+            part_type = parted.PARTITION_NORMAL
      elif no_primary and extended and logical_count<  max_logicals:
          # create a logical even though we could presumably create a
          # primary instead

_______________________________________________
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