Skip to content

Commit f8bd640

Browse files
vojtechtrefnyrichm
authored andcommitted
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 storaged-project/blivet#1334) so the grow_to_fill feature no longer works without this fix.
1 parent 3b66fcb commit f8bd640

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

library/blivet.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,17 +1854,16 @@ def _manage_members(self):
18541854
grow_pv_candidates = [pv for pv in self._device.pvs if pv not in remove_pvs and pv not in add_disks]
18551855

18561856
for pv in grow_pv_candidates:
1857-
if abs(self._device.size - self._device.current_size) < 2 * self._device.pe_size:
1858-
continue
1859-
18601857
pv.format.update_size_info() # set pv to be resizable
18611858

1862-
if pv.format.resizable:
1859+
if not pv.format.resizable:
1860+
log.warning("cannot grow/resize PV '%s', format is not resizable", pv.name)
1861+
continue
1862+
1863+
if abs(pv.size - pv.format.size) > 2 * self._device.pe_size:
18631864
pv.format.grow_to_fill = True
18641865
ac = ActionResizeFormat(pv, pv.size)
18651866
self._blivet.devicetree.actions.add(ac)
1866-
else:
1867-
log.warning("cannot grow/resize PV '%s', format is not resizable", pv.name)
18681867

18691868
if not (add_disks or remove_pvs):
18701869
return

0 commit comments

Comments
 (0)