python-blivet/0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch
2024-05-14 15:04:48 +02:00

50 lines
2.0 KiB
Diff

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()