import CS python-blivet-3.6.0-17.el9
This commit is contained in:
parent
44e604fc33
commit
b106324818
129
SOURCES/0024-Added-support-for-PV-grow.patch
Normal file
129
SOURCES/0024-Added-support-for-PV-grow.patch
Normal file
@ -0,0 +1,129 @@
|
||||
From 0777b9d519421f3c46f6dcd51e39ecdc2956e2e0 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Pokorny <japokorn@redhat.com>
|
||||
Date: Thu, 25 Apr 2024 14:06:13 +0200
|
||||
Subject: [PATCH] Added support for PV grow
|
||||
|
||||
Storage role requires support for a case when PV has to be resized to
|
||||
fill all available space when its device's size changes (usually on VM).
|
||||
|
||||
A new flag 'grow_to_fill' was added, which marks the device for size
|
||||
expansion (all available space it taken).
|
||||
Proper size is determined by LVM, avoiding inaccurate size
|
||||
calculations in blivet.
|
||||
---
|
||||
blivet/formats/__init__.py | 4 +++-
|
||||
blivet/formats/lvmpv.py | 23 ++++++++++++++++++-
|
||||
blivet/tasks/pvtask.py | 7 +++++-
|
||||
.../storage_tests/formats_test/lvmpv_test.py | 10 ++++++++
|
||||
4 files changed, 41 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py
|
||||
index b1ad740e..eb8b6ab3 100644
|
||||
--- a/blivet/formats/__init__.py
|
||||
+++ b/blivet/formats/__init__.py
|
||||
@@ -424,7 +424,9 @@ class DeviceFormat(ObjectID):
|
||||
if not self.resizable:
|
||||
raise FormatResizeError("format not resizable", self.device)
|
||||
|
||||
- if self.target_size == self.current_size:
|
||||
+ # skip if sizes are equal unless grow to fill on lvmpv is requested
|
||||
+ if (self.target_size == self.current_size and
|
||||
+ (self.type != "lvmpv" or not self.grow_to_fill)): # pylint: disable=no-member
|
||||
return
|
||||
|
||||
if not self._resize.available:
|
||||
diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py
|
||||
index 65acedbe..51fa4a3c 100644
|
||||
--- a/blivet/formats/lvmpv.py
|
||||
+++ b/blivet/formats/lvmpv.py
|
||||
@@ -33,7 +33,7 @@ from ..devicelibs import lvm
|
||||
from ..tasks import availability, pvtask
|
||||
from ..i18n import N_
|
||||
from ..size import Size
|
||||
-from ..errors import PhysicalVolumeError
|
||||
+from ..errors import DeviceFormatError, PhysicalVolumeError
|
||||
from . import DeviceFormat, register_device_format
|
||||
from .. import udev
|
||||
from ..static_data.lvm_info import pvs_info, vgs_info
|
||||
@@ -98,6 +98,9 @@ class LVMPhysicalVolume(DeviceFormat):
|
||||
|
||||
self.inconsistent_vg = False
|
||||
|
||||
+ # when set to True, blivet will try to resize the PV to fill all available space
|
||||
+ self._grow_to_fill = False
|
||||
+
|
||||
def __repr__(self):
|
||||
s = DeviceFormat.__repr__(self)
|
||||
s += (" vg_name = %(vg_name)s vg_uuid = %(vg_uuid)s"
|
||||
@@ -106,6 +109,24 @@ class LVMPhysicalVolume(DeviceFormat):
|
||||
"pe_start": self.pe_start, "data_alignment": self.data_alignment})
|
||||
return s
|
||||
|
||||
+ @property
|
||||
+ def grow_to_fill(self):
|
||||
+ """
|
||||
+ Can be set to True to mark format for resize so it matches size of its device.
|
||||
+ (Main usecase is disk size increase on VM)
|
||||
+ Uses blockdev/lvm for exact new size calculation.
|
||||
+ ActionResizeFormat has to be executed to apply the change.
|
||||
+ Format has to be resizable (i.e. run format.update_size_info() first) to allow this.
|
||||
+ """
|
||||
+ return self._grow_to_fill
|
||||
+
|
||||
+ @grow_to_fill.setter
|
||||
+ def grow_to_fill(self, fill: bool):
|
||||
+ if fill is True:
|
||||
+ if not self.resizable:
|
||||
+ raise DeviceFormatError("format is not resizable")
|
||||
+ self._grow_to_fill = fill
|
||||
+
|
||||
@property
|
||||
def dict(self):
|
||||
d = super(LVMPhysicalVolume, self).dict
|
||||
diff --git a/blivet/tasks/pvtask.py b/blivet/tasks/pvtask.py
|
||||
index 04c8a4d1..b5bd72e0 100644
|
||||
--- a/blivet/tasks/pvtask.py
|
||||
+++ b/blivet/tasks/pvtask.py
|
||||
@@ -82,6 +82,11 @@ class PVResize(task.BasicApplication, dfresize.DFResizeTask):
|
||||
def do_task(self): # pylint: disable=arguments-differ
|
||||
""" Resizes the LVMPV format. """
|
||||
try:
|
||||
- blockdev.lvm.pvresize(self.pv.device, self.pv.target_size.convert_to(self.unit))
|
||||
+ if self.pv.grow_to_fill:
|
||||
+ # resize PV to fill all available space on device by omitting
|
||||
+ # the size parameter
|
||||
+ blockdev.lvm.pvresize(self.pv.device, 0)
|
||||
+ else:
|
||||
+ blockdev.lvm.pvresize(self.pv.device, self.pv.target_size.convert_to(self.unit))
|
||||
except blockdev.LVMError as e:
|
||||
raise PhysicalVolumeError(e)
|
||||
diff --git a/tests/storage_tests/formats_test/lvmpv_test.py b/tests/storage_tests/formats_test/lvmpv_test.py
|
||||
index cdc33ec4..d2811f3e 100644
|
||||
--- a/tests/storage_tests/formats_test/lvmpv_test.py
|
||||
+++ b/tests/storage_tests/formats_test/lvmpv_test.py
|
||||
@@ -37,6 +37,9 @@ class LVMPVTestCase(loopbackedtestcase.LoopBackedTestCase):
|
||||
self.fmt.update_size_info()
|
||||
self.assertTrue(self.fmt.resizable)
|
||||
|
||||
+ # save the pv maximum size
|
||||
+ maxpvsize = self.fmt.current_size
|
||||
+
|
||||
# resize the format
|
||||
new_size = Size("50 MiB")
|
||||
self.fmt.target_size = new_size
|
||||
@@ -46,5 +49,12 @@ class LVMPVTestCase(loopbackedtestcase.LoopBackedTestCase):
|
||||
self.fmt.update_size_info()
|
||||
self.assertEqual(self.fmt.current_size, new_size)
|
||||
|
||||
+ # Test growing PV to fill all available space on the device
|
||||
+ self.fmt.grow_to_fill = True
|
||||
+ self.fmt.do_resize()
|
||||
+
|
||||
+ self.fmt.update_size_info()
|
||||
+ self.assertEqual(self.fmt.current_size, maxpvsize)
|
||||
+
|
||||
def _pvremove(self):
|
||||
self.fmt._destroy()
|
||||
--
|
||||
2.45.0
|
||||
|
1328
SOURCES/0025-Stratis-fixes-backport.patch
Normal file
1328
SOURCES/0025-Stratis-fixes-backport.patch
Normal file
File diff suppressed because it is too large
Load Diff
76
SOURCES/0026-XFS-resize-test-fix.patch
Normal file
76
SOURCES/0026-XFS-resize-test-fix.patch
Normal file
@ -0,0 +1,76 @@
|
||||
From c2e247fe953568a65c73f5408a6da7af12c4d6a1 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
||||
Date: Tue, 18 Jun 2024 14:47:39 +0200
|
||||
Subject: [PATCH 1/2] tests: Try waiting after partition creation for XFS
|
||||
resize test
|
||||
|
||||
The test randomly fails to find the newly created partition so
|
||||
lets try waiting a bit with udev settle.
|
||||
---
|
||||
tests/skip.yml | 6 ------
|
||||
tests/storage_tests/formats_test/fs_test.py | 2 ++
|
||||
2 files changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tests/skip.yml b/tests/skip.yml
|
||||
index c0ca0eaf..8d353b1b 100644
|
||||
--- a/tests/skip.yml
|
||||
+++ b/tests/skip.yml
|
||||
@@ -23,9 +23,3 @@
|
||||
# - all "skips" can specified as a list, for example 'version: [10, 11]'
|
||||
|
||||
---
|
||||
-
|
||||
-- test: storage_tests.formats_test.fs_test.XFSTestCase.test_resize
|
||||
- skip_on:
|
||||
- - distro: ["centos", "enterprise_linux"]
|
||||
- version: "9"
|
||||
- reason: "Creating partitions on loop devices is broken on CentOS/RHEL 9 latest kernel"
|
||||
diff --git a/tests/storage_tests/formats_test/fs_test.py b/tests/storage_tests/formats_test/fs_test.py
|
||||
index 1d42dc21..59c0f998 100644
|
||||
--- a/tests/storage_tests/formats_test/fs_test.py
|
||||
+++ b/tests/storage_tests/formats_test/fs_test.py
|
||||
@@ -10,6 +10,7 @@ from blivet.errors import DeviceFormatError, FSError
|
||||
from blivet.formats import get_format
|
||||
from blivet.devices import PartitionDevice, DiskDevice
|
||||
from blivet.flags import flags
|
||||
+from blivet import udev
|
||||
|
||||
from .loopbackedtestcase import LoopBackedTestCase
|
||||
|
||||
@@ -107,6 +108,7 @@ class XFSTestCase(fstesting.FSAsRoot):
|
||||
pend = pstart + int(Size(size) / disk.format.parted_device.sectorSize)
|
||||
disk.format.add_partition(pstart, pend, parted.PARTITION_NORMAL)
|
||||
disk.format.parted_disk.commit()
|
||||
+ udev.settle()
|
||||
part = disk.format.parted_disk.getPartitionBySector(pstart)
|
||||
|
||||
device = PartitionDevice(os.path.basename(part.path))
|
||||
--
|
||||
2.45.2
|
||||
|
||||
|
||||
From 511d64c69618de0e7bb567353e5e0c92b61da10e Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
||||
Date: Thu, 7 Mar 2024 09:45:28 +0100
|
||||
Subject: [PATCH 2/2] Fix util.detect_virt on Amazon
|
||||
|
||||
---
|
||||
blivet/util.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/blivet/util.py b/blivet/util.py
|
||||
index 3040ee5a..15d41b4f 100644
|
||||
--- a/blivet/util.py
|
||||
+++ b/blivet/util.py
|
||||
@@ -1137,7 +1137,7 @@ def detect_virt():
|
||||
except (safe_dbus.DBusCallError, safe_dbus.DBusPropertyError):
|
||||
return False
|
||||
else:
|
||||
- return vm[0] in ('qemu', 'kvm', 'xen')
|
||||
+ return vm[0] in ('qemu', 'kvm', 'xen', 'microsoft', 'amazon')
|
||||
|
||||
|
||||
def natural_sort_key(device):
|
||||
--
|
||||
2.45.2
|
||||
|
@ -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: 14%{?prerelease}%{?dist}
|
||||
Release: 17%{?prerelease}%{?dist}
|
||||
Epoch: 1
|
||||
License: LGPLv2+
|
||||
%global realname blivet
|
||||
@ -53,6 +53,9 @@ Patch19: 0020-nvme-add_unit_tests.patch
|
||||
Patch20: 0021-Add-support-for-creating-shared-LVM-setups.patch
|
||||
Patch21: 0022-add-udev-builtin-path_id-property-to-zfcp-attached-S.patch
|
||||
Patch22: 0023-Do-not-add-new-PVs-to-the-LVM-devices-file-if-it-doe.patch
|
||||
Patch23: 0024-Added-support-for-PV-grow.patch
|
||||
Patch24: 0025-Stratis-fixes-backport.patch
|
||||
Patch25: 0026-XFS-resize-test-fix.patch
|
||||
|
||||
# Versions of required components (done so we make sure the buildrequires
|
||||
# match the requires versions of things).
|
||||
@ -216,6 +219,20 @@ configuration.
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Jul 22 2024 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-17
|
||||
- Fix 'Try waiting after partition creation for XFS resize test'
|
||||
Resolves: RHEL-8009
|
||||
|
||||
* Thu Jun 27 2024 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-16
|
||||
- tests: Try waiting after partition creation for XFS resize test
|
||||
Resolves: RHEL-8009
|
||||
|
||||
* Thu May 16 2024 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-15
|
||||
- Backport fixes for Stratis support needed for storage role
|
||||
Resolves: RHEL-35382
|
||||
- Add support for resizing PVs to the size of the underlying block device
|
||||
Resolves: RHEL-35386
|
||||
|
||||
* Fri Feb 09 2024 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-14
|
||||
- Do not add new PVs to the LVM devices file if it doesn't exist and VGs are present
|
||||
Resolves: RHEL-473
|
||||
|
Loading…
Reference in New Issue
Block a user