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