1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Tony Asleson 2022-09-22 16:18:48 -05:00
parent 40018cbf53
commit 7966f1dd18

View File

@ -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