diff --git a/0002-Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch b/0002-Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch new file mode 100644 index 0000000000000000000000000000000000000000..976f1a7d1745138442a4cc2933398a8a6af9e9bc --- /dev/null +++ b/0002-Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch @@ -0,0 +1,81 @@ +From 554029950586fbec40a5deff128e68e4fe7a0c7f Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 4 Jan 2024 13:21:11 +0100 +Subject: [PATCH] lvm: Use pvremove when removing PVs after deleting a VG + +udisks_daemon_util_lvm2_wipe_block is a huge hammer that also +tries to call vgreduce and pvscan and does other steps that are +not necessary when removing the PV signature after removing the +VG. + +Fixes: #1228 +--- + modules/lvm2/udiskslinuxvolumegroup.c | 10 +++++++++- + src/tests/dbus-tests/test_20_LVM.py | 26 ++++++++++++++++++++++++++ + 2 files changed, 35 insertions(+), 1 deletion(-) + +diff --git a/modules/lvm2/udiskslinuxvolumegroup.c b/modules/lvm2/udiskslinuxvolumegroup.c +index 35403419dd..1c51430e5d 100644 +--- a/modules/lvm2/udiskslinuxvolumegroup.c ++++ b/modules/lvm2/udiskslinuxvolumegroup.c +@@ -270,6 +270,7 @@ handle_delete (UDisksVolumeGroup *_group, + GList *objects_to_wipe = NULL; + GList *l; + VGJobData data; ++ const gchar *device_file = NULL; + + g_variant_lookup (arg_options, "tear-down", "b", &teardown_flag); + +@@ -354,7 +355,14 @@ handle_delete (UDisksVolumeGroup *_group, + { + UDisksBlock *block = udisks_object_peek_block (l->data); + if (block) +- udisks_daemon_util_lvm2_wipe_block (daemon, block, NULL); ++ { ++ device_file = udisks_block_get_device (block); ++ if (!bd_lvm_pvremove (device_file, NULL, &error)) ++ { ++ udisks_warning ("Failed to wipe PV %s: %s", device_file, error->message); ++ g_clear_error (&error); ++ } ++ } + } + + udisks_volume_group_complete_delete (_group, invocation); +diff --git a/src/tests/dbus-tests/test_20_LVM.py b/src/tests/dbus-tests/test_20_LVM.py +index d56987cf34..9095dfa036 100644 +--- a/src/tests/dbus-tests/test_20_LVM.py ++++ b/src/tests/dbus-tests/test_20_LVM.py +@@ -81,6 +81,32 @@ def test_01_manager_interface(self): + intro_data = manager.Introspect(self.no_options, dbus_interface='org.freedesktop.DBus.Introspectable') + self.assertIn('interface name="%s.Manager.LVM2"' % self.iface_prefix, intro_data) + ++ def test_05_vg(self): ++ '''Test basic VG functionality''' ++ ++ vgname = 'udisks_test_vg' ++ ++ dev_obj = self.get_object('/block_devices/' + os.path.basename(self.vdevs[0])) ++ self.assertIsNotNone(dev_obj) ++ self.addCleanup(self.wipe_fs, self.vdevs[0]) ++ vg = self._create_vg(vgname, [dev_obj]) ++ self.addCleanup(self._remove_vg, vg, ignore_removed=True) ++ ++ # remove the VG without removing the PV signatures ++ vg.Delete(False, self.no_options, dbus_interface=self.iface_prefix + '.VolumeGroup') ++ ++ fstype = self.get_property(dev_obj, '.Block', 'IdType') ++ fstype.assertEqual('LVM2_member') ++ ++ # create new VG ++ vg = self._create_vg(vgname, [dev_obj]) ++ ++ # remove the VG and wipe the PVs ++ vg.Delete(True, self.no_options, dbus_interface=self.iface_prefix + '.VolumeGroup') ++ ++ fstype = self.get_property(dev_obj, '.Block', 'IdType') ++ fstype.assertEqual('') ++ + def test_10_linear(self): + '''Test linear (plain) LV functionality''' + diff --git a/0003-adjust-translator-comment.patch b/0003-adjust-translator-comment.patch new file mode 100644 index 0000000000000000000000000000000000000000..3bacfae8ae1c91f01dc511f4e0e0e0116bb88a19 --- /dev/null +++ b/0003-adjust-translator-comment.patch @@ -0,0 +1,35 @@ +From 93320b5a20a640b22d5b9dde0d98414db228ec22 Mon Sep 17 00:00:00 2001 +From: FineFindus +Date: Tue, 6 Feb 2024 19:58:07 +0100 +Subject: [PATCH] objectinfo: adjust translator comment + +--- + udisks/udisksobjectinfo.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/udisks/udisksobjectinfo.c b/udisks/udisksobjectinfo.c +index 18aa192e55..d544c6c8c1 100644 +--- a/udisks/udisksobjectinfo.c ++++ b/udisks/udisksobjectinfo.c +@@ -452,9 +452,8 @@ udisks_client_get_object_info_for_mdraid (UDisksClient *client, + if (block != NULL) + { + /* Translators: String used for one-liner description of running RAID array w/o a name. +- * The first %s is the array name (e.g. "AlphaGo"). +- * The second %s is the size and level (e.g. "2 TB RAID-5"). +- * The third %s is the special device file (e.g. "/dev/sda"). ++ * The first %s is the size and level (e.g. "2 TB RAID-5"). ++ * The second %s is the special device file (e.g. "/dev/sda"). + */ + info->one_liner = g_strdup_printf (C_("one-liner-mdraid-no-name-running", "%s — %s"), + info->description, +@@ -463,8 +462,7 @@ udisks_client_get_object_info_for_mdraid (UDisksClient *client, + else + { + /* Translators: String used for one-liner description of non-running RAID array w/o a name. +- * The first %s is the array name (e.g. "AlphaGo"). +- * The second %s is the size and level (e.g. "2 TB RAID-5"). ++ * The %s is the size and level (e.g. "2 TB RAID-5"). + */ + info->one_liner = g_strdup_printf (C_("one-liner-mdraid-no-name-not-running", "%s"), + info->description); diff --git a/udisks2.spec b/udisks2.spec index 798c009beac8b577169c9a25032ed10698e6382e..c40f74fdc3dae5b5f044b369bef318d21192916e 100644 --- a/udisks2.spec +++ b/udisks2.spec @@ -19,7 +19,7 @@ Name: udisks2 Summary: Disk Manager Version: 2.10.1 -Release: 3 +Release: 4 License: GPL-2.0+ and LGPL-2.0+ Group: System Environment/Libraries URL: https://github.com/storaged-project/udisks @@ -27,6 +27,8 @@ Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{v Patch0001: 0001-mdraid-Expose-consistency_policy-sysfs-value.patch Patch0002: 0002-udiskslinuxmanager-use-dbus-interface-after-free.patch +Patch0003: 0002-Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch +Patch0004: 0003-adjust-translator-comment.patch BuildRequires: make BuildRequires: glib2-devel >= %{glib2_version} @@ -317,6 +319,9 @@ fi %changelog +* Mon Jun 17 2024 zhangxingrong - 2.10.1-4 +- lvm: Use pvremove when removing PVs after deleting a VG +- objectinfo: adjust translator comment * Tue Jun 18 2024 cenhuilin - 2.10.1-3 - udiskslinuxmanager:use dbus interface after free