Skip to content

Commit

Permalink
Merge pull request #14765: jewel: ceph-disk does not support cluster …
Browse files Browse the repository at this point in the history
…names different than 'ceph'

Reviewed-by: Nathan Cutler <ncutler@suse.com>
  • Loading branch information
smithfarm committed Apr 27, 2017
2 parents 6ab366d + 43327f8 commit 7b28f1f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/ceph-disk/ceph_disk/main.py
Expand Up @@ -1150,10 +1150,19 @@ def get_dmcrypt_key(
if os.path.exists(path):
mode = get_oneliner(path, 'key-management-mode')
osd_uuid = get_oneliner(path, 'osd-uuid')
ceph_fsid = read_one_line(path, 'ceph_fsid')
if ceph_fsid is None:
raise Error('No cluster uuid assigned.')
cluster = find_cluster_by_uuid(ceph_fsid)
if cluster is None:
raise Error('No cluster conf found in ' + SYSCONFDIR +
' with fsid %s' % ceph_fsid)

if mode == KEY_MANAGEMENT_MODE_V1:
key, stderr, ret = command(
[
'ceph',
'--cluster', cluster,
'--name',
'client.osd-lockbox.' + osd_uuid,
'--keyring',
Expand Down Expand Up @@ -2336,6 +2345,7 @@ def create_key(self):
command_check_call(
[
'ceph',
'--cluster', cluster,
'--name', 'client.bootstrap-osd',
'--keyring', bootstrap,
'config-key',
Expand All @@ -2347,6 +2357,7 @@ def create_key(self):
keyring, stderr, ret = command(
[
'ceph',
'--cluster', cluster,
'--name', 'client.bootstrap-osd',
'--keyring', bootstrap,
'auth',
Expand Down Expand Up @@ -2384,6 +2395,9 @@ def populate(self):
LOG.debug('Mounting lockbox ' + str(" ".join(args)))
command_check_call(args)
write_one_line(path, 'osd-uuid', self.args.osd_uuid)
if self.args.cluster_uuid is None:
self.args.cluster_uuid = get_fsid(cluster=self.args.cluster)
write_one_line(path, 'ceph_fsid', self.args.cluster_uuid)
self.create_key()
self.symlink_spaces(path)
write_one_line(path, 'magic', CEPH_LOCKBOX_ONDISK_MAGIC)
Expand Down Expand Up @@ -3619,15 +3633,17 @@ def _deallocate_osd_id(cluster, osd_id):
])


def _remove_lockbox(uuid):
def _remove_lockbox(uuid, cluster):
command([
'ceph',
'--cluster', cluster,
'auth',
'del',
'client.osd-lockbox.' + uuid,
])
command([
'ceph',
'--cluster', cluster,
'config-key',
'del',
'dm-crypt/osd/' + uuid + '/luks',
Expand Down Expand Up @@ -3725,7 +3741,7 @@ def main_destroy_locked(args):
for name in Space.NAMES:
if target_dev.get(name + '_uuid'):
dmcrypt_unmap(target_dev[name + '_uuid'])
_remove_lockbox(target_dev['uuid'])
_remove_lockbox(target_dev['uuid'], args.cluster)

# Check zap flag. If we found zap flag, we need to find device for
# destroy this osd data.
Expand Down

0 comments on commit 7b28f1f

Please sign in to comment.