This is another followup to the patch from last week that checks device size against new format limits.
This one covers the case of a partition or lv instantiated with a size that's too small for its format metadata. This is going to happen regularly when people have kickstarts that do this:
part pv.01 --size=1 --grow
(The lvmpv format has a min size of 8 MiB.)
This seems reasonable to me because I cannot imagine anyone actually wanting a device smaller than any estimated minimum size for the format. When that person does come along, he/she can be told that is something they will have to do outside of anaconda (and blivet).
For the sake of completeness, the other options to handle this were:
1. raise an exception when the size is too small (current behavior) 2. add some machinery to blivet to postpone the checks for growable partitions and lvs until after they've been allocated
My assessment: #1 is too user-hostile and #2 is too much work to accommodate a fairly silly corner case (user wants to make a really tiny PV or BTRFS member).
Otherwise it's cumbersome to check size versus format for growable partitions with base sizes like 1 MiB (think kickstart). --- blivet/devices/storage.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py index 8843546..a2c0ef4 100644 --- a/blivet/devices/storage.py +++ b/blivet/devices/storage.py @@ -108,6 +108,16 @@ class StorageDevice(Device):
self._format = None
+ # For non-existent devices, make sure the initial size is enough for + # the format's metadata. This is mostly relevant for growable + # partitions and lvs with thoughtless initial sizes. + if not self.exists and fmt and fmt.minSize: + min_size = max(size, fmt.minSize) + if min_size > size: + log.info("%s: using size %s instead of %s to accommodate " + "format minimum size", name, min_size, size) + size = min_size + # The size will be overridden by a call to updateSize at the end of this # method for existing and active devices. self._size = Size(util.numeric_type(size))
On 16.7.2015 20:20, David Lehman wrote:
Otherwise it's cumbersome to check size versus format for growable partitions with base sizes like 1 MiB (think kickstart).
blivet/devices/storage.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py index 8843546..a2c0ef4 100644 --- a/blivet/devices/storage.py +++ b/blivet/devices/storage.py @@ -108,6 +108,16 @@ class StorageDevice(Device):
self._format = None
# For non-existent devices, make sure the initial size is enough for# the format's metadata. This is mostly relevant for growable# partitions and lvs with thoughtless initial sizes.if not self.exists and fmt and fmt.minSize:min_size = max(size, fmt.minSize)if min_size > size:log.info("%s: using size %s instead of %s to accommodate ""format minimum size", name, min_size, size)size = min_size# The size will be overridden by a call to updateSize at the end of this # method for existing and active devices. self._size = Size(util.numeric_type(size))
Ack.
On Thu, 2015-07-16 at 13:20 -0500, David Lehman wrote:
This is another followup to the patch from last week that checks device size against new format limits.
This one covers the case of a partition or lv instantiated with a size that's too small for its format metadata. This is going to happen regularly when people have kickstarts that do this:
part pv.01 --size=1 --grow
(The lvmpv format has a min size of 8 MiB.)
LVM doesn't require metadata on all PVs so this should be probably changed in the future. And it only confirms this patch is the right solution -- if such minimum size in kickstart is valid, it should raise an exception and if our presumptions about the minimum format sizes are wrong, it's these presumptions that should be fixed.
anaconda-patches@lists.fedorahosted.org