- Catch BlockDevNotImplementedError for btrfs plugin calls

Resolves: rhbz#2139166
- Revert "Adjust to new XFS min size"
  Resolves: rhbz#2139189
This commit is contained in:
Vojtech Trefny 2022-11-03 08:41:29 +01:00
parent 4a6944ce14
commit 7e17f25c75
3 changed files with 224 additions and 1 deletions

View File

@ -0,0 +1,160 @@
From 9618b84f94187efddc7316c2546bed923a91ecf9 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 3 Nov 2022 08:36:27 +0100
Subject: [PATCH 1/2] Revert "Set XFS minimal size to 300 MiB"
This reverts commit 307d49833771d161314bae50c68e70dc35c3bb36.
---
blivet/formats/fs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 8c346aa5..33922f3a 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -1091,7 +1091,7 @@ class XFS(FS):
_modules = ["xfs"]
_labelfs = fslabeling.XFSLabeling()
_uuidfs = fsuuid.XFSUUID()
- _min_size = Size("300 MiB")
+ _min_size = Size("16 MiB")
_max_size = Size("16 EiB")
_formattable = True
_linux_native = True
--
2.38.1
From 24d94922d6879baa85aaa101f6b21efa568a9cbc Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 3 Nov 2022 08:36:39 +0100
Subject: [PATCH 2/2] Revert "tests: Create bigger devices for XFS testing"
This reverts commit 467cb8024010b2cabb1e92d9e64f6d3cbe949ad9.
---
tests/storage_tests/formats_test/fs_test.py | 7 +++----
tests/storage_tests/formats_test/fslabeling.py | 4 +---
tests/storage_tests/formats_test/fsuuid.py | 4 +---
tests/storage_tests/formats_test/labeling_test.py | 2 --
tests/storage_tests/formats_test/uuid_test.py | 3 ---
5 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/tests/storage_tests/formats_test/fs_test.py b/tests/storage_tests/formats_test/fs_test.py
index cf8fb441..97f4cbbe 100644
--- a/tests/storage_tests/formats_test/fs_test.py
+++ b/tests/storage_tests/formats_test/fs_test.py
@@ -54,7 +54,6 @@ class ReiserFSTestCase(fstesting.FSAsRoot):
class XFSTestCase(fstesting.FSAsRoot):
_fs_class = fs.XFS
- _DEVICE_SIZE = Size("500 MiB")
def can_resize(self, an_fs):
resize_tasks = (an_fs._resize, an_fs._size_info)
@@ -96,12 +95,12 @@ class XFSTestCase(fstesting.FSAsRoot):
self.assertFalse(an_fs.resizable)
# Not resizable, so can not do resizing actions.
with self.assertRaises(DeviceFormatError):
- an_fs.target_size = Size("300 MiB")
+ an_fs.target_size = Size("64 MiB")
with self.assertRaises(DeviceFormatError):
an_fs.do_resize()
else:
disk = DiskDevice(os.path.basename(self.loop_devices[0]))
- part = self._create_partition(disk, Size("300 MiB"))
+ part = self._create_partition(disk, Size("50 MiB"))
an_fs = self._fs_class()
an_fs.device = part.path
self.assertIsNone(an_fs.create())
@@ -114,7 +113,7 @@ class XFSTestCase(fstesting.FSAsRoot):
part = self._create_partition(disk, size=part.size + Size("40 MiB"))
# Try a reasonable target size
- TARGET_SIZE = Size("325 MiB")
+ TARGET_SIZE = Size("64 MiB")
an_fs.target_size = TARGET_SIZE
self.assertEqual(an_fs.target_size, TARGET_SIZE)
self.assertNotEqual(an_fs._size, TARGET_SIZE)
diff --git a/tests/storage_tests/formats_test/fslabeling.py b/tests/storage_tests/formats_test/fslabeling.py
index ebe0b70a..0e0dc261 100644
--- a/tests/storage_tests/formats_test/fslabeling.py
+++ b/tests/storage_tests/formats_test/fslabeling.py
@@ -21,10 +21,8 @@ class LabelingAsRoot(loopbackedtestcase.LoopBackedTestCase):
_invalid_label = abc.abstractproperty(
doc="A label which is invalid for this filesystem.")
- _DEVICE_SIZE = Size("100 MiB")
-
def __init__(self, methodName='run_test'):
- super(LabelingAsRoot, self).__init__(methodName=methodName, device_spec=[self._DEVICE_SIZE])
+ super(LabelingAsRoot, self).__init__(methodName=methodName, device_spec=[Size("100 MiB")])
def setUp(self):
an_fs = self._fs_class()
diff --git a/tests/storage_tests/formats_test/fsuuid.py b/tests/storage_tests/formats_test/fsuuid.py
index 0b9762fd..16aa19a6 100644
--- a/tests/storage_tests/formats_test/fsuuid.py
+++ b/tests/storage_tests/formats_test/fsuuid.py
@@ -23,11 +23,9 @@ class SetUUID(loopbackedtestcase.LoopBackedTestCase):
_invalid_uuid = abc.abstractproperty(
doc="An invalid UUID for this filesystem.")
- _DEVICE_SIZE = Size("100 MiB")
-
def __init__(self, methodName='run_test'):
super(SetUUID, self).__init__(methodName=methodName,
- device_spec=[self._DEVICE_SIZE])
+ device_spec=[Size("100 MiB")])
def setUp(self):
an_fs = self._fs_class()
diff --git a/tests/storage_tests/formats_test/labeling_test.py b/tests/storage_tests/formats_test/labeling_test.py
index 0702260a..d24e6619 100644
--- a/tests/storage_tests/formats_test/labeling_test.py
+++ b/tests/storage_tests/formats_test/labeling_test.py
@@ -1,7 +1,6 @@
import unittest
from blivet.formats import device_formats
-from blivet.size import Size
import blivet.formats.fs as fs
import blivet.formats.swap as swap
@@ -62,7 +61,6 @@ class InitializationTestCase(unittest.TestCase):
class XFSTestCase(fslabeling.CompleteLabelingAsRoot):
_fs_class = fs.XFS
_invalid_label = "root filesystem"
- _DEVICE_SIZE = Size("500 MiB")
class FATFSTestCase(fslabeling.CompleteLabelingAsRoot):
diff --git a/tests/storage_tests/formats_test/uuid_test.py b/tests/storage_tests/formats_test/uuid_test.py
index af35c0ee..ee8d452e 100644
--- a/tests/storage_tests/formats_test/uuid_test.py
+++ b/tests/storage_tests/formats_test/uuid_test.py
@@ -2,7 +2,6 @@ import unittest
import blivet.formats.fs as fs
import blivet.formats.swap as swap
-from blivet.size import Size
from . import fsuuid
@@ -53,14 +52,12 @@ class XFSTestCase(fsuuid.SetUUIDWithMkFs):
_fs_class = fs.XFS
_invalid_uuid = "abcdefgh-ijkl-mnop-qrst-uvwxyz123456"
_valid_uuid = "97e3d40f-dca8-497d-8b86-92f257402465"
- _DEVICE_SIZE = Size("500 MiB")
class XFSAfterTestCase(fsuuid.SetUUIDAfterMkFs):
_fs_class = fs.XFS
_invalid_uuid = "abcdefgh-ijkl-mnop-qrst-uvwxyz123456"
_valid_uuid = "97e3d40f-dca8-497d-8b86-92f257402465"
- _DEVICE_SIZE = Size("500 MiB")
class FATFSTestCase(fsuuid.SetUUIDWithMkFs):
--
2.38.1

