Add relation for neutron-api and assocaited features

This commit is contained in:
James Page 2014-11-10 16:18:39 +00:00
parent a317e43169
commit ee165bc580
4 changed files with 41 additions and 6 deletions

View File

@ -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.

View File

@ -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

View File

@ -18,4 +18,7 @@ requires:
interface: rabbitmq
image-service:
interface: glance
neutron-plugin-api:
interface: neutron-plugin-api

View File

@ -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 -%}