[PATCH] Bump size of non-existent devices to format minimum.

David Lehman dlehman at redhat.com
Thu Jul 16 18:20:05 UTC 2015


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))
-- 
2.4.3



More information about the anaconda-patches mailing list