1 Star 0 Fork 21

zhangxingrong/udisks2

forked from src-openEuler/udisks2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0002-Use-pvremove-when-removing-PVs-after-deleting-a-VG.patch 3.13 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxingrong 提交于 2024-06-17 09:37 +08:00 . add some patchs for upstream
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'''
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangxingrong/udisks2.git
git@gitee.com:zhangxingrong/udisks2.git
zhangxingrong
udisks2
udisks2
master

搜索帮助