Network space aware address for cluster relation
Use the get_relation_ip function for selecting addresses for the cluster relationship. Including overrides for the admin, internal, and public config settings or extra bindings. Change-Id: Ief31b5bf605e6fad0b5fc57cd048e3d8badfa2db Partial-Bug: #1687439
This commit is contained in:
parent
15dbc5fc3d
commit
8f26788080
|
@ -118,8 +118,6 @@ from charmhelpers.contrib.openstack.neutron import (
|
||||||
from charmhelpers.contrib.network.ip import (
|
from charmhelpers.contrib.network.ip import (
|
||||||
get_iface_for_address,
|
get_iface_for_address,
|
||||||
get_netmask_for_address,
|
get_netmask_for_address,
|
||||||
get_address_in_network,
|
|
||||||
get_ipv6_addr,
|
|
||||||
is_ipv6,
|
is_ipv6,
|
||||||
get_relation_ip,
|
get_relation_ip,
|
||||||
)
|
)
|
||||||
|
@ -514,19 +512,18 @@ def neutron_plugin_api_relation_joined(rid=None):
|
||||||
|
|
||||||
@hooks.hook('cluster-relation-joined')
|
@hooks.hook('cluster-relation-joined')
|
||||||
def cluster_joined(relation_id=None):
|
def cluster_joined(relation_id=None):
|
||||||
|
settings = {}
|
||||||
|
|
||||||
for addr_type in ADDRESS_TYPES:
|
for addr_type in ADDRESS_TYPES:
|
||||||
address = get_address_in_network(
|
address = get_relation_ip(
|
||||||
config('os-{}-network'.format(addr_type))
|
addr_type,
|
||||||
)
|
cidr_network=config('os-{}-network'.format(addr_type)))
|
||||||
if address:
|
if address:
|
||||||
relation_set(
|
settings['{}-address'.format(addr_type)] = address
|
||||||
relation_id=relation_id,
|
|
||||||
relation_settings={'{}-address'.format(addr_type): address}
|
settings['private-address'] = get_relation_ip('cluster')
|
||||||
)
|
|
||||||
if config('prefer-ipv6'):
|
relation_set(relation_id=relation_id, relation_settings=settings)
|
||||||
private_addr = get_ipv6_addr(exc_list=[config('vip')])[0]
|
|
||||||
relation_set(relation_id=relation_id,
|
|
||||||
relation_settings={'private-address': private_addr})
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('cluster-relation-changed',
|
@hooks.hook('cluster-relation-changed',
|
||||||
|
|
|
@ -82,7 +82,6 @@ TO_PATCH = [
|
||||||
'unit_get',
|
'unit_get',
|
||||||
'get_iface_for_address',
|
'get_iface_for_address',
|
||||||
'get_netmask_for_address',
|
'get_netmask_for_address',
|
||||||
'get_address_in_network',
|
|
||||||
'update_nrpe_config',
|
'update_nrpe_config',
|
||||||
'service_reload',
|
'service_reload',
|
||||||
'neutron_plugin_attribute',
|
'neutron_plugin_attribute',
|
||||||
|
|
Loading…
Reference in New Issue