diff --git a/config.yaml b/config.yaml index 873ed7ea..f4f157ea 100644 --- a/config.yaml +++ b/config.yaml @@ -158,7 +158,7 @@ options: with the other members of the HA Cluster. ha-mcastport: type: int - default: 5403 + default: 5434 description: | Default multicast port number that will be used to communicate between HA Cluster nodes. diff --git a/hooks/keystone_hooks.py b/hooks/keystone_hooks.py index b39810a3..39f641c0 100755 --- a/hooks/keystone_hooks.py +++ b/hooks/keystone_hooks.py @@ -155,6 +155,8 @@ def config_changed(): if settings: for rid in relation_ids('cluster'): relation_set(relation_id=rid, relation_settings=settings) + for r_id in relation_ids('ha'): + ha_joined(relation_id=r_id) @hooks.hook('shared-db-relation-joined') @@ -391,7 +393,7 @@ def cluster_changed(): @hooks.hook('ha-relation-joined') -def ha_joined(): +def ha_joined(relation_id=None): cluster_config = get_hacluster_config() resources = { 'res_ks_haproxy': 'lsb:haproxy', @@ -427,7 +429,8 @@ def ha_joined(): vip_group.append(vip_key) if len(vip_group) >= 1: - relation_set(groups={CLUSTER_RES: ' '.join(vip_group)}) + relation_set(relation_id=relation_id, + groups={CLUSTER_RES: ' '.join(vip_group)}) init_services = { 'res_ks_haproxy': 'haproxy' @@ -435,7 +438,8 @@ def ha_joined(): clones = { 'cl_ks_haproxy': 'res_ks_haproxy' } - relation_set(init_services=init_services, + relation_set(relation_id=relation_id, + init_services=init_services, corosync_bindiface=cluster_config['ha-bindiface'], corosync_mcastport=cluster_config['ha-mcastport'], resources=resources, diff --git a/unit_tests/test_keystone_hooks.py b/unit_tests/test_keystone_hooks.py index 33fb3fe9..eae1f03e 100644 --- a/unit_tests/test_keystone_hooks.py +++ b/unit_tests/test_keystone_hooks.py @@ -461,6 +461,7 @@ class KeystoneRelationTests(CharmTestCase): self.get_netmask_for_address.return_value = '255.255.255.0' hooks.ha_joined() args = { + 'relation_id': None, 'corosync_bindiface': 'em0', 'corosync_mcastport': '8080', 'init_services': {'res_ks_haproxy': 'haproxy'}, @@ -486,6 +487,7 @@ class KeystoneRelationTests(CharmTestCase): self.get_netmask_for_address.return_value = None hooks.ha_joined() args = { + 'relation_id': None, 'corosync_bindiface': 'em0', 'corosync_mcastport': '8080', 'init_services': {'res_ks_haproxy': 'haproxy'}, @@ -510,6 +512,7 @@ class KeystoneRelationTests(CharmTestCase): self.get_netmask_for_address.return_value = '64' hooks.ha_joined() args = { + 'relation_id': None, 'corosync_bindiface': 'em0', 'corosync_mcastport': '8080', 'init_services': {'res_ks_haproxy': 'haproxy'},