From 7a6962584ffdff7eccdd7fddc8d843c22edd68db Mon Sep 17 00:00:00 2001 From: yanshuai01 Date: Wed, 25 Sep 2024 15:59:52 +0800 Subject: [PATCH] Fix passing size for pvresize over DBus --- ...-passing-size-for-pvresize-over-DBus.patch | 69 +++++++++++++++++++ libblockdev.spec | 6 +- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 0009-Fix-passing-size-for-pvresize-over-DBus.patch diff --git a/0009-Fix-passing-size-for-pvresize-over-DBus.patch b/0009-Fix-passing-size-for-pvresize-over-DBus.patch new file mode 100644 index 0000000..23712bd --- /dev/null +++ b/0009-Fix-passing-size-for-pvresize-over-DBus.patch @@ -0,0 +1,69 @@ +From 7afe64265c9fc6ac67bfc412e43d00e5a21c867a Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Fri, 22 Mar 2024 14:54:15 +0100 +Subject: [PATCH] lvm-dbus: Fix passing size for pvresize over DBus + +"u" is UINT32, we need to use "t" for UINT64 + +--- + src/plugins/lvm-dbus.c | 2 +- + tests/lvm_dbus_tests.py | 6 ++++++ + tests/lvm_test.py | 6 ++++++ + 3 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c +index dfa12ff..61b162d 100644 +--- a/src/plugins/lvm-dbus.c ++++ b/src/plugins/lvm-dbus.c +@@ -1404,7 +1404,7 @@ gboolean bd_lvm_pvresize (const gchar *device, guint64 size, const BDExtraArg ** + if (!obj_path) + return FALSE; + +- params = g_variant_new ("(u)", size); ++ params = g_variant_new ("(t)", size); + call_lvm_method_sync (obj_path, PV_INTF, "ReSize", params, NULL, extra, TRUE, error); + + return (*error == NULL); +diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py +index 4882da8..2b017d8 100644 +--- a/tests/lvm_dbus_tests.py ++++ b/tests/lvm_dbus_tests.py +@@ -341,9 +341,15 @@ class LvmTestPVresize(LvmPVonlyTestCase): + succ = BlockDev.lvm_pvresize(self.loop_dev, 200 * 1024**2, None) + self.assertTrue(succ) + ++ info = BlockDev.lvm_pvinfo(self.loop_dev) ++ self.assertEqual(info.pv_size, 200 * 1024**2) ++ + succ = BlockDev.lvm_pvresize(self.loop_dev, 200 * 1024**3, None) + self.assertTrue(succ) + ++ info = BlockDev.lvm_pvinfo(self.loop_dev) ++ self.assertEqual(info.pv_size, 200 * 1024**3) ++ + @unittest.skipUnless(lvm_dbus_running, "LVM DBus not running") + class LvmTestPVscan(LvmPVonlyTestCase): + def test_pvscan(self): +diff --git a/tests/lvm_test.py b/tests/lvm_test.py +index eb94c91..06aca4e 100644 +--- a/tests/lvm_test.py ++++ b/tests/lvm_test.py +@@ -324,9 +324,15 @@ class LvmTestPVresize(LvmPVonlyTestCase): + succ = BlockDev.lvm_pvresize(self.loop_dev, 200 * 1024**2, None) + self.assertTrue(succ) + ++ info = BlockDev.lvm_pvinfo(self.loop_dev) ++ self.assertEqual(info.pv_size, 200 * 1024**2) ++ + succ = BlockDev.lvm_pvresize(self.loop_dev, 200 * 1024**3, None) + self.assertTrue(succ) + ++ info = BlockDev.lvm_pvinfo(self.loop_dev) ++ self.assertEqual(info.pv_size, 200 * 1024**3) ++ + class LvmTestPVscan(LvmPVonlyTestCase): + def test_pvscan(self): + """Verify that pvscan runs without issues with cache or without""" +-- +2.27.0 + diff --git a/libblockdev.spec b/libblockdev.spec index ae98eb2..fca0de4 100644 --- a/libblockdev.spec +++ b/libblockdev.spec @@ -3,7 +3,7 @@ Name: libblockdev Version: 2.26 -Release: 4 +Release: 5 Summary: libblockdev is a C library supporting GObject introspection for manipulation of block devices License: LGPLv2+ URL: https://github.com/storaged-project/libblockdev @@ -17,6 +17,7 @@ Patch5: 0005-lvm-Fix-memory-leak-bd_lvm_cache_create_cached_lv.patch Patch6: 0006-fs-Fix-return-values-in-bd_fs_ntfs_get_info.patch Patch7: 0007-fs-Fix-return-values-in-bd_fs_xfs_get_info.patch Patch8: 0008-dm-Fix-comparing-DM-RAID-member-devices-UUID.patch +Patch9: 0009-Fix-passing-size-for-pvresize-over-DBus.patch BuildRequires: make glib2-devel libyaml-devel libbytesize-devel parted-devel libuuid-devel ndctl-devel device-mapper-devel BuildRequires: device-mapper-devel systemd-devel nss-devel volume_key-devel >= 0.3.9-7 libblkid-devel libmount-devel @@ -166,6 +167,9 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} %changelog +* Wed Sep 25 2024 yanshuai - 2.26-5 +- DESC:lvm-dbus: Fix passing size for pvresize over DBus + * Tue Jan 2 2024 liyanan - 2.26-4 - remove require vdo -- Gitee