diff --git a/config.yaml b/config.yaml index fdcab2bd..1df4b05f 100644 --- a/config.yaml +++ b/config.yaml @@ -114,6 +114,18 @@ options: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them. + prefer-ipv6: + type: boolean + default: False + description: | + If True enables IPv6 support. The charm will expect network interfaces + to be configured with an IPv6 address. If set to False (default) IPv4 + is expected. + . + NOTE: these charms do not currently support IPv6 privacy extension. In + order for this charm to function correctly, the privacy extension must be + disabled and a non-temporary address must be configured/available on + your network interface. # Network configuration options # by default all access is over 'private-address' os-data-network: diff --git a/hooks/quantum_hooks.py b/hooks/quantum_hooks.py index e8b74861..89dee94e 100755 --- a/hooks/quantum_hooks.py +++ b/hooks/quantum_hooks.py @@ -32,6 +32,7 @@ from charmhelpers.contrib.hahelpers.apache import( from charmhelpers.contrib.openstack.utils import ( configure_installation_source, openstack_upgrade_available, + sync_db_with_multi_ipv6_addresses, ) from charmhelpers.payload.execd import execd_preinstall from charmhelpers.core.sysctl import create as create_sysctl @@ -138,10 +139,15 @@ def db_joined(relation_id=None): 'associated a postgresql one') log(e, level=ERROR) raise Exception(e) - relation_set(username=config('database-user'), - database=config('database'), - hostname=unit_get('private-address'), - relation_id=relation_id) + + if config('prefer-ipv6'): + sync_db_with_multi_ipv6_addresses(config('database'), + config('database-user')) + else: + relation_set(username=config('database-user'), + database=config('database'), + hostname=unit_get('private-address'), + relation_id=relation_id) @hooks.hook('pgsql-db-relation-joined')