]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: bluestore deactivate / destroy
authorLoic Dachary <ldachary@redhat.com>
Thu, 28 Jan 2016 04:59:10 +0000 (11:59 +0700)
committerLoic Dachary <ldachary@redhat.com>
Thu, 4 Feb 2016 10:01:46 +0000 (17:01 +0700)
It is straightforward because it entirely relies on information
collected by ceph-disk list which has full support for bluestore.
It loops on all possible auxiliary devices (as found in Spaces.NAMES)
and does the associated deactivate / destruction which is merely about
handling dmcrypt map / unmap.

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

index 5a5e6b8dcb2dec44ca52fedd2541dc9e03d0db1b..e9556567074ac50695ae5835e052abf7de405a45 100755 (executable)
@@ -3191,8 +3191,9 @@ def main_deactivate_locked(args):
 
     if dmcrypt:
         dmcrypt_unmap(target_dev['uuid'])
-        if 'journal_uuid' in target_dev:
-            dmcrypt_unmap(target_dev['journal_uuid'])
+        for name in Space.NAMES:
+            if name + '_uuid' in target_dev:
+                dmcrypt_unmap(target_dev[name + '_uuid'])
 
 ###########################
 
@@ -3264,7 +3265,6 @@ def main_destroy(args):
 
     osd_id = target_dev['whoami']
     dev_path = target_dev['path']
-    journal_part_uuid = target_dev['journal_uuid']
     if target_dev['ptype'] == PTYPE['mpath']['osd']['ready']:
         base_dev = get_partition_base_mpath(dev_path)
     else:
@@ -3288,8 +3288,9 @@ def main_destroy(args):
 
     # we remove the crypt map and device mapper (if dmcrypt is True)
     if dmcrypt:
-        if journal_part_uuid:
-            dmcrypt_unmap(journal_part_uuid)
+        for name in Space.NAMES:
+            if target_dev.get(name + '_uuid'):
+                dmcrypt_unmap(target_dev[name + '_uuid'])
 
     # Check zap flag. If we found zap flag, we need to find device for
     # destroy this osd data.
@@ -4301,7 +4302,8 @@ def make_activate_space_parser(name, subparsers):
     activate_space_parser.add_argument(
         '--dmcrypt',
         action='store_true', default=None,
-        help='map data and/or auxiliariy (journal, etc.) devices with dm-crypt',
+        help=('map data and/or auxiliariy (journal, etc.) '
+              'devices with dm-crypt'),
     )
     activate_space_parser.add_argument(
         '--dmcrypt-key-dir',