[PATCH 5/5] Move check of new partition size against format limits.

David Lehman dlehman at redhat.com
Thu Sep 13 19:51:59 UTC 2012


Since the newui custom spoke creates all partitions with a base
size of 1MB this check had to be moved to after allocation is
complete since the base size is nearly meaningless in the context
of these checks.
---
 pyanaconda/storage/partitioning.py |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index c3849ea..936d9ed 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -774,6 +774,21 @@ def doPartitioning(storage):
 
         updateExtendedPartitions(storage, disks)
 
+        for part in [p for p in storage.partitions if not p.exists]:
+            problem = part.checkSize()
+            if problem < 0:
+                raise PartitioningError("partition is too small for %s formatting "
+                                        "(allowable size is %d MB to %d MB)"
+                                        % (part.format.name,
+                                           part.format.minSize,
+                                           part.format.maxSize))
+            elif problem > 0:
+                raise PartitioningError("partition is too large for %s formatting "
+                                        "(allowable size is %d MB to %d MB)"
+                                        % (part.format.name,
+                                           part.format.minSize,
+                                           part.format.maxSize))
+
 def allocatePartitions(storage, disks, partitions, freespace):
     """ Allocate partitions based on requested features.
 
@@ -853,20 +868,6 @@ def allocatePartitions(storage, disks, partitions, freespace):
             if _part.req_grow:
                 current_free = None
 
-            problem = _part.checkSize()
-            if problem < 0:
-                raise PartitioningError("partition is too small for %s formatting "
-                                        "(allowable size is %d MB to %d MB)"
-                                        % (_part.format.name,
-                                           _part.format.minSize,
-                                           _part.format.maxSize))
-            elif problem > 0:
-                raise PartitioningError("partition is too large for %s formatting "
-                                        "(allowable size is %d MB to %d MB)"
-                                        % (_part.format.name,
-                                           _part.format.minSize,
-                                           _part.format.maxSize))
-
             log.debug("checking freespace on %s" % _disk.name)
 
             new_part_type = getNextPartitionType(disklabel.partedDisk)
-- 
1.7.7.6



More information about the anaconda-patches mailing list