]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: do not leave pv when zapping osds
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 28 Mar 2022 22:01:39 +0000 (00:01 +0200)
committerAdam King <adking@redhat.com>
Tue, 3 May 2022 00:48:33 +0000 (20:48 -0400)
when zapping a device and no vg/lv are left, the pv should be
removed too.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 7f007e7fc75b4d6e7465c684f7e5b2458883dcc5)

src/ceph-volume/ceph_volume/devices/lvm/zap.py

index d74e88fb633e45d2a1067c55b3ed1ffdb9a43163..9f8141d5406ce7aefda66d9bb7c7bb7c856fd61c 100644 (file)
@@ -168,6 +168,7 @@ class Zap(object):
         """
         lv = api.get_single_lv(filters={'lv_name': device.lv_name, 'vg_name':
                                         device.vg_name})
+        pv = api.get_single_pv(filters={'lv_uuid': lv.lv_uuid})
         self.unmount_lv(lv)
 
         wipefs(device.abspath)
@@ -182,6 +183,7 @@ class Zap(object):
                 mlogger.info('Only 1 LV left in VG, will proceed to destroy '
                              'volume group %s', device.vg_name)
                 api.remove_vg(device.vg_name)
+                api.remove_pv(pv.pv_name)
             else:
                 mlogger.info('More than 1 LV left in VG, will proceed to '
                              'destroy LV only')