Otherwise, if no size was passed in, the size will be Size(0) when the format gets set, which is problematic for formats with a minimum size. --- 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 02acf77..4ea0e97 100644 --- a/blivet/devices/partition.py +++ b/blivet/devices/partition.py @@ -134,6 +134,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) @@ -168,13 +174,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 = 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
On Tue, 2015-07-14 at 13:08 -0500, David Lehman wrote:
Otherwise, if no size was passed in, the size will be Size(0) when the format gets set, which is problematic for formats with a minimum size.
I hit this bug and came up with basically the same diagnosis (didn't realize David had already looked into it):
https://bugzilla.redhat.com/show_bug.cgi?id=1243106
I just tested this patch with an updates.img and it works, so ACK from me. I'm no expert but from what I saw while figuring out the bug, I don't *think* this should have any unintended consequences.
On Tue, Jul 14, 2015 at 01:08:56PM -0500, David Lehman wrote:
Otherwise, if no size was passed in, the size will be Size(0) when the format gets set, which is problematic for formats with a minimum size.
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 02acf77..4ea0e97 100644 --- a/blivet/devices/partition.py +++ b/blivet/devices/partition.py @@ -134,6 +134,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.defaultSizeStorageDevice.__init__(self, name, fmt=fmt, size=size, major=major, minor=minor, exists=exists, sysfsPath=sysfsPath, parents=parents)@@ -168,13 +174,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 = Size(0)else:# default size for new partition requestsself._size = self.defaultSizeself.req_name = name self.req_partType = partType self.req_primary = primary-- 2.4.3
Ack
anaconda-patches@lists.fedorahosted.org