ceph-disk: dmcrypt cluster must default to ceph

If ceph_fsid is not found, which is the case for legacy dmcrypted OSD,
the cluster must default to ceph, as it was before support for non
standard cluster names was introduced.

Fixes: http://tracker.ceph.com/issues/20893

Signed-off-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
Loic Dachary 2017-08-03 10:56:24 +02:00
parent 740daa3ca1
commit ed22159fdd

View File

@ -1279,11 +1279,14 @@ def get_dmcrypt_key(
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)
LOG.warning("no `ceph_fsid` found falling back to 'ceph' "
"for cluster name")
cluster = 'ceph'
else:
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(