set private/public addr like in ceph charm
This commit is contained in:
parent
6b51149b05
commit
d3373781da
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue