@kellinm The ones you're interested in are a5000d4, a800128, and b8b2c48
From: David Lehman dlehman@redhat.com
This is a followup to a recent change in which I added a call to the superclass size setter from thinlv's size setter. --- blivet/devices/lvm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py index 8624fee..094f216 100644 --- a/blivet/devices/lvm.py +++ b/blivet/devices/lvm.py @@ -613,7 +613,9 @@ def _setSize(self, size): # Don't refuse to set size if we think there's not enough space in the # VG for an existing LV, since it's existence proves there is enough # space for it. - if not self.exists and size > self.vg.freeSpace + self.vgSpaceUsed: + if not self.exists and \ + not isinstance(self, LVMThinLogicalVolumeDevice) and \ + size > self.vg.freeSpace + self.vgSpaceUsed: log.error("failed to set size: %s short", size - (self.vg.freeSpace + self.vgSpaceUsed)) raise ValueError("not enough free space in volume group")
From: David Lehman dlehman@redhat.com
--- blivet/devices/storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py index a836a6d..38af58b 100644 --- a/blivet/devices/storage.py +++ b/blivet/devices/storage.py @@ -113,7 +113,7 @@ def __init__(self, name, fmt=None, uuid=None, # partitions and lvs with thoughtless initial sizes. if not self.exists and fmt and fmt.minSize: min_size = max(util.numeric_type(size), fmt.minSize) - if min_size > size: + if min_size > util.numeric_type(size): log.info("%s: using size %s instead of %s to accommodate " "format minimum size", name, min_size, size) size = min_size
From: David Lehman dlehman@redhat.com
The format type can impose limits on the size of the device, so clear it before setting the size. --- blivet/devicefactory.py | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index 634eab2..285d4b5 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -676,6 +676,10 @@ def _set_raid_level(self): 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
--- blivet/devicefactory.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index 285d4b5..776b4a8 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -383,6 +383,22 @@ def _get_free_disk_space(self): 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: @@ -812,7 +828,7 @@ def _configure(self): 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. --- blivet/devicefactory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index 776b4a8..2096800 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -706,7 +706,9 @@ def _set_size(self): 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):
These all look good to me.
Added label: ACK.
Closed.
anaconda-patches@lists.fedorahosted.org