From cbccb32ad7b8f869283d1a49b61f860cd2565e61 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Thu, 16 Apr 2026 15:32:04 +0200 Subject: [PATCH] Account for unusable space in the PV in LVMFactory Resolves: RHEL-39981 --- ...usable-space-in-the-PV-in-LVMFactory.patch | 28 +++++++++++++++++++ python-blivet.spec | 7 ++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 0040-Account-for-unusable-space-in-the-PV-in-LVMFactory.patch diff --git a/0040-Account-for-unusable-space-in-the-PV-in-LVMFactory.patch b/0040-Account-for-unusable-space-in-the-PV-in-LVMFactory.patch new file mode 100644 index 0000000..c250785 --- /dev/null +++ b/0040-Account-for-unusable-space-in-the-PV-in-LVMFactory.patch @@ -0,0 +1,28 @@ +From 8992929a6fcf0e702b3d5a5da7a9bf493a6e9d51 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 28 Jan 2026 09:35:36 +0100 +Subject: [PATCH] Account for unusable space in the PV in LVMFactory + +When calculating the amount of space needed in the factory, we +need to take PV metadata and alignment in account to make sure +the VG has enough free space for the LV which is being created. + +Resolves: RHEL-39981 +--- + blivet/devicefactory.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py +index 6f460f6d2..003254eac 100644 +--- a/blivet/devicefactory.py ++++ b/blivet/devicefactory.py +@@ -1413,6 +1413,9 @@ def _get_total_space(self): + space -= self.vg.free_space + # we need to account for the LVM metadata being placed somewhere + space += self.vg.lvm_metadata_space ++ # account for unusable space in the PV (difference between PV size and its usable ++ # space), this is dues to PV metadata and data alignment to ++ space += sum(pv.size - self.vg._get_pv_usable_space(pv) for pv in self.vg.parents) + else: + # we need to account for the LVM metadata being placed on each disk + # (and thus taking up to one extent from each disk) diff --git a/python-blivet.spec b/python-blivet.spec index 357f99f..ce9ea0c 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -23,7 +23,7 @@ Version: 3.6.0 #%%global prerelease .b2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 29%{?prerelease}%{?dist} +Release: 30%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ %global realname blivet @@ -69,6 +69,7 @@ Patch35: 0036-Make-ActionDestroyFormat-optional.patch Patch36: 0037-Wipe-end-partition-before-creating-it-as-well-as-the-start.patch Patch37: 0038-Add-a-pre-wipe-fixup-function-for-LVM-logical-volume.patch Patch38: 0039-iSCSI-dont-crash-when-LUN-ID-256.patch +Patch39: 0040-Account-for-unusable-space-in-the-PV-in-LVMFactory.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -232,6 +233,10 @@ configuration. %endif %changelog +* Thu Apr 16 2026 Vojtech Trefny - 3.6.0-30 +- Account for unusable space in the PV in LVMFactory + Resolves: RHEL-39981 + * Mon Nov 03 2025 Vojtech Trefny - 3.6.0-29 - iSCSI: don't crash when LUN ID >= 256 Resolves: RHEL-122858