]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: unmount lvs correctly before zapping 23128/head
authorAndrew Schoen <aschoen@redhat.com>
Wed, 18 Jul 2018 16:08:15 +0000 (11:08 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 19 Jul 2018 14:03:41 +0000 (09:03 -0500)
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 <aschoen@redhat.com>
(cherry picked from commit 5b175a5bb68264b80c00cb4f04026a4d19ca20ad)

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

index ee5cdf97b6a590726df2f3c16346f44c8355c14a..904759dd5be8b528cecd566e52d2c61429b62aa9 100644 (file)
@@ -70,12 +70,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