Merge "Sync charm-helpers and use "rabbit_use_ssl" for ocata"
This commit is contained in:
commit
613123326a
@ -43,6 +43,46 @@ iface {linuxbridge_port} inet manual
|
||||
MAX_KERNEL_INTERFACE_NAME_LEN = 15
|
||||
|
||||
|
||||
def get_bridges():
|
||||
"""Return list of the bridges on the default openvswitch
|
||||
|
||||
:returns: List of bridge names
|
||||
:rtype: List[str]
|
||||
:raises: subprocess.CalledProcessError if ovs-vsctl fails
|
||||
"""
|
||||
cmd = ["ovs-vsctl", "list-br"]
|
||||
lines = subprocess.check_output(cmd).decode('utf-8').split("\n")
|
||||
maybe_bridges = [l.strip() for l in lines]
|
||||
return [b for b in maybe_bridges if b]
|
||||
|
||||
|
||||
def get_bridge_ports(name):
|
||||
"""Return a list the ports on a named bridge
|
||||
|
||||
:param name: the name of the bridge to list
|
||||
:type name: str
|
||||
:returns: List of ports on the named bridge
|
||||
:rtype: List[str]
|
||||
:raises: subprocess.CalledProcessError if the ovs-vsctl command fails. If
|
||||
the named bridge doesn't exist, then the exception will be raised.
|
||||
"""
|
||||
cmd = ["ovs-vsctl", "--", "list-ports", name]
|
||||
lines = subprocess.check_output(cmd).decode('utf-8').split("\n")
|
||||
maybe_ports = [l.strip() for l in lines]
|
||||
return [p for p in maybe_ports if p]
|
||||
|
||||
|
||||
def get_bridges_and_ports_map():
|
||||
"""Return dictionary of bridge to ports for the default openvswitch
|
||||
|
||||
:returns: a mapping of bridge name to a list of ports.
|
||||
:rtype: Dict[str, List[str]]
|
||||
:raises: subprocess.CalledProcessError if any of the underlying ovs-vsctl
|
||||
command fail.
|
||||
"""
|
||||
return {b: get_bridge_ports(b) for b in get_bridges()}
|
||||
|
||||
|
||||
def add_bridge(name, datapath_type=None):
|
||||
''' Add the named bridge to openvswitch '''
|
||||
log('Creating bridge {}'.format(name))
|
||||
|
@ -127,7 +127,9 @@ def expect_ha():
|
||||
return len(ha_related_units) > 0 or config('vip') or config('dns-ha')
|
||||
|
||||
|
||||
def generate_ha_relation_data(service, extra_settings=None):
|
||||
def generate_ha_relation_data(service,
|
||||
extra_settings=None,
|
||||
haproxy_enabled=True):
|
||||
""" Generate relation data for ha relation
|
||||
|
||||
Based on configuration options and unit interfaces, generate a json
|
||||
@ -152,21 +154,18 @@ def generate_ha_relation_data(service, extra_settings=None):
|
||||
@param extra_settings: Dict of additional resource data
|
||||
@returns dict: json encoded data for use with relation_set
|
||||
"""
|
||||
_haproxy_res = 'res_{}_haproxy'.format(service)
|
||||
_relation_data = {
|
||||
'resources': {
|
||||
_haproxy_res: 'lsb:haproxy',
|
||||
},
|
||||
'resource_params': {
|
||||
_relation_data = {'resources': {}, 'resource_params': {}}
|
||||
|
||||
if haproxy_enabled:
|
||||
_haproxy_res = 'res_{}_haproxy'.format(service)
|
||||
_relation_data['resources'] = {_haproxy_res: 'lsb:haproxy'}
|
||||
_relation_data['resource_params'] = {
|
||||
_haproxy_res: 'op monitor interval="5s"'
|
||||
},
|
||||
'init_services': {
|
||||
_haproxy_res: 'haproxy'
|
||||
},
|
||||
'clones': {
|
||||
}
|
||||
_relation_data['init_services'] = {_haproxy_res: 'haproxy'}
|
||||
_relation_data['clones'] = {
|
||||
'cl_{}_haproxy'.format(service): _haproxy_res
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if extra_settings:
|
||||
for k, v in extra_settings.items():
|
||||
|
@ -0,0 +1,10 @@
|
||||
[oslo_messaging_rabbit]
|
||||
{% if rabbitmq_ha_queues -%}
|
||||
rabbit_ha_queues = True
|
||||
{% endif -%}
|
||||
{% if rabbit_ssl_port -%}
|
||||
rabbit_use_ssl = True
|
||||
{% endif -%}
|
||||
{% if rabbit_ssl_ca -%}
|
||||
ssl_ca_file = {{ rabbit_ssl_ca }}
|
||||
{% endif -%}
|
@ -21,7 +21,7 @@ root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||
report_interval = {{ report_interval }}
|
||||
{% include "parts/agent" %}
|
||||
|
||||
{% include "section-oslo-messaging-rabbit" %}
|
||||
{% include "section-oslo-messaging-rabbit-ocata" %}
|
||||
|
||||
{% include "section-oslo-notifications" %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user