From 3f1a4d95d1e21ce52b3c84ec09c85d95fe3c015c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 28 2020 08:54:59 +0000 Subject: import libblockdev-2.19-12.el8 --- diff --git a/SOURCES/0006-use-cryptsetup-to-check-LUKS2-label.patch b/SOURCES/0006-use-cryptsetup-to-check-LUKS2-label.patch new file mode 100644 index 0000000..49e519a --- /dev/null +++ b/SOURCES/0006-use-cryptsetup-to-check-LUKS2-label.patch @@ -0,0 +1,31 @@ +From d6c4429bbb09fae249d7b97b06a9346cdc99f962 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 19 Dec 2018 09:36:30 +0100 +Subject: [PATCH] Use cryptsetup to check LUKS2 label + +libblkid on CentOS 7.6 doesn't support reading LUKS2 labels +--- + tests/crypto_test.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/tests/crypto_test.py b/tests/crypto_test.py +index 7320e74..b8aacee 100644 +--- a/tests/crypto_test.py ++++ b/tests/crypto_test.py +@@ -148,8 +148,11 @@ class CryptoTestFormat(CryptoTestCase): + BlockDev.CryptoLUKSVersion.LUKS2, extra) + self.assertTrue(succ) + +- _ret, label, _err = run_command("lsblk -oLABEL -n %s" % self.loop_dev) +- self.assertEqual(label, "blockdevLUKS") ++ _ret, out, err = run_command("cryptsetup luksDump %s" % self.loop_dev) ++ m = re.search(r"Label:\s*(\S+)\s*", out) ++ if not m or len(m.groups()) != 1: ++ self.fail("Failed to get label information from:\n%s %s" % (out, err)) ++ self.assertEqual(m.group(1), "blockdevLUKS") + + # different key derivation function + pbkdf = BlockDev.CryptoLUKSPBKDF(type="pbkdf2") +-- +2.21.0 + diff --git a/SOURCES/0007-fix-expected-cache-pool-name-with-newest-LVM.patch b/SOURCES/0007-fix-expected-cache-pool-name-with-newest-LVM.patch new file mode 100644 index 0000000..1b508c2 --- /dev/null +++ b/SOURCES/0007-fix-expected-cache-pool-name-with-newest-LVM.patch @@ -0,0 +1,101 @@ +From 23e6f2024c34fc6e1b3a67c416334bba2b55d5a9 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 31 Oct 2019 12:50:03 +0100 +Subject: [PATCH] Fix expected cache pool name with newest LVM + +LVM now adds "_cpool" suffix to attached pools. +--- + tests/lvm_dbus_tests.py | 17 ++++++++++++++++- + tests/lvm_test.py | 19 +++++++++++++++++-- + 2 files changed, 33 insertions(+), 3 deletions(-) + +diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py +index 625a392..f2a17c9 100644 +--- a/tests/lvm_dbus_tests.py ++++ b/tests/lvm_dbus_tests.py +@@ -6,6 +6,7 @@ import overrides_hack + import six + import re + import subprocess ++from distutils.version import LooseVersion + from itertools import chain + + from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, run_command, TestTags, tag_test +@@ -31,6 +32,13 @@ class LVMTestCase(unittest.TestCase): + else: + BlockDev.reinit([cls.ps, cls.ps2], True, None) + ++ def _get_lvm_version(self): ++ _ret, out, _err = run_command("lvm version") ++ m = re.search(r"LVM version:\s+([\d\.]+)", out) ++ if not m or len(m.groups()) != 1: ++ raise RuntimeError("Failed to determine LVM version from: %s" % out) ++ return LooseVersion(m.groups()[0]) ++ + @unittest.skipUnless(lvm_dbus_running, "LVM DBus not running") + class LvmNoDevTestCase(LVMTestCase): + +@@ -1291,7 +1299,14 @@ class LvmPVVGcachedLVpoolTestCase(LvmPVVGLVTestCase): + succ = BlockDev.lvm_cache_attach("testVG", "testLV", "testCache", None) + self.assertTrue(succ) + +- self.assertEqual(BlockDev.lvm_cache_pool_name("testVG", "testLV"), "testCache") ++ lvm_version = self._get_lvm_version() ++ if lvm_version < LooseVersion("2.03.06"): ++ cpool_name = "testCache" ++ else: ++ # since 2.03.06 LVM adds _cpool suffix to the cache pool after attaching it ++ cpool_name = "testCache_cpool" ++ ++ self.assertEqual(BlockDev.lvm_cache_pool_name("testVG", "testLV"), cpool_name) + + @unittest.skipUnless(lvm_dbus_running, "LVM DBus not running") + class LvmPVVGcachedLVstatsTestCase(LvmPVVGLVTestCase): +diff --git a/tests/lvm_test.py b/tests/lvm_test.py +index 0b2c5ad..242ca94 100644 +--- a/tests/lvm_test.py ++++ b/tests/lvm_test.py +@@ -6,8 +6,9 @@ import overrides_hack + import six + import re + import subprocess ++from distutils.version import LooseVersion + +-from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, fake_utils, fake_path, skip_on, TestTags, tag_test ++from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, fake_utils, fake_path, skip_on, TestTags, tag_test, run_command + from gi.repository import BlockDev, GLib + + +@@ -25,6 +26,13 @@ class LVMTestCase(unittest.TestCase): + else: + BlockDev.reinit(cls.requested_plugins, True, None) + ++ def _get_lvm_version(self): ++ _ret, out, _err = run_command("lvm version") ++ m = re.search(r"LVM version:\s+([\d\.]+)", out) ++ if not m or len(m.groups()) != 1: ++ raise RuntimeError("Failed to determine LVM version from: %s" % out) ++ return LooseVersion(m.groups()[0]) ++ + + class LvmNoDevTestCase(LVMTestCase): + def __init__(self, *args, **kwargs): +@@ -1249,7 +1257,14 @@ class LvmPVVGcachedLVpoolTestCase(LvmPVVGLVTestCase): + succ = BlockDev.lvm_cache_attach("testVG", "testLV", "testCache", None) + self.assertTrue(succ) + +- self.assertEqual(BlockDev.lvm_cache_pool_name("testVG", "testLV"), "testCache") ++ lvm_version = self._get_lvm_version() ++ if lvm_version < LooseVersion("2.03.06"): ++ cpool_name = "testCache" ++ else: ++ # since 2.03.06 LVM adds _cpool suffix to the cache pool after attaching it ++ cpool_name = "testCache_cpool" ++ ++ self.assertEqual(BlockDev.lvm_cache_pool_name("testVG", "testLV"), cpool_name) + + class LvmPVVGcachedLVstatsTestCase(LvmPVVGLVTestCase): + @tag_test(TestTags.SLOW) +-- +2.21.0 + diff --git a/SPECS/libblockdev.spec b/SPECS/libblockdev.spec index c9b3160..116d353 100644 --- a/SPECS/libblockdev.spec +++ b/SPECS/libblockdev.spec @@ -120,7 +120,7 @@ Name: libblockdev Version: 2.19 -Release: 11%{?dist} +Release: 12%{?dist} Summary: A library for low-level manipulation with block devices License: LGPLv2+ URL: https://github.com/storaged-project/libblockdev @@ -130,6 +130,8 @@ Patch1: 0002-major-minor-macros.patch Patch2: 0003-gating-tests-changes.patch Patch3: 0004-memory-leaks.patch Patch4: 0005-swap-status-on-dm.patch +Patch5: 0006-use-cryptsetup-to-check-LUKS2-label.patch +Patch6: 0007-fix-expected-cache-pool-name-with-newest-LVM.patch BuildRequires: glib2-devel %if %{with_gi} @@ -663,6 +665,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 @@ -962,7 +966,13 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} %files plugins-all %changelog -* Mon Jun 06 2019 Vojtech Trefny - 2.19-10 +* Mon Dec 02 2019 Vojtech Trefny - 2.19-12 +- Use cryptsetup to check LUKS2 label + Resolves: rhbz#1778689 +- Fix expected cache pool name with newest LVM + Related: rhbz#1778689 + +* Mon Jun 06 2019 Vojtech Trefny - 2.19-11 - Fix checking swap status on lvm/md (vtrefny) Resolves: rhbz#1649815