Add support for CMR
Although not a typical deployment scenario the ceph-mon charm will support cross model relations. To use this feature the local unit name must be exposed on the relation so that the ceph-mon charm can target broker responses back to individual units. Juju obfuscates this to a remote-UUID label so the normal use of the hookenv set remote unit does not work correctly. Change-Id: I67142f782008f891f7dccba3a37e9616c3060af9
This commit is contained in:
parent
dfafc21506
commit
bbdfeb4828
@ -56,8 +56,12 @@ class CephClientRequires(Object):
|
|||||||
self.previous_requests = self.get_previous_requests_from_relations()
|
self.previous_requests = self.get_previous_requests_from_relations()
|
||||||
|
|
||||||
def on_joined(self, event):
|
def on_joined(self, event):
|
||||||
relation = self.model.relations[self.relation_name]
|
relations = self.model.relations[self.relation_name]
|
||||||
if relation:
|
if relations:
|
||||||
|
# Setup unit-name for CMR on the relation
|
||||||
|
for relation in relations:
|
||||||
|
relation.data[self.this_unit]["unit-name"] = \
|
||||||
|
self.this_unit.name
|
||||||
logging.info("emiting broker_available")
|
logging.info("emiting broker_available")
|
||||||
self._stored.broker_available = True
|
self._stored.broker_available = True
|
||||||
self.on.broker_available.emit()
|
self.on.broker_available.emit()
|
||||||
|
@ -83,6 +83,7 @@ class TestCephClientRequires(unittest.TestCase):
|
|||||||
'client/0': {
|
'client/0': {
|
||||||
'remote_unit_data': {
|
'remote_unit_data': {
|
||||||
'ingress-address': '192.0.2.4',
|
'ingress-address': '192.0.2.4',
|
||||||
|
'unit-name': 'client/0',
|
||||||
'broker_req': (
|
'broker_req': (
|
||||||
'{"api-version": 1, '
|
'{"api-version": 1, '
|
||||||
'"ops": [{"op": "create-pool", "name": "tmbtil", '
|
'"ops": [{"op": "create-pool", "name": "tmbtil", '
|
||||||
|
Loading…
Reference in New Issue
Block a user