From: Loic Dachary Date: Thu, 28 Jan 2016 04:59:10 +0000 (+0700) Subject: ceph-disk: bluestore deactivate / destroy X-Git-Tag: v10.0.4~46^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b9a8042da200594720cceeaacaff9108a17e448;p=ceph.git ceph-disk: bluestore deactivate / destroy 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 --- diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index 5a5e6b8dcb2d..e9556567074a 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -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',