diff --git a/hooks/charmhelpers/contrib/openstack/context.py b/hooks/charmhelpers/contrib/openstack/context.py index 37528c47..b8995d4c 100644 --- a/hooks/charmhelpers/contrib/openstack/context.py +++ b/hooks/charmhelpers/contrib/openstack/context.py @@ -736,11 +736,17 @@ class ApacheSSLContext(OSContextGenerator): return sorted(list(set(cns))) def get_network_addresses(self): - """For each network configured, return corresponding address and vip - (if available). + """For each network configured, return corresponding address and + hostnamr or vip (if available). Returns a list of tuples of the form: + [(address_in_net_a, hostname_in_net_a), + (address_in_net_b, hostname_in_net_b), + ...] + + or, if no hostnames(s) available: + [(address_in_net_a, vip_in_net_a), (address_in_net_b, vip_in_net_b), ...] @@ -757,18 +763,22 @@ class ApacheSSLContext(OSContextGenerator): else: vips = [] - for net_type in ['os-internal-network', 'os-admin-network', - 'os-public-network']: - addr = get_address_in_network(config(net_type), + for net_type in ['internal', 'admin', 'public']: + net_config = config('os-{}-network'.format(net_type)) + addr = get_address_in_network(net_config, unit_get('private-address')) - if len(vips) > 1 and is_clustered(): - if not config(net_type): + + hostname_config = config('os-{}-hostname'.format(net_type)) + if hostname_config: + addresses.append((addr, hostname_config)) + elif len(vips) > 1 and is_clustered(): + if not net_config: log("Multiple networks configured but net_type " "is None (%s)." % net_type, level=WARNING) continue for vip in vips: - if is_address_in_network(config(net_type), vip): + if is_address_in_network(net_config, vip): addresses.append((addr, vip)) break @@ -1419,14 +1429,26 @@ class NeutronAPIContext(OSContextGenerator): 'rel_key': 'report-interval', 'default': 30, }, + 'enable_qos': { + 'rel_key': 'enable-qos', + 'default': False, + }, } ctxt = self.get_neutron_options({}) for rid in relation_ids('neutron-plugin-api'): for unit in related_units(rid): rdata = relation_get(rid=rid, unit=unit) + # The l2-population key is used by the context as a way of + # checking if the api service on the other end is sending data + # in a recent format. if 'l2-population' in rdata: ctxt.update(self.get_neutron_options(rdata)) + if ctxt['enable_qos']: + ctxt['extensions'] = 'qos' + else: + ctxt['extensions'] = '' + return ctxt def get_neutron_options(self, rdata): diff --git a/hooks/charmhelpers/core/hookenv.py b/hooks/charmhelpers/core/hookenv.py index fe7fd8c0..814a9354 100644 --- a/hooks/charmhelpers/core/hookenv.py +++ b/hooks/charmhelpers/core/hookenv.py @@ -789,6 +789,9 @@ class Hooks(object): def charm_dir(): """Return the root directory of the current charm""" + d = os.environ.get('JUJU_CHARM_DIR') + if d is not None: + return d return os.environ.get('CHARM_DIR') diff --git a/hooks/neutron_ovs_context.py b/hooks/neutron_ovs_context.py index 39f22bbe..8d5df6b1 100644 --- a/hooks/neutron_ovs_context.py +++ b/hooks/neutron_ovs_context.py @@ -114,6 +114,10 @@ class OVSPluginContext(context.NeutronContext): ovs_ctxt['distributed_routing'] = neutron_api_settings['enable_dvr'] ovs_ctxt['overlay_network_type'] = \ neutron_api_settings['overlay_network_type'] + ovs_ctxt['polling_interval'] = neutron_api_settings['polling_interval'] + ovs_ctxt['rpc_response_timeout'] = \ + neutron_api_settings['rpc_response_timeout'] + ovs_ctxt['report_interval'] = neutron_api_settings['report_interval'] # TODO: We need to sort out the syslog and debug/verbose options as a # general context helper ovs_ctxt['use_syslog'] = conf['use-syslog'] diff --git a/templates/icehouse/ml2_conf.ini b/templates/icehouse/ml2_conf.ini index f2aa23e3..af850d57 100644 --- a/templates/icehouse/ml2_conf.ini +++ b/templates/icehouse/ml2_conf.ini @@ -32,6 +32,7 @@ l2_population = {{ l2_population }} {% if veth_mtu -%} veth_mtu = {{ veth_mtu }} {% endif %} +polling_interval = {{ polling_interval }} [securitygroup] {% if neutron_security_groups -%} diff --git a/templates/icehouse/neutron.conf b/templates/icehouse/neutron.conf index eeef5047..8b5d0787 100644 --- a/templates/icehouse/neutron.conf +++ b/templates/icehouse/neutron.conf @@ -26,6 +26,7 @@ notification_driver = messaging {% endif -%} default_notification_level = INFO notification_topics = notifications +rpc_response_timeout = {{ rpc_response_timeout }} {% include "parts/rabbitmq" %} @@ -35,6 +36,7 @@ notification_topics = notifications [AGENT] root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf +report_interval = {{ report_interval }} [keystone_authtoken] signing_dir = /var/lib/neutron/keystone-signing diff --git a/templates/juno/ml2_conf.ini b/templates/juno/ml2_conf.ini index f798463a..c6b5b0be 100644 --- a/templates/juno/ml2_conf.ini +++ b/templates/juno/ml2_conf.ini @@ -33,6 +33,7 @@ enable_distributed_routing = {{ distributed_routing }} {% if veth_mtu -%} veth_mtu = {{ veth_mtu }} {% endif %} +polling_interval = {{ polling_interval }} [securitygroup] {% if neutron_security_groups -%} diff --git a/templates/kilo/neutron.conf b/templates/kilo/neutron.conf index 39cbfa55..81cc19eb 100644 --- a/templates/kilo/neutron.conf +++ b/templates/kilo/neutron.conf @@ -25,6 +25,7 @@ auth_strategy = keystone notification_driver = messaging default_notification_level = INFO notification_topics = notifications +rpc_response_timeout = {{ rpc_response_timeout }} {% include "section-zeromq" %} @@ -36,6 +37,7 @@ notification_topics = notifications [AGENT] root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf +report_interval = {{ report_interval }} [keystone_authtoken] signing_dir = /var/lib/neutron/keystone-signing diff --git a/templates/liberty/ml2_conf.ini b/templates/liberty/ml2_conf.ini index 08d52fad..9ac34d1d 100644 --- a/templates/liberty/ml2_conf.ini +++ b/templates/liberty/ml2_conf.ini @@ -34,6 +34,7 @@ prevent_arp_spoofing = {{ prevent_arp_spoofing }} {% if veth_mtu -%} veth_mtu = {{ veth_mtu }} {% endif -%} +polling_interval = {{ polling_interval }} [securitygroup] {% if neutron_security_groups -%} diff --git a/templates/mitaka/openvswitch_agent.ini b/templates/mitaka/openvswitch_agent.ini index 54a77aae..b6096ac5 100644 --- a/templates/mitaka/openvswitch_agent.ini +++ b/templates/mitaka/openvswitch_agent.ini @@ -20,6 +20,7 @@ prevent_arp_spoofing = {{ prevent_arp_spoofing }} {% if veth_mtu -%} veth_mtu = {{ veth_mtu }} {% endif -%} +polling_interval = {{ polling_interval }} [securitygroup] {% if neutron_security_groups and not enable_dpdk -%} diff --git a/tests/charmhelpers/core/hookenv.py b/tests/charmhelpers/core/hookenv.py index fe7fd8c0..814a9354 100644 --- a/tests/charmhelpers/core/hookenv.py +++ b/tests/charmhelpers/core/hookenv.py @@ -789,6 +789,9 @@ class Hooks(object): def charm_dir(): """Return the root directory of the current charm""" + d = os.environ.get('JUJU_CHARM_DIR') + if d is not None: + return d return os.environ.get('CHARM_DIR') diff --git a/unit_tests/test_neutron_ovs_context.py b/unit_tests/test_neutron_ovs_context.py index f82e32c6..d54a8bcf 100644 --- a/unit_tests/test_neutron_ovs_context.py +++ b/unit_tests/test_neutron_ovs_context.py @@ -170,6 +170,9 @@ class OVSPluginContextTest(CharmTestCase): 'neutron_url': 'https://127.0.0.13:9696', 'l2_population': True, 'overlay_network_type': 'gre', + 'polling_interval': 2, + 'rpc_response_timeout': 60, + 'report_interval': 30, 'network_providers': 'physnet3,physnet4', 'bridge_mappings': 'physnet1:br-data,physnet2:br-data', 'vlan_ranges': 'physnet1:1000:1500,physnet2:2000:2500', @@ -238,6 +241,9 @@ class OVSPluginContextTest(CharmTestCase): 'neutron_url': 'https://127.0.0.13:9696', 'l2_population': True, 'overlay_network_type': 'gre', + 'polling_interval': 2, + 'rpc_response_timeout': 60, + 'report_interval': 30, 'bridge_mappings': 'physnet1:br-data', 'vlan_ranges': 'physnet1:1000:2000', 'prevent_arp_spoofing': True,