[PATCH 5/6] Split out code to determine max unaligned partition size to a property.

David Lehman dlehman at redhat.com
Tue Oct 28 19:20:02 UTC 2014


---
 blivet/devices/partition.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
index c6cfba8..d8e5de8 100644
--- a/blivet/devices/partition.py
+++ b/blivet/devices/partition.py
@@ -734,8 +734,8 @@ class PartitionDevice(StorageDevice):
     disk = property(lambda p: p._getDisk(), lambda p,d: p._setDisk(d))
 
     @property
-    def maxSize(self):
-        """ The maximum size this partition can be. """
+    def _unalignedMaxPartSize(self):
+        """ Maximum size partition can grow to with unchanged start sector. """
         # XXX Only allow growth up to the amount of free space following this
         #     partition on disk. We don't care about leading free space --
         #     a filesystem cannot be relocated, so if you want to use space
@@ -750,6 +750,12 @@ class PartitionDevice(StorageDevice):
             if partition.type == parted.PARTITION_FREESPACE:
                 maxPartSize = self.size + Size(partition.getLength(unit="B"))
 
+        return maxPartSize
+
+    @property
+    def maxSize(self):
+        """ The maximum size this partition can be. """
+        maxPartSize = self._unalignedMaxPartSize
         maxFormatSize = self.format.maxSize
         return min(maxFormatSize, maxPartSize) if maxFormatSize else maxPartSize
 
-- 
1.9.3



More information about the anaconda-patches mailing list