Account for unusable space in the PV in LVMFactory

Resolves: RHEL-39981
This commit is contained in:
Vojtech Trefny 2026-04-16 15:32:04 +02:00
parent c678f04796
commit cbccb32ad7
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 8992929a6fcf0e702b3d5a5da7a9bf493a6e9d51 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
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)

View File

@ -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 <vtrefny@redhat.com> - 3.6.0-30
- Account for unusable space in the PV in LVMFactory
Resolves: RHEL-39981
* Mon Nov 03 2025 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-29
- iSCSI: don't crash when LUN ID >= 256
Resolves: RHEL-122858