View File

@ -0,0 +1,55 @@
From fed62af06eb1584adbacd821dfe79c2df52c6aa4 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 2 Nov 2022 12:14:28 +0100
Subject: [PATCH] Catch BlockDevNotImplementedError for btrfs plugin calls
This is a workaround for RHEL where the btrfs plugin is not
available and where we might still try to call some libblockdev
functions to gather information about preexisting btrfs devices.
---
blivet/devices/btrfs.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py
index 0e029715..1ae6a04d 100644
--- a/blivet/devices/btrfs.py
+++ b/blivet/devices/btrfs.py
@@ -362,7 +362,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice):
try:
subvols = blockdev.btrfs.list_subvolumes(mountpoint,
snapshots_only=snapshots_only)
- except blockdev.BtrfsError as e:
+ except (blockdev.BtrfsError, blockdev.BlockDevNotImplementedError) as e:
log.debug("failed to list subvolumes: %s", e)
else:
self._get_default_subvolume_id()
@@ -400,7 +400,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice):
with self._do_temp_mount() as mountpoint:
try:
subvolid = blockdev.btrfs.get_default_subvolume_id(mountpoint)
- except blockdev.BtrfsError as e:
+ except (blockdev.BtrfsError, blockdev.BlockDevNotImplementedError) as e:
log.debug("failed to get default subvolume id: %s", e)
self._default_subvolume_id = subvolid
@@ -413,7 +413,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice):
with self._do_temp_mount() as mountpoint:
try:
blockdev.btrfs.set_default_subvolume(mountpoint, vol_id)
- except blockdev.BtrfsError as e:
+ except (blockdev.BtrfsError, blockdev.BlockDevNotImplementedError) as e:
log.error("failed to set new default subvolume id (%s): %s",
vol_id, e)
# The only time we set a new default subvolume is so we can remove
@@ -471,7 +471,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice):
if not self.format.vol_uuid:
try:
bd_info = blockdev.btrfs.filesystem_info(self.parents[0].path)
- except blockdev.BtrfsError as e:
+ except (blockdev.BtrfsError, blockdev.BlockDevNotImplementedError) as e:
log.error("failed to get filesystem info for new btrfs volume %s", e)
else:
self.format.vol_uuid = bd_info.uuid
--
2.38.1

