Fix skipping btrfs calls when libblockdev btrfs plugin is missing

Resolves: RHEL-36190
This commit is contained in:
Vojtech Trefny 2024-05-14 15:04:48 +02:00
parent 0d35f1887b
commit 41dda8a5a1
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 95f565d56d21dd7e0d9033236a20be735665e0af Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
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()

View File

@ -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 <vtrefny@redhat.com> - 3.10.0-2
- Fix skipping btrfs calls when libblockdev btrfs plugin is missing
Resolves: RHEL-36190
* Fri May 10 2024 Vojtech Trefny <vtrefny@redhat.com> - 3.10.0-1
- Added support for PV grow (japokorn)
- misc: Add stratis-cli and stratisd to test dependencies (vtrefny)