代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/udisks2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 554029950586fbec40a5deff128e68e4fe7a0c7f Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
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'''
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。