From 569e5b5085c8e222ae3f487991ec74c4c4e7c4bf Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Wed, 30 Apr 2025 14:33:37 +0200 Subject: [PATCH] fix: Correctly check PVs for grow_to_fill feature We need to check the size of the PV format and compare it to the size of the underlying block device when deciding if the format size should be grown. The size of the VG (self._device here) is not relevant for this operation. This code used to work because of a bug in blivet where size of the VG was incorrectly calculated for PVs with size not matching the underlying block device size, this was fixed in blivet (see https://github.com/storaged-project/blivet/pull/1334) so the grow_to_fill feature no longer works without this fix. --- library/blivet.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/blivet.py b/library/blivet.py index 4327d23d..67122ea7 100644 --- a/library/blivet.py +++ b/library/blivet.py @@ -1854,17 +1854,16 @@ def _manage_members(self): grow_pv_candidates = [pv for pv in self._device.pvs if pv not in remove_pvs and pv not in add_disks] for pv in grow_pv_candidates: - if abs(self._device.size - self._device.current_size) < 2 * self._device.pe_size: - continue - pv.format.update_size_info() # set pv to be resizable - if pv.format.resizable: + if not pv.format.resizable: + log.warning("cannot grow/resize PV '%s', format is not resizable", pv.name) + continue + + if abs(pv.size - pv.format.size) > 2 * self._device.pe_size: pv.format.grow_to_fill = True ac = ActionResizeFormat(pv, pv.size) self._blivet.devicetree.actions.add(ac) - else: - log.warning("cannot grow/resize PV '%s', format is not resizable", pv.name) if not (add_disks or remove_pvs): return