View File

@ -23,7 +23,7 @@ Version: 3.6.0
#%%global prerelease .b2 #%%global prerelease .b2
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 2%{?prerelease}%{?dist} Release: 3%{?prerelease}%{?dist}
Epoch: 1 Epoch: 1
License: LGPLv2+ License: LGPLv2+
%global realname blivet %global realname blivet
@ -37,6 +37,8 @@ Patch3: 0004-DDF-RAID-support-using-mdadm.patch
Patch4: 0005-Revert-Remove-the-Blivet.roots-attribute.patch Patch4: 0005-Revert-Remove-the-Blivet.roots-attribute.patch
Patch5: 0006-Fix-potential-AttributeError-when-getting-stratis-bl.patch Patch5: 0006-Fix-potential-AttributeError-when-getting-stratis-bl.patch
Patch6: 0007-tests-Skip-XFS-resize-test-on-CentOS-RHEL-9.patch Patch6: 0007-tests-Skip-XFS-resize-test-on-CentOS-RHEL-9.patch
Patch7: 0008-Revert-Adjust-to-new-XFS-min-size.patch
Patch8: 0009-Catch-BlockDevNotImplementedError-for-btrfs-plugin-c.patch
# Versions of required components (done so we make sure the buildrequires # Versions of required components (done so we make sure the buildrequires
# match the requires versions of things). # match the requires versions of things).
@ -199,6 +201,12 @@ configuration.
%endif %endif
%changelog %changelog
* Thu Nov 03 2022 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-3
- Catch BlockDevNotImplementedError for btrfs plugin calls
Resolves: rhbz#2139166
- Revert "Adjust to new XFS min size"
Resolves: rhbz#2139189
* Thu Oct 20 2022 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-2 * Thu Oct 20 2022 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-2
- Fix potential AttributeError when getting stratis blockdev info - Fix potential AttributeError when getting stratis blockdev info
Related: rhbz#2123711 Related: rhbz#2123711