From 41dda8a5a15be7f6a23c797569199d5622596f0b Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Tue, 14 May 2024 15:04:48 +0200 Subject: [PATCH] Fix skipping btrfs calls when libblockdev btrfs plugin is missing Resolves: RHEL-36190 --- ...-libblockdev-btrfs-plugin-is-missing.patch | 49 +++++++++++++++++++ python-blivet.spec | 8 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch diff --git a/0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch b/0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch new file mode 100644 index 0000000..cd9bf02 --- /dev/null +++ b/0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch @@ -0,0 +1,49 @@ +From 95f565d56d21dd7e0d9033236a20be735665e0af Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 14 May 2024 12:35:12 +0200 +Subject: [PATCH] Fix skipping btrfs calls when libblockdev btrfs plugin is + missing + +We need to check for the btrfs plugin in the set of available +plugins, not in the missing plugins, because on RHEL the plugin is +not missing, it's not even requested. +--- + blivet/devices/btrfs.py | 4 ++-- + tests/unit_tests/devices_test/btrfs_test.py | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py +index c446e7e59..0cbaa44d9 100644 +--- a/blivet/devices/btrfs.py ++++ b/blivet/devices/btrfs.py +@@ -40,7 +40,7 @@ + from ..formats import get_format, DeviceFormat + from ..size import Size + from ..mounts import mounts_cache +-from .. import missing_plugs ++from .. import avail_plugs + + import logging + log = logging.getLogger("blivet") +@@ -382,7 +382,7 @@ def _list_subvolumes(self, mountpoint, snapshots_only=False): + def list_subvolumes(self, snapshots_only=False): + subvols = [] + +- if "btrfs" in missing_plugs: ++ if "btrfs" not in avail_plugs: + log.debug("not listing btrfs subvolumes, libblockdev btrfs plugin is missing") + return subvols + +diff --git a/tests/unit_tests/devices_test/btrfs_test.py b/tests/unit_tests/devices_test/btrfs_test.py +index 785afd209..41731e91e 100644 +--- a/tests/unit_tests/devices_test/btrfs_test.py ++++ b/tests/unit_tests/devices_test/btrfs_test.py +@@ -83,7 +83,7 @@ def test_btrfs_list_subvolumes(self): + + # mounted but libblockdev btrfs plugin not available + blockdev.reset_mock() +- with patch("blivet.devices.btrfs.missing_plugs", new={"btrfs"}): ++ with patch("blivet.devices.btrfs.avail_plugs", new={"lvm"}): + vol.list_subvolumes() + blockdev.list_subvolumes.assert_not_called() + blockdev.get_default_subvolume_id.assert_not_called() diff --git a/python-blivet.spec b/python-blivet.spec index 0868360..cce5977 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -5,7 +5,7 @@ Version: 3.10.0 #%%global prerelease .b2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 1%{?prerelease}%{?dist} +Release: 2%{?prerelease}%{?dist} Epoch: 1 License: LGPL-2.1-or-later %global realname blivet @@ -17,6 +17,8 @@ Source1: http://github.com/storaged-project/blivet/archive/%{realname}-%{realver Patch0: 0001-remove-btrfs-plugin.patch %endif +Patch1: 0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch + # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). %global partedver 1.8.1 @@ -113,6 +115,10 @@ make DESTDIR=%{buildroot} install %{python3_sitelib}/* %changelog +* Tue May 14 2024 Vojtech Trefny - 3.10.0-2 +- Fix skipping btrfs calls when libblockdev btrfs plugin is missing + Resolves: RHEL-36190 + * Fri May 10 2024 Vojtech Trefny - 3.10.0-1 - Added support for PV grow (japokorn) - misc: Add stratis-cli and stratisd to test dependencies (vtrefny)