diff --git a/config.yaml b/config.yaml index e6b225f..1c08a61 100644 --- a/config.yaml +++ b/config.yaml @@ -59,5 +59,13 @@ options: description: | The data port will be added to br-data and will allow usage of flat or VLAN network types with Neutron. - + disable-security-groups: + type: boolean + default: false + description: | + Disable neutron based security groups - setting this configuration option + will override any settings configured via the neutron-api charm. + . + BE CAREFUL - this option allows you to disable all port level security within + an OpenStack cloud. diff --git a/hooks/nova_compute_context.py b/hooks/nova_compute_context.py index 86332c3..7817816 100644 --- a/hooks/nova_compute_context.py +++ b/hooks/nova_compute_context.py @@ -15,6 +15,32 @@ def _network_manager(): return manager() +def _neutron_api_settings(): + ''' + Inspects current neutron-plugin relation + ''' + neutron_settings = { + 'neutron_security_groups': False, + 'l2_population': True, + 'overlay_network_type': 'gre', + } + for rid in relation_ids('neutron-plugin-api'): + for unit in related_units(rid): + rdata = relation_get(rid=rid, unit=unit) + if 'l2-population' not in rdata: + continue + neutron_settings = { + 'l2_population': rdata['l2-population'], + 'neutron_security_groups': rdata['neutron-security-groups'], + 'overlay_network_type': rdata['overlay-network-type'], + } + # Override with configuration if set to true + if config('disable-security-groups'): + neutron_settings['neutron_security_groups'] = False + return neutron_settings + return neutron_settings + + def _neutron_security_groups(): ''' Inspects current cloud-compute relation and determine if nova-c-c has @@ -222,5 +248,5 @@ class NeutronPowerComputeContext(context.NeutronContext): 'neutron_security_groups': self.neutron_security_groups, 'config': '/etc/neutron/plugins/ml2/ml2_conf.ini' } - + ovs_ctxt.update(_neutron_api_settings()) return ovs_ctxt diff --git a/metadata.yaml b/metadata.yaml index 569df0d..2fc3047 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -18,4 +18,7 @@ requires: interface: rabbitmq image-service: interface: glance + neutron-plugin-api: + interface: neutron-plugin-api + diff --git a/templates/ml2_conf.ini b/templates/ml2_conf.ini index 679bd2c..dc3a746 100644 --- a/templates/ml2_conf.ini +++ b/templates/ml2_conf.ini @@ -26,10 +26,8 @@ local_ip = LOCAL_IP bridge_mappings = physnet1:br-data [agent] -tunnel_types = gre -# {{ overlay_network_type }} -l2_population = True -# {{ l2_population }} +tunnel_types = {{ overlay_network_type }} +l2_population = {{ l2_population }} [securitygroup] {% if neutron_security_groups -%}