From d64657187e8e91f0c8b8d2491a83b93b43442e88 Mon Sep 17 00:00:00 2001 From: zhangxingrong Date: Thu, 6 Jun 2024 19:37:57 +0800 Subject: [PATCH] add some patch for upstream --- ...hen-removing-PVs-after-deleting-a-VG.patch | 81 +++++++++++++++++++ adjust-translator-comment.patch | 35 ++++++++ udisks2.spec | 9 ++- 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch create mode 100644 adjust-translator-comment.patch diff --git a/Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch b/Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch new file mode 100644 index 0000000..976f1a7 --- /dev/null +++ b/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/adjust-translator-comment.patch b/adjust-translator-comment.patch new file mode 100644 index 0000000..3bacfae --- /dev/null +++ b/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 05467ca..1730c11 100644 --- a/udisks2.spec +++ b/udisks2.spec @@ -19,12 +19,15 @@ Name: udisks2 Summary: Disk Manager Version: 2.10.1 -Release: 1 +Release: 2 License: GPL-2.0+ and LGPL-2.0+ Group: System Environment/Libraries URL: https://github.com/storaged-project/udisks Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2 +Patch1: Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch +Patch2: adjust-translator-comment.patch + BuildRequires: make BuildRequires: glib2-devel >= %{glib2_version} BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version} @@ -314,6 +317,10 @@ fi %changelog +* Thu Jun 06 2024 zhangxingrong - 2.10.1-2 +- lvm: Use pvremove when removing PVs after deleting a VG +- objectinfo: adjust translator comment + * Mon Oct 30 2023 li weigang - 2.10.1-1 - update to version 2.10.1 -- Gitee