Process client broker requests post bootstrap

Its possible that a remote client unit will present its broker
request prior to the Ceph MON cluster being bootstrapped; ensure
that any client-relation-changed hooks are re-executed after
bootstrap to process any pending broker requests.

Change-Id: Id412a6b3503e00bd870ccb8f3acc5f3957c23f5d
Closes-Bug: 1734620
This commit is contained in:
James Page 2017-11-27 11:24:09 +00:00
parent 3d6fddbc76
commit 9d095b31d9
1 changed files with 8 additions and 3 deletions

View File

@ -430,6 +430,8 @@ def notify_radosgws():
def notify_client():
for relid in relation_ids('client'):
client_relation_joined(relid)
for unit in related_units(relid):
client_relation_changed(relid, unit)
@hooks.hook('osd-relation-changed')
@ -526,10 +528,12 @@ def client_relation_joined(relid=None):
@hooks.hook('client-relation-changed')
def client_relation_changed():
def client_relation_changed(relid=None, unit=None):
"""Process broker requests from ceph client relations."""
if ceph.is_quorum():
settings = relation_get()
if not unit:
unit = remote_unit()
settings = relation_get(rid=relid, unit=unit)
if 'broker_req' in settings:
if not ceph.is_leader():
log("Not leader - ignoring broker request", level=DEBUG)
@ -543,7 +547,8 @@ def client_relation_changed():
'broker_rsp': rsp,
unit_response_key: rsp,
}
relation_set(relation_settings=data)
relation_set(relation_id=relid,
relation_settings=data)
else:
log('mon cluster not in quorum', level=DEBUG)