Add cluster-relation-joined hook to ensure that internal address network is used if connected

This commit is contained in:
James Page 2014-09-26 12:29:28 +01:00
parent 07c8fe3724
commit d6d14d9be1
2 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1 @@
nova_cc_hooks.py

View File

@ -100,7 +100,8 @@ from charmhelpers.contrib.openstack.ip import (
from charmhelpers.contrib.network.ip import (
get_iface_for_address,
get_netmask_for_address
get_netmask_for_address,
get_address_in_network,
)
hooks = Hooks()
@ -144,6 +145,7 @@ def config_changed():
for rid in relation_ids('cloud-compute')]
for r_id in relation_ids('identity-service'):
identity_joined(rid=r_id)
[cluster_joined(rid) for rid in relation_ids('cluster')]
@hooks.hook('amqp-relation-joined')
@ -529,6 +531,14 @@ def quantum_joined(rid=None):
relation_set(relation_id=rid, **rel_settings)
@hooks.hook('cluster-relation-joined')
def cluster_joined(relation_id=None):
address = get_address_in_network(config('os-internal-network'),
unit_get('private-address'))
relation_set(relation_id=relation_id,
relation_settings={'private-address': address})
@hooks.hook('cluster-relation-changed',
'cluster-relation-departed')
@service_guard(guard_map(), CONFIGS,