Merge "Add support dashboard relation"
This commit is contained in:
commit
6afeafc0ea
|
@ -324,6 +324,9 @@ def config_changed():
|
|||
status_set('maintenance', 'Bootstrapping single Ceph MGR')
|
||||
ceph.bootstrap_manager()
|
||||
|
||||
for relid in relation_ids('dashboard'):
|
||||
dashboard_relation(relid)
|
||||
|
||||
# Update client relations
|
||||
notify_client()
|
||||
|
||||
|
@ -871,6 +874,10 @@ def osd_relation(relid=None, unit=None):
|
|||
notify_client()
|
||||
notify_rbd_mirrors()
|
||||
send_osd_settings()
|
||||
|
||||
for relid in relation_ids('dashboard'):
|
||||
dashboard_relation(relid)
|
||||
|
||||
else:
|
||||
log('mon cluster not in quorum - deferring fsid provision')
|
||||
|
||||
|
@ -937,6 +944,17 @@ def ready_for_service():
|
|||
return True
|
||||
|
||||
|
||||
@hooks.hook('dashboard-relation-joined')
|
||||
def dashboard_relation(relid=None):
|
||||
"""Inform dashboard that mons are ready"""
|
||||
if not ready_for_service():
|
||||
log("mon cluster is not in quorum, dashboard notification skipped",
|
||||
level=WARNING)
|
||||
return
|
||||
|
||||
relation_set(relation_id=relid, relation_settings={'mon-ready': True})
|
||||
|
||||
|
||||
@hooks.hook('radosgw-relation-changed')
|
||||
@hooks.hook('radosgw-relation-joined')
|
||||
def radosgw_relation(relid=None, unit=None):
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ceph_hooks.py
|
|
@ -40,6 +40,8 @@ provides:
|
|||
interface: ceph-rbd-mirror
|
||||
prometheus:
|
||||
interface: http
|
||||
dashboard:
|
||||
interface: ceph-dashboard
|
||||
requires:
|
||||
bootstrap-source:
|
||||
interface: ceph-bootstrap
|
||||
|
|
|
@ -353,6 +353,24 @@ class CephHooksTestCase(test_utils.CharmTestCase):
|
|||
relation_settings={
|
||||
'nonce': 'FAKE-UUID'})
|
||||
|
||||
@patch.object(ceph_hooks, 'relation_set')
|
||||
@patch.object(ceph_hooks, 'ready_for_service')
|
||||
def test_dashboard_relation(self, ready_for_service, relation_set):
|
||||
ready_for_service.return_value = True
|
||||
ceph_hooks.dashboard_relation()
|
||||
relation_set.assert_called_once_with(
|
||||
relation_id=None,
|
||||
relation_settings={'mon-ready': True})
|
||||
relation_set.reset_mock()
|
||||
ceph_hooks.dashboard_relation('rid1')
|
||||
relation_set.assert_called_once_with(
|
||||
relation_id='rid1',
|
||||
relation_settings={'mon-ready': True})
|
||||
ready_for_service.return_value = False
|
||||
relation_set.reset_mock()
|
||||
ceph_hooks.dashboard_relation()
|
||||
self.assertFalse(relation_set.called)
|
||||
|
||||
@patch.object(ceph_hooks.hookenv, 'remote_service_name')
|
||||
@patch.object(ceph_hooks, 'relation_get')
|
||||
@patch.object(ceph_hooks, 'remote_unit')
|
||||
|
|
Loading…
Reference in New Issue