Add Admin Relation

OpenAttic is a manager for Ceph and requires access to the
cephx admin keyring. This relation can be used by any
Ceph management software that needs the admin key.

Change-Id: Ied73e775bdf58f226f9b7ffcc6353ed1be3ec245
This commit is contained in:
Chris Holcombe 2016-08-24 11:42:01 -07:00
parent 1287b0c9c6
commit 4bdb0174fd
5 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1 @@
ceph_hooks.py

1
hooks/admin-relation-joined Symbolic link
View File

@ -0,0 +1 @@
ceph_hooks.py

View File

@ -488,6 +488,8 @@ def notify_radosgws():
def notify_client():
for relid in relation_ids('client'):
client_relation_joined(relid)
for relid in relation_ids('admin'):
admin_relation_joined(relid)
def upgrade_keys():
@ -576,6 +578,22 @@ def radosgw_relation(relid=None, unit=None):
log('mon cluster not in quorum or no osds - deferring key provision')
@hooks.hook('admin-relation-changed')
@hooks.hook('admin-relation-joined')
def admin_relation_joined(relid=None):
if ceph.is_quorum():
log('mon cluster in quorum - providing client with keys')
data = {'key': ceph.get_named_key(name='admin', caps=ceph.admin_caps),
'fsid': leader_get('fsid'),
'auth': config('auth-supported'),
'mon_hosts': " ".join(get_mon_hosts())
}
relation_set(relation_id=relid,
relation_settings=data)
else:
log('mon cluster not in quorum - deferring key provision')
@hooks.hook('client-relation-joined')
def client_relation_joined(relid=None):
if ceph.is_quorum():

View File

@ -931,7 +931,7 @@ _default_caps = {
}
admin_caps = {
'mds': ['allow'],
'mds': ['allow *'],
'mon': ['allow *'],
'osd': ['allow *']
}

View File

@ -19,6 +19,8 @@ provides:
nrpe-external-master:
interface: nrpe-external-master
scope: container
admin:
interface: ceph-admin
client:
interface: ceph-client
osd: