[RHEL 7.2 - PATCH 5/5] Apply default partition size earlier (#1178884)

Robert Marshall rmarshall at redhat.com
Mon Jul 27 18:44:42 UTC 2015


From: David Lehman <dlehman at redhat.com>

If no size is passed to the constructor, the size will be 0 when the
format size gets initialized. This proves problematic when the format
has a minimum size set.

Cherry pick taken from commit 76377d9.

Conflicts:
	blivet/devices/partition.py

Resolves: rhbz#178884
---
 blivet/devices/partition.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
index 18add66..97e3cca 100644
--- a/blivet/devices/partition.py
+++ b/blivet/devices/partition.py
@@ -131,6 +131,12 @@ class PartitionDevice(StorageDevice):
         self._partedPartition = None
         self._origPath = None
 
+        if not exists and size is None:
+            if start is not None and end is not None:
+                size = Size(0)
+            else:
+                size = self.defaultSize
+
         StorageDevice.__init__(self, name, fmt=fmt, size=size,
                                major=major, minor=minor, exists=exists,
                                sysfsPath=sysfsPath, parents=parents)
@@ -165,13 +171,6 @@ class PartitionDevice(StorageDevice):
             # XXX It might be worthwhile to create a shit-simple
             #     PartitionRequest class and pass one to this constructor
             #     for new partitions.
-            if not self._size:
-                if start is not None and end is not None:
-                    self._size = 0
-                else:
-                    # default size for new partition requests
-                    self._size = self.defaultSize
-
             self.req_name = name
             self.req_partType = partType
             self.req_primary = primary
-- 
1.8.3.1



More information about the anaconda-patches mailing list