Account for unusable space in the PV in LVMFactory

Resolves: RHEL-45174
This commit is contained in:
Vojtech Trefny 2026-04-16 15:16:46 +02:00
parent e60c826e33
commit efc07e899a
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 342802d2575a51b71560849d1f638b7d898f3398 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-45174
---
blivet/devicefactory.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index e02f6c4f8..43a9c0eb6 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -1442,6 +1442,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

@ -5,7 +5,7 @@ Version: 3.13.0
#%%global prerelease .b2
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 5%{?prerelease}%{?dist}
Release: 6%{?prerelease}%{?dist}
Epoch: 1
License: LGPL-2.1-or-later
%global realname blivet
@ -20,6 +20,7 @@ Patch0: 0001-remove-btrfs-plugin.patch
Patch2: 0002-iSCSI-dont-crash-when-LUN-ID-256.patch
Patch3: 0003-Fix-luks-save_passphrase-for-missing-format-context.patch
Patch4: 0004-Fix-getting-iSCSI-firmware-initiator-name.patch
Patch5: 0005-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).
@ -117,6 +118,10 @@ make DESTDIR=%{buildroot} install
%{python3_sitelib}/*
%changelog
* Thu Apr 16 2026 Vojtech Trefny <vtrefny@redhat.com> - 3.13.0-6
- Account for unusable space in the PV in LVMFactory
Resolves: RHEL-45174
* Wed Feb 04 2026 Vojtech Trefny <vtrefny@redhat.com> - 3.13.0-5
- Fix getting iSCSI firmware initiator name
Resolves: RHEL-145882