Support multiple ceph-fs (mds) units

Prefix the mds cephx relation key with the hostname of the
local unit, ensuring that distinct cephx keys are provided
for each ceph-fs unit participating in the relation.

Change-Id: I306a312616efc8447d85ea07fb85d8dc47401714
This commit is contained in:
James Page 2019-02-25 14:47:25 +00:00
parent 34a4dcc0ec
commit 3347a74bc3
1 changed files with 5 additions and 1 deletions

View File

@ -18,7 +18,7 @@ from charmhelpers.contrib.storage.linux.ceph import (
class CephClient(RelationBase):
scope = scopes.GLOBAL
auto_accessors = ['mds_key', 'fsid', 'auth']
auto_accessors = ['fsid', 'auth']
ceph_pool_app_name = 'cephfs'
@hook('{requires:ceph-mds}-relation-{joined}')
@ -120,3 +120,7 @@ class CephClient(RelationBase):
hosts.append('{}:6789'.format(format_ipv6_addr(addr) or addr))
hosts.sort()
return hosts
def mds_key(self):
"""Retrieve the cephx key for the local mds unit"""
return self.get_remote('{}_mds_key'.format(socket.gethostname()))