Use centralized zeromq template
This commit is contained in:
parent
ece063b0c6
commit
25dc343f42
@ -1,4 +1,4 @@
|
||||
branch: lp:charm-helpers
|
||||
branch: lp:~openstack-charmers/charm-helpers/0mq
|
||||
destination: hooks/charmhelpers
|
||||
include:
|
||||
- core
|
||||
|
@ -468,21 +468,25 @@ class HAProxyContext(OSContextGenerator):
|
||||
_unit = unit.replace('/', '-')
|
||||
cluster_hosts[laddr]['backends'][_unit] = _laddr
|
||||
|
||||
# NOTE(jamespage) no split configurations found, just use
|
||||
# private addresses
|
||||
if not cluster_hosts:
|
||||
netmask = get_netmask_for_address(addr)
|
||||
cluster_hosts[addr] = {'network': "{}/{}".format(addr, netmask),
|
||||
'backends': {l_unit: addr}}
|
||||
for rid in relation_ids('cluster'):
|
||||
for unit in related_units(rid):
|
||||
_laddr = relation_get('private-address',
|
||||
rid=rid, unit=unit)
|
||||
if _laddr:
|
||||
_unit = unit.replace('/', '-')
|
||||
cluster_hosts[addr]['backends'][_unit] = _laddr
|
||||
# NOTE(jamespage) add backend based on private address - this
|
||||
# with either be the only backend or the fallback if no acls
|
||||
# match in the frontend
|
||||
cluster_hosts[addr] = {}
|
||||
netmask = get_netmask_for_address(addr)
|
||||
cluster_hosts[addr] = {'network': "{}/{}".format(addr, netmask),
|
||||
'backends': {l_unit: addr}}
|
||||
for rid in relation_ids('cluster'):
|
||||
for unit in related_units(rid):
|
||||
_laddr = relation_get('private-address',
|
||||
rid=rid, unit=unit)
|
||||
if _laddr:
|
||||
_unit = unit.replace('/', '-')
|
||||
cluster_hosts[addr]['backends'][_unit] = _laddr
|
||||
|
||||
ctxt = {'frontends': cluster_hosts}
|
||||
ctxt = {
|
||||
'frontends': cluster_hosts,
|
||||
'default_backend': addr
|
||||
}
|
||||
|
||||
if config('haproxy-server-timeout'):
|
||||
ctxt['haproxy_server_timeout'] = config('haproxy-server-timeout')
|
||||
@ -1001,6 +1005,8 @@ class ZeroMQContext(OSContextGenerator):
|
||||
for unit in related_units(rid):
|
||||
ctxt['zmq_nonce'] = relation_get('nonce', unit, rid)
|
||||
ctxt['zmq_host'] = relation_get('host', unit, rid)
|
||||
ctxt['zmq_redis_address'] = relation_get(
|
||||
'zmq_redis_address', unit, rid)
|
||||
|
||||
return ctxt
|
||||
|
||||
|
@ -44,7 +44,9 @@ frontend tcp-in_{{ service }}
|
||||
{% for frontend in frontends -%}
|
||||
acl net_{{ frontend }} dst {{ frontends[frontend]['network'] }}
|
||||
use_backend {{ service }}_{{ frontend }} if net_{{ frontend }}
|
||||
{% endfor %}
|
||||
{% endfor -%}
|
||||
default_backend {{ service }}_{{ default_backend }}
|
||||
|
||||
{% for frontend in frontends -%}
|
||||
backend {{ service }}_{{ frontend }}
|
||||
balance leastconn
|
||||
|
@ -1,6 +1,12 @@
|
||||
{% if zmq_host -%}
|
||||
# ZeroMQ configuration (restart-nonce: {{ zmq_nonce }})
|
||||
rpc_backend = zmq
|
||||
rpc_zmq_matchmaker = oslo.messaging._drivers.matchmaker_ring.MatchMakerRing
|
||||
rpc_zmq_host = {{ zmq_host }}
|
||||
{% if zmq_redis_address -%}
|
||||
rpc_zmq_matchmaker = oslo.messaging._drivers.matchmaker_redis.MatchMakerRedis
|
||||
[matchmaker_redis]
|
||||
host = {{ zmq_redis_address }}
|
||||
{% else -%}
|
||||
rpc_zmq_matchmaker = oslo.messaging._drivers.matchmaker_ring.MatchMakerRing
|
||||
{% endif -%}
|
||||
{% endif -%}
|
@ -157,6 +157,17 @@ def create_keyring(service, key):
|
||||
log('Created new ceph keyring at %s.' % keyring, level=DEBUG)
|
||||
|
||||
|
||||
def delete_keyring(service):
|
||||
"""Delete an existing Ceph keyring."""
|
||||
keyring = _keyring_path(service)
|
||||
if not os.path.exists(keyring):
|
||||
log('Keyring does not exist at %s' % keyring, level=WARNING)
|
||||
return
|
||||
|
||||
os.remove(keyring)
|
||||
log('Deleted ring at %s.' % keyring, level=INFO)
|
||||
|
||||
|
||||
def create_key_file(service, key):
|
||||
"""Create a file containing key."""
|
||||
keyfile = _keyfile_path(service)
|
||||
|
@ -50,8 +50,6 @@ keystone_ec2_url = {{ keystone_ec2_url }}
|
||||
|
||||
{% include "parts/rabbitmq" %}
|
||||
|
||||
{% include "parts/zeromq" %}
|
||||
|
||||
{% if glance_api_servers -%}
|
||||
glance_api_servers = {{ glance_api_servers }}
|
||||
{% endif -%}
|
||||
@ -156,3 +154,5 @@ enabled=True
|
||||
|
||||
[conductor]
|
||||
workers = {{ workers }}
|
||||
|
||||
{% include "zeromq" %}
|
||||
|
Loading…
Reference in New Issue
Block a user