Always run mon relation after handling broker request

This must be done to make sure the individual unit relation data
is in sync.

Change-Id: Ibf51766c868c179fa1b3245b394e32d0f2e7c1ab
This commit is contained in:
Frode Nordahl 2019-03-07 10:00:59 +01:00
parent ab068db29d
commit 17de051792
2 changed files with 11 additions and 8 deletions

View File

@ -547,19 +547,22 @@ def handle_broker_request(relid, unit, add_legacy_response=False,
if add_legacy_response:
response.update({'broker_rsp': rsp})
if relation_ids('rbd-mirror') and recurse:
# update ``rbd-mirror`` relations for this unit with
# information about new pools.
log('Notifying this units rbd-mirror relations after '
'processing broker request.', level=DEBUG)
notify_rbd_mirrors()
if relation_ids('rbd-mirror'):
# NOTE(fnordahl): juju relation level data candidate
# notify mons to flag that the other mon units should update
# their ``rbd-mirror`` relations with information about new
# pools.
log('Notifying peers after processing broker request.',
level=DEBUG)
notify_mons()
if recurse:
# update ``rbd-mirror`` relations for this unit with
# information about new pools.
log('Notifying this units rbd-mirror relations after '
'processing broker request.', level=DEBUG)
notify_rbd_mirrors()
return response

View File

@ -459,7 +459,7 @@ class RelatedUnitsTestCase(unittest.TestCase):
mock_notify_mons.reset_mock()
ceph_hooks.handle_broker_request('rel1', None, recurse=False)
self.assertFalse(mock_notify_rbd_mirrors.called)
self.assertFalse(mock_notify_mons.called)
mock_notify_mons.assert_called_once_with()
class BootstrapSourceTestCase(test_utils.CharmTestCase):