From 7966f1dd18ab88199da7dd0d84a44945c2f864ca Mon Sep 17 00:00:00 2001 From: Tony Asleson Date: Thu, 22 Sep 2022 16:18:48 -0500 Subject: [PATCH] lvmdbustest: Refuse to remove a VG we didn't create One of our previous commits introduced the side effect that we could inadvertently remove a VG we didn't create, and lose data. --- test/dbus/lvmdbustest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py index fc84026df..9b1024db3 100755 --- a/test/dbus/lvmdbustest.py +++ b/test/dbus/lvmdbustest.py @@ -410,9 +410,13 @@ class TestDbusService(unittest.TestCase): self.vdo = supports_vdo() def _recurse_vg_delete(self, vg_proxy, pv_proxy, nested_pv_hash): + vg_name = str(vg_proxy.Vg.Name) + + if not vg_name.endswith(VG_TEST_SUFFIX): + std_err_print("Refusing to remove VG: %s" % vg_name) + return for pv_device_name, t in nested_pv_hash.items(): - vg_name = str(vg_proxy.Vg.Name) if vg_name in pv_device_name: self._recurse_vg_delete(t[0], t[1], nested_pv_hash) break