diff options
author | Tony Asleson <tasleson@redhat.com> | 2022-09-22 16:18:48 -0500 |
---|---|---|
committer | Tony Asleson <tasleson@redhat.com> | 2022-09-22 16:19:16 -0500 |
commit | 7966f1dd18ab88199da7dd0d84a44945c2f864ca (patch) | |
tree | 14fa13643575768b8c3e9d215eac043fe1179d70 /test/dbus | |
parent | 40018cbf5386e4ba76c0d4cc10aa1bd88ef0e6ab (diff) | |
download | lvm2-7966f1dd18ab88199da7dd0d84a44945c2f864ca.tar.gz |
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.
Diffstat (limited to 'test/dbus')
-rwxr-xr-x | test/dbus/lvmdbustest.py | 6 |
1 files changed, 5 insertions, 1 deletions
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 |