From d3373781da515346f0661f31499bc17a65ad6600 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Mon, 29 Sep 2014 12:00:26 +0100 Subject: [PATCH] set private/public addr like in ceph charm --- hooks/hooks.py | 10 +++++++++- templates/ceph.conf | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hooks/hooks.py b/hooks/hooks.py index 24731833..d0e2bbef 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -46,7 +46,8 @@ from utils import ( from charmhelpers.contrib.openstack.alternatives import install_alternative from charmhelpers.contrib.network.ip import ( - is_ipv6 + is_ipv6, + get_ipv6_addr ) hooks = Hooks() @@ -86,6 +87,13 @@ def emit_cephconf(): 'ceph_cluster_network': config('ceph-cluster-network'), } + if config('prefer-ipv6'): + dynamic_ipv6_address = get_ipv6_addr()[0] + if not config('ceph-public-network'): + cephcontext['public_addr'] = dynamic_ipv6_address + if not config('ceph-cluster-network'): + cephcontext['cluster_addr'] = dynamic_ipv6_address + # Install ceph.conf as an alternative to support # co-existence with other charms that write this file charm_ceph_conf = "/var/lib/charm/{}/ceph.conf".format(service_name()) diff --git a/templates/ceph.conf b/templates/ceph.conf index def993c3..6177b050 100644 --- a/templates/ceph.conf +++ b/templates/ceph.conf @@ -21,6 +21,14 @@ cluster network = {{ ceph_cluster_network }} {%- endif %} +{% if public_addr %} +public addr = {{ public_addr }} +{% endif %} +{% if cluster_addr %} +cluster addr = {{ cluster_addr }} +{%- endif %} + + [mon] keyring = /var/lib/ceph/mon/$cluster-$id/keyring