From: David Lehman dlehman@redhat.com
The format type may impose limits on the device size. Unset the format type prior to setting the device size and avoid constraints that may change when the format is set later.
Cherry pick taken from master commit a5000d4.
Resolves: rhbz:#1178884 --- blivet/devicefactory.py | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index fb8ee27..0a86c90 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -643,6 +643,10 @@ class DeviceFactory(object): pass
def _set_size(self): + # reset the device's format before allocating partitions, &c + if self.device.format.type != self.fstype: + self.device.format = None + # this is setting the device size based on the factory size and the # current size of the container self._set_device_size()
From: David Lehman dlehman@redhat.com
Filesystem formats may have a maximum and minimum size value. Added a check to ensure factory targets fall within these size constraints.
Cherry pick taken from master commit a800128.
Resolves: rhbz#1178884 --- blivet/devicefactory.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index 0a86c90..12e9ebc 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -350,6 +350,22 @@ class DeviceFactory(object): free_info = self.storage.getFreeSpace(disks=self.disks) return sum(d[0] for d in free_info.values())
+ def _normalize_size(self): + if self.size is None: + self._handle_no_size() + + size = self.size + fmt = getFormat(self.fstype) + if size < fmt.minSize: + size = fmt.minSize + elif fmt.maxSize and size > fmt.maxSize: + size = fmt.maxSize + + if self.size != size: + log.debug("adjusted size from %s to %s to honor format limits", + self.size, size) + self.size = size + def _handle_no_size(self): """ Set device size so that it grows to the largest size possible. """ if self.size is not None: @@ -779,7 +795,7 @@ class DeviceFactory(object): if self.container and self.container.exists: self.disks = self.container.disks
- self._handle_no_size() + self._normalize_size() self._set_up_child_factory()
# Configure any devices this device will use as building blocks, except
From: David Lehman dlehman@redhat.com
If the device ends up smaller than the format's min size we must have run out of space. It's only okay for the device size to end up the format's min size if that's what was asked for, whether explicitly or by normalizing the specified target size.
Cherry pick taken from master commit b8b2c48.
Resolves: rhbz#1178884 --- blivet/devicefactory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index 12e9ebc..62c5864 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -673,7 +673,9 @@ class DeviceFactory(object): log.error("device post-create method failed: %s", e) raise else: - if self.device.size <= self.device.format.minSize: + if (self.device.size < self.device.format.minSize or + (self.device.size == self.device.format.minSize and + self.size > self.device.format.minSize)): raise StorageError("failed to adjust device -- not enough free space in specified disks?")
def _set_format(self):
anaconda-patches@lists.fedorahosted.org