Fix patch for 'Add support LVM devices file management'

Resolves: rhbz#1983705
This commit is contained in:
Vojtech Trefny 2021-11-30 15:44:02 +01:00
parent 0711d4714a
commit bd37303947
2 changed files with 24 additions and 23 deletions

View File

@ -1,4 +1,4 @@
From eb5aa6189093e957c5a3ca1b3826c3d9d2b122cb Mon Sep 17 00:00:00 2001
From e364883416785d51ff8eb132b63bd802ab0ccfe9 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 13 Jul 2021 13:22:05 +0200
Subject: [PATCH 1/8] lvm: Allow configuring global "device filter" for LVM
@ -17,11 +17,11 @@ this globally, which we already do for the --config option.
src/plugins/lvm-dbus.c | 74 ++++++++-
src/plugins/lvm.c | 97 ++++++++++--
src/plugins/lvm.h | 4 +
tests/library_test.py | 307 ++++++++++++++++++++----------------
tests/library_test.py | 304 ++++++++++++++++++++----------------
tests/lvm_dbus_tests.py | 47 +++++-
tests/lvm_test.py | 50 ++++++
tests/overrides_test.py | 23 ++-
8 files changed, 472 insertions(+), 153 deletions(-)
8 files changed, 469 insertions(+), 153 deletions(-)
diff --git a/src/lib/plugin_apis/lvm.api b/src/lib/plugin_apis/lvm.api
index 563c104..62f602f 100644
@ -391,10 +391,10 @@ index 2162d76..8063693 100644
const gchar* bd_lvm_cache_get_mode_str (BDLVMCacheMode mode, GError **error);
BDLVMCacheMode bd_lvm_cache_get_mode_from_str (const gchar *mode_str, GError **error);
diff --git a/tests/library_test.py b/tests/library_test.py
index 08e44fd..ad2663d 100644
index 08e44fd..efd17bd 100644
--- a/tests/library_test.py
+++ b/tests/library_test.py
@@ -13,18 +13,181 @@ class LibraryOpsTestCase(unittest.TestCase):
@@ -13,18 +13,178 @@ class LibraryOpsTestCase(unittest.TestCase):
# all plugins except for 'btrfs', 'fs' and 'mpath' -- these don't have all
# the dependencies on CentOS/Debian and we don't need them for this test
requested_plugins = BlockDev.plugin_specs_from_names(("crypto", "dm",
@ -426,9 +426,6 @@ index 08e44fd..ad2663d 100644
+
+ self.assertTrue(BlockDev.reinit(self.requested_plugins, False, self.my_log_func))
+
+ # we are cheking for info log messages and default level is warning
+ BlockDev.utils_set_log_level(BlockDev.UTILS_LOG_INFO)
+
+ succ = BlockDev.utils_exec_and_report_error(["true"])
+ self.assertTrue(succ)
+
@ -522,7 +519,7 @@ index 08e44fd..ad2663d 100644
+
+ # try reinitializing with only some utilities being available and thus
+ # only some plugins able to load
+ with fake_path("tests/fake_utils/lib_missing_utils", keep_utils=["swapon", "swapoff", "mkswap", "swaplabel"]):
+ with fake_path("tests/lib_missing_utils", keep_utils=["swapon", "swapoff", "mkswap", "swaplabel"]):
+ succ, loaded = BlockDev.try_reinit(self.requested_plugins, True, None)
+ self.assertFalse(succ)
+ for plug_name in ("swap", "crypto"):
@ -533,7 +530,7 @@ index 08e44fd..ad2663d 100644
+
+ # now the same with a subset of plugins requested
+ plugins = BlockDev.plugin_specs_from_names(["swap", "crypto"])
+ with fake_path("tests/fake_utils/lib_missing_utils", keep_utils=["swapon", "swapoff", "mkswap", "swaplabel"]):
+ with fake_path("tests/lib_missing_utils", keep_utils=["swapon", "swapoff", "mkswap", "swaplabel"]):
+ succ, loaded = BlockDev.try_reinit(plugins, True, None)
+ self.assertTrue(succ)
+ self.assertEqual(set(loaded), set(["swap", "crypto"]))
@ -577,7 +574,7 @@ index 08e44fd..ad2663d 100644
def setUp(self):
self.orig_config_dir = os.environ.get("LIBBLOCKDEV_CONFIG_DIR", "")
self.addCleanup(self._clean_up)
@@ -185,6 +348,12 @@ class LibraryOpsTestCase(unittest.TestCase):
@@ -185,6 +345,12 @@ class LibraryOpsTestCase(unittest.TestCase):
def test_plugin_fallback(self):
"""Verify that fallback when loading plugins works as expected"""
@ -590,7 +587,7 @@ index 08e44fd..ad2663d 100644
# library should be successfully initialized
self.assertTrue(BlockDev.is_initialized())
@@ -206,7 +375,7 @@ class LibraryOpsTestCase(unittest.TestCase):
@@ -206,7 +372,7 @@ class LibraryOpsTestCase(unittest.TestCase):
# now reinit the library with the config preferring the new build
orig_conf_dir = os.environ.get("LIBBLOCKDEV_CONFIG_DIR")
@ -599,7 +596,7 @@ index 08e44fd..ad2663d 100644
self.assertTrue(BlockDev.reinit(self.requested_plugins, True, None))
# the original plugin should be loaded because the new one should fail
@@ -243,139 +412,9 @@ class LibraryOpsTestCase(unittest.TestCase):
@@ -243,139 +409,9 @@ class LibraryOpsTestCase(unittest.TestCase):
self.assertEqual(BlockDev.lvm_get_max_lv_size(), orig_max_size)
@ -658,7 +655,7 @@ index 08e44fd..ad2663d 100644
-
- # should be loaded and working
- self.assertTrue(BlockDev.lvm_get_max_lv_size() > 0)
-
- ps = BlockDev.PluginSpec()
- ps.name = BlockDev.Plugin.SWAP
- ps.so_name = ""
@ -727,7 +724,7 @@ index 08e44fd..ad2663d 100644
-
- def test_non_en_init(self):
- """Verify that the library initializes with lang different from en_US"""
-
- orig_lang = os.environ.get("LANG")
- os.environ["LANG"] = "cs.CZ_UTF-8"
- self.assertTrue(BlockDev.reinit(self.requested_plugins, True, None))
@ -963,7 +960,7 @@ index 8e7f5a5..d3faf3c 100644
2.31.1
From 56c78f404ed165b50cd943c35d00abf059888f77 Mon Sep 17 00:00:00 2001
From bebd74962db6fb7b5314be411a4d02b21554d80f Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 13 Jul 2021 13:27:32 +0200
Subject: [PATCH 2/8] lvm: Add functions for managing LVM devices file
@ -1281,7 +1278,7 @@ index b37a879..786434f 100644
2.31.1
From 7ee4449db55d6627f38671073f4edb8662dcc375 Mon Sep 17 00:00:00 2001
From 8d8cbe7169cb94b01e7064a0d00b7d86baf5e652 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 15 Oct 2021 13:18:54 +0200
Subject: [PATCH 3/8] lvm: Report special error when system.devices file is not
@ -1554,7 +1551,7 @@ index 786434f..315dd07 100644
2.31.1
From 6d0fa244ce13553c605487b8f26b4313cac5112e Mon Sep 17 00:00:00 2001
From 81df85e7ea6e129e78074b6967f80c505d1b08f0 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 15 Oct 2021 14:21:03 +0200
Subject: [PATCH 4/8] lvm: Force enable LVM devices file for LvmTestDevicesFile
@ -1623,7 +1620,7 @@ index 315dd07..ea3b7f8 100644
2.31.1
From d5b353b772e8de9ae7dc1f7cafa151817c758232 Mon Sep 17 00:00:00 2001
From 01237b62bb8ad67def7c937185c42152503fbc6f Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 12 Nov 2021 14:51:39 +0100
Subject: [PATCH 5/8] tests: Fix resetting global LVM config after LVM devices
@ -1697,7 +1694,7 @@ index ea3b7f8..882cdf2 100644
2.31.1
From 364a150473f12c55b443c5cc8b9704b48789c81c Mon Sep 17 00:00:00 2001
From 2f33f2af18efa0b337f8383cb6f137d6211fe7fb Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 12 Nov 2021 15:10:45 +0100
Subject: [PATCH 6/8] lvm: Do not set global config to and empty string
@ -1788,7 +1785,7 @@ index 882cdf2..e349817 100644
2.31.1
From 7592f09e884b4c2c1759a291c7a8b78fc227f66f Mon Sep 17 00:00:00 2001
From 2a4e610027a2c2a315054b84a323ce973939ca2d Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 16 Mar 2021 12:05:37 +0100
Subject: [PATCH 7/8] vdo: Do not use g_memdup in bd_vdo_stats_copy
@ -1860,7 +1857,7 @@ index 2352394..d443099 100644
2.31.1
From dd0b959970b4a5621728c2198997eed5890e1bd7 Mon Sep 17 00:00:00 2001
From 577ea466e3b7af464137e087907ba980ad3994ee Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 26 Nov 2021 15:19:55 +0100
Subject: [PATCH 8/8] lvm: Use "lvmconfig full" to get valid config instead of

View File

@ -125,7 +125,7 @@
Name: libblockdev
Version: 2.25
Release: 8%{?dist}
Release: 9%{?dist}
Summary: A library for low-level manipulation with block devices
License: LGPLv2+
URL: https://github.com/storaged-project/libblockdev
@ -1000,6 +1000,10 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
%files plugins-all
%changelog
* Tue Nov 30 2021 Vojtech Trefny <vtrefny@redhat.com> - 2.25-9
- Fix patch for 'Add support LVM devices file management'
Resolves: rhbz#1983705
* Tue Nov 30 2021 Vojtech Trefny <vtrefny@redhat.com> - 2.25-8
- Add support LVM devices file management
Resolves: rhbz#1983705