Blame SOURCES/0016-Automatically-adjust-size-of-growable-devices-for-new-format.patch

bda387
From caec289d8220fc9a8d8b3d6e99271394f4ef83fe Mon Sep 17 00:00:00 2001
bda387
From: Vojtech Trefny <vtrefny@redhat.com>
bda387
Date: Wed, 27 Feb 2019 12:26:30 +0100
bda387
Subject: [PATCH] Automatically adjust size of growable devices for new format
bda387
bda387
Without this kickstart 'part /home --size=1 --grow --encrypted'
bda387
will fail because min size for LUKS is 2 MiB.
bda387
bda387
Resolves: rhbz#1680013
bda387
---
bda387
 blivet/devices/storage.py | 7 ++++++-
bda387
 1 file changed, 6 insertions(+), 1 deletion(-)
bda387
bda387
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
bda387
index 904b60df..9d6001e8 100644
bda387
--- a/blivet/devices/storage.py
bda387
+++ b/blivet/devices/storage.py
bda387
@@ -721,7 +721,12 @@ def _set_format(self, fmt):
bda387
             if fmt.max_size and fmt.max_size < self.size:
bda387
                 raise errors.DeviceError("device is too large for new format")
bda387
             elif fmt.min_size and fmt.min_size > self.size:
bda387
-                raise errors.DeviceError("device is too small for new format")
bda387
+                if self.growable:
bda387
+                    log.info("%s: using size %s instead of %s to accommodate "
bda387
+                             "format minimum size", self.name, fmt.min_size, self.size)
bda387
+                    self.size = fmt.min_size
bda387
+                else:
bda387
+                    raise errors.DeviceError("device is too small for new format")
bda387
 
bda387
         if self._format != fmt:
bda387
             callbacks.format_removed(device=self, fmt=self._format)