From: Andrew Schoen Date: Wed, 18 Jul 2018 16:08:15 +0000 (-0500) Subject: ceph-volume: unmount lvs correctly before zapping X-Git-Tag: v14.0.1~842^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5b175a5bb68264b80c00cb4f04026a4d19ca20ad;p=ceph.git ceph-volume: unmount lvs correctly before zapping If the lv found does not include the meatadata to construct an osd path, then we should try to unmount it's path instead. Fixes: http://tracker.ceph.com/issues/24796 Signed-off-by: Andrew Schoen --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/zap.py b/src/ceph-volume/ceph_volume/devices/lvm/zap.py index b3d80a590bb9d..65af440bf2f9b 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/zap.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/zap.py @@ -73,12 +73,15 @@ class Zap(object): dmcrypt = False dmcrypt_uuid = None if lv: - osd_path = "/var/lib/ceph/osd/{}-{}".format(lv.tags['ceph.cluster_name'], lv.tags['ceph.osd_id']) + if lv.tags.get('ceph.cluster_name') and lv.tags.get('ceph.osd_id'): + lv_path = "/var/lib/ceph/osd/{}-{}".format(lv.tags['ceph.cluster_name'], lv.tags['ceph.osd_id']) + else: + lv_path = lv.path dmcrypt_uuid = lv.lv_uuid dmcrypt = lv.encrypted - if system.path_is_mounted(osd_path): - mlogger.info("Unmounting %s", osd_path) - system.unmount(osd_path) + if system.path_is_mounted(lv_path): + mlogger.info("Unmounting %s", lv_path) + system.unmount(lv_path) else: # we're most likely dealing with a partition here, check to # see if it was encrypted