From 3d6d37e8ba73b52a70ef1ec0f74d53611c982198 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Jun 29 2021 08:15:36 +0000 Subject: Add workarounds for some LVM test issues Resolves: rhbz#1976174 Adapt tests to xfsprogs 5.12 changes Resolves: rhbz#1976176 --- diff --git a/0005-Add-workarounds-for-some-LVM-test-issues.patch b/0005-Add-workarounds-for-some-LVM-test-issues.patch new file mode 100644 index 0000000..c41d687 --- /dev/null +++ b/0005-Add-workarounds-for-some-LVM-test-issues.patch @@ -0,0 +1,157 @@ +From 7c31cc534f96766dd2e3427b09d0affca66b0745 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 23 Mar 2021 13:54:02 +0100 +Subject: [PATCH 1/3] tests: Do not try to remove VG before removing the VDO + pool + +--- + tests/lvm_dbus_tests.py | 6 +++--- + tests/lvm_test.py | 6 +++--- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py +index 8f2bb95d..b599fdd0 100644 +--- a/tests/lvm_dbus_tests.py ++++ b/tests/lvm_dbus_tests.py +@@ -1517,14 +1517,14 @@ def setUp(self): + self.assertTrue(succ) + + def _clean_up(self): +- BlockDev.lvm_vgremove("testVDOVG") +- BlockDev.lvm_pvremove(self.loop_dev) +- + try: + BlockDev.lvm_lvremove("testVDOVG", "vdoPool", True, None) + except: + pass + ++ BlockDev.lvm_vgremove("testVDOVG") ++ BlockDev.lvm_pvremove(self.loop_dev) ++ + try: + delete_lio_device(self.loop_dev) + except RuntimeError: +diff --git a/tests/lvm_test.py b/tests/lvm_test.py +index 6f80a3ba..6c04faf9 100644 +--- a/tests/lvm_test.py ++++ b/tests/lvm_test.py +@@ -1437,14 +1437,14 @@ def setUp(self): + self.assertTrue(succ) + + def _clean_up(self): +- BlockDev.lvm_vgremove("testVDOVG") +- BlockDev.lvm_pvremove(self.loop_dev) +- + try: + BlockDev.lvm_lvremove("testVDOVG", "vdoPool", True, None) + except: + pass + ++ BlockDev.lvm_vgremove("testVDOVG") ++ BlockDev.lvm_pvremove(self.loop_dev) ++ + try: + delete_lio_device(self.loop_dev) + except RuntimeError: + +From 41b9d745b8c1a33221e15683f390bae180d1e960 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 23 Mar 2021 13:59:24 +0100 +Subject: [PATCH 2/3] tests: Force remove LVM VG /dev/ entry not removed by + vgremove + +The directory is sometimes not removed. This is a known bug that +causes subsequent test cases to fail. +--- + tests/lvm_dbus_tests.py | 6 ++++++ + tests/lvm_test.py | 6 ++++++ + 2 files changed, 12 insertions(+) + +diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py +index b599fdd0..3278716e 100644 +--- a/tests/lvm_dbus_tests.py ++++ b/tests/lvm_dbus_tests.py +@@ -399,6 +399,9 @@ def _clean_up(self): + except: + pass + ++ # XXX remove lingering /dev entries ++ shutil.rmtree("/dev/testVG", ignore_errors=True) ++ + LvmPVonlyTestCase._clean_up(self) + + @unittest.skipUnless(lvm_dbus_running, "LVM DBus not running") +@@ -1525,6 +1528,9 @@ def _clean_up(self): + BlockDev.lvm_vgremove("testVDOVG") + BlockDev.lvm_pvremove(self.loop_dev) + ++ # XXX remove lingering /dev entries ++ shutil.rmtree("/dev/testVDOVG", ignore_errors=True) ++ + try: + delete_lio_device(self.loop_dev) + except RuntimeError: +diff --git a/tests/lvm_test.py b/tests/lvm_test.py +index 6c04faf9..d7e1f84c 100644 +--- a/tests/lvm_test.py ++++ b/tests/lvm_test.py +@@ -378,6 +378,9 @@ def _clean_up(self): + except: + pass + ++ # XXX remove lingering /dev entries ++ shutil.rmtree("/dev/testVG", ignore_errors=True) ++ + LvmPVonlyTestCase._clean_up(self) + + class LvmTestVGcreateRemove(LvmPVVGTestCase): +@@ -1445,6 +1448,9 @@ def _clean_up(self): + BlockDev.lvm_vgremove("testVDOVG") + BlockDev.lvm_pvremove(self.loop_dev) + ++ # XXX remove lingering /dev entries ++ shutil.rmtree("/dev/testVDOVG", ignore_errors=True) ++ + try: + delete_lio_device(self.loop_dev) + except RuntimeError: + +From 4ecf0075cedf3a1d275d34b94ce5bb512c4e970e Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 23 Mar 2021 14:03:44 +0100 +Subject: [PATCH 3/3] tests: Tag LvmPVVGLVcachePoolCreateRemoveTestCase as + unstable + +LVM randomly fails to activate the newly created metadata LV. +Issue is reported to LVM and not yet fixed. +--- + tests/lvm_dbus_tests.py | 2 +- + tests/lvm_test.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py +index 3278716e..4882da88 100644 +--- a/tests/lvm_dbus_tests.py ++++ b/tests/lvm_dbus_tests.py +@@ -1213,7 +1213,7 @@ def _clean_up(self): + + @unittest.skipUnless(lvm_dbus_running, "LVM DBus not running") + class LvmPVVGLVcachePoolCreateRemoveTestCase(LvmPVVGLVcachePoolTestCase): +- @tag_test(TestTags.SLOW) ++ @tag_test(TestTags.SLOW, TestTags.UNSTABLE) + def test_cache_pool_create_remove(self): + """Verify that is it possible to create and remove a cache pool""" + +diff --git a/tests/lvm_test.py b/tests/lvm_test.py +index d7e1f84c..eb94c917 100644 +--- a/tests/lvm_test.py ++++ b/tests/lvm_test.py +@@ -1129,7 +1129,7 @@ def _clean_up(self): + LvmPVVGLVTestCase._clean_up(self) + + class LvmPVVGLVcachePoolCreateRemoveTestCase(LvmPVVGLVcachePoolTestCase): +- @tag_test(TestTags.SLOW) ++ @tag_test(TestTags.SLOW, TestTags.UNSTABLE) + def test_cache_pool_create_remove(self): + """Verify that is it possible to create and remove a cache pool""" + diff --git a/0006-Misc-test-fixes-backport.patch b/0006-Misc-test-fixes-backport.patch new file mode 100644 index 0000000..12746c5 --- /dev/null +++ b/0006-Misc-test-fixes-backport.patch @@ -0,0 +1,144 @@ +From 77b8d17b0baf96a7a552fb8963afdbe8c3b18da7 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 2 Jun 2021 12:53:24 +0200 +Subject: [PATCH 1/4] tests: Make sure the test temp mount is always unmounted + +With try-finally the unmount function will always run even if the +test case fails. +--- + tests/fs_test.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tests/fs_test.py b/tests/fs_test.py +index 2233db4f..de685b5f 100644 +--- a/tests/fs_test.py ++++ b/tests/fs_test.py +@@ -29,8 +29,10 @@ def check_output(args, ignore_retcode=True): + @contextmanager + def mounted(device, where, ro=False): + mount(device, where, ro) +- yield +- umount(where) ++ try: ++ yield ++ finally: ++ utils.umount(where) + + + def _get_dosfstools_version(): + +From aa802b6a2c9038069cfea7f821333367840a43ca Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 2 Jun 2021 13:05:17 +0200 +Subject: [PATCH 2/4] tests: Do not check that XFS shrink fails with xfsprogs + >= 5.12 + +xfsprogs 5.12 now has experimental support for shrinking, we need +more changes to support it properly so just skip this check for +now. +--- + tests/fs_test.py | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +diff --git a/tests/fs_test.py b/tests/fs_test.py +index de685b5f..551b6a7b 100644 +--- a/tests/fs_test.py ++++ b/tests/fs_test.py +@@ -44,6 +44,14 @@ def _get_dosfstools_version(): + return LooseVersion(m.groups()[0]) + + ++def _get_xfs_version(): ++ _ret, out, _err = utils.run_command("mkfs.xfs -V") ++ m = re.search(r"mkfs\.xfs version ([\d\.]+)", out) ++ if not m or len(m.groups()) != 1: ++ raise RuntimeError("Failed to determine xfsprogs version from: %s" % out) ++ return LooseVersion(m.groups()[0]) ++ ++ + class FSTestCase(unittest.TestCase): + + requested_plugins = BlockDev.plugin_specs_from_names(("fs", "loop")) +@@ -736,9 +744,11 @@ def test_xfs_resize(self): + self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2) + + # (still) impossible to shrink an XFS file system +- with mounted(lv, self.mount_dir): +- with self.assertRaises(GLib.GError): +- succ = BlockDev.fs_xfs_resize(self.mount_dir, 40 * 1024**2 / fi.block_size, None) ++ xfs_version = _get_xfs_version() ++ if xfs_version < LooseVersion("5.1.12"): ++ with mounted(lv, self.mount_dir): ++ with self.assertRaises(GLib.GError): ++ succ = BlockDev.fs_resize(lv, 40 * 1024**2) + + run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1") + # should grow +@@ -1503,9 +1513,11 @@ def test_xfs_generic_resize(self): + self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2) + + # (still) impossible to shrink an XFS file system +- with mounted(lv, self.mount_dir): +- with self.assertRaises(GLib.GError): +- succ = BlockDev.fs_resize(lv, 40 * 1024**2) ++ xfs_version = _get_xfs_version() ++ if xfs_version < LooseVersion("5.1.12"): ++ with mounted(lv, self.mount_dir): ++ with self.assertRaises(GLib.GError): ++ succ = BlockDev.fs_resize(lv, 40 * 1024**2) + + run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1") + # should grow + +From ca01b6021cce3ea6a2318e74de408757f933d947 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 2 Jun 2021 13:06:41 +0200 +Subject: [PATCH 3/4] tests: Temporarily skip + test_snapshotcreate_lvorigin_snapshotmerge + +With LVM DBus API the lvconvert job is never finished which means +the test run never finishes in our CI. +--- + tests/skip.yml | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/tests/skip.yml b/tests/skip.yml +index 145d321d..e22e712d 100644 +--- a/tests/skip.yml ++++ b/tests/skip.yml +@@ -137,3 +137,9 @@ + - distro: "fedora" + version: ["31", "32"] + reason: "working with old-style LVM snapshots leads to deadlock in LVM tools" ++ ++- test: lvm_dbus_tests.LvmTestLVsnapshots.test_snapshotcreate_lvorigin_snapshotmerge ++ skip_on: ++ - distro: "centos" ++ version: "9" ++ reason: "snapshot merge doesn't work on CentOS 9 Stream with LVM DBus API" + +From d0c44cd3d182599433f352901796af7c403239eb Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 2 Jun 2021 13:08:09 +0200 +Subject: [PATCH 4/4] Fix skipping tests on Debian testing + +Testing now identifies itself as "Debian GNU/Linux 11 (bullseye)" +so the tests that should be skipped on testing needs to be skipped +on "11" too. +--- + tests/skip.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/skip.yml b/tests/skip.yml +index e22e712d..4134ee87 100644 +--- a/tests/skip.yml ++++ b/tests/skip.yml +@@ -37,7 +37,7 @@ + - test: fs_test.MountTest.test_mount_ntfs_ro + skip_on: + - distro: "debian" +- version: ["9", "10", "testing"] ++ version: ["9", "10", "11", "testing"] + reason: "NTFS mounting of read-only devices doesn't work as expected on Debian" + + - test: kbd_test.KbdZRAM* diff --git a/libblockdev.spec b/libblockdev.spec index 56c3a55..d5bc4bb 100644 --- a/libblockdev.spec +++ b/libblockdev.spec @@ -125,7 +125,7 @@ Name: libblockdev Version: 2.25 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A library for low-level manipulation with block devices License: LGPLv2+ URL: https://github.com/storaged-project/libblockdev @@ -135,6 +135,8 @@ Patch1: 0001-Fix-comparing-DM-RAID-member-devices-UUID.patch Patch2: 0002-Fix-default-key-size-for-non-XTS-ciphers.patch Patch3: 0003-Memory-leaks-fixes-backport.patch Patch4: 0004-Adapt-to-dosfstools-4.2-changes.patch +Patch5: 0005-Add-workarounds-for-some-LVM-test-issues.patch +Patch6: 0006-Misc-test-fixes-backport.patch BuildRequires: make BuildRequires: glib2-devel @@ -691,6 +693,8 @@ A meta-package that pulls all the libblockdev plugins as dependencies. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build autoreconf -ivf @@ -994,6 +998,12 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} %files plugins-all %changelog +* Tue Jun 29 2021 Vojtech Trefny - 2.25-6 +- Add workarounds for some LVM test issues + Resolves: rhbz#1976174 +- Adapt tests to xfsprogs 5.12 changes + Resolves: rhbz#1976176 + * Tue May 18 2021 Vojtech Trefny - 2.25-5 - Adapt to dosfstools 4.2 changes Resolves: rhbz#1960624