]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: destroy does not unmap block/journal
authorLoic Dachary <ldachary@redhat.com>
Tue, 23 Feb 2016 11:03:26 +0000 (18:03 +0700)
committerLoic Dachary <ldachary@redhat.com>
Fri, 4 Mar 2016 02:13:35 +0000 (09:13 +0700)
The dmcrypt boolean needs to be set for destroy to ensure the
journal/block partitions are 'cryptsetup remove'.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/ceph-disk/ceph_disk/main.py

index 6298fa3bb11431799c5f3184c8ade23751a3be9e..1159a246cb22980af47be788ed3b683445b25662 100755 (executable)
@@ -3273,15 +3273,17 @@ def destroy_lookup_device(args, predicate, description):
                                            args.dmcrypt_key_dir)
                 list_dev_osd(dmcrypt_path, {}, partition)
                 dmcrypt_unmap(partition['uuid'])
+                dmcrypt = True
+            else:
+                dmcrypt = False
             if predicate(partition):
-                return partition
+                return (dmcrypt, partition)
     raise Error('found no device matching ', description)
 
 
 def main_destroy(args):
     osd_id = args.destroy_by_id
     path = args.path
-    dmcrypt = False
     target_dev = None
 
     if path:
@@ -3290,11 +3292,11 @@ def main_destroy(args):
         path = os.path.realpath(path)
 
     if path:
-        target_dev = destroy_lookup_device(
+        (dmcrypt, target_dev) = destroy_lookup_device(
             args, lambda x: x.get('path') == path,
             path)
     elif osd_id:
-        target_dev = destroy_lookup_device(
+        (dmcrypt, target_dev) = destroy_lookup_device(
             args, lambda x: x.get('whoami') == osd_id,
             'osd id ' + str(osd_id))