Add dvr support

This commit is contained in:
Liam Young 2015-02-02 13:32:22 +00:00
parent 97bcb9a4e2
commit d2fa08858e
4 changed files with 73 additions and 5 deletions

View File

@ -111,6 +111,7 @@ def _neutron_api_settings():
''' '''
neutron_settings = { neutron_settings = {
'l2_population': False, 'l2_population': False,
'enable_dvr': False,
'overlay_network_type': 'gre', 'overlay_network_type': 'gre',
} }
@ -119,10 +120,11 @@ def _neutron_api_settings():
rdata = relation_get(rid=rid, unit=unit) rdata = relation_get(rid=rid, unit=unit)
if 'l2-population' not in rdata: if 'l2-population' not in rdata:
continue continue
neutron_settings = { neutron_settings['l2_population'] = rdata['l2-population']
'l2_population': rdata['l2-population'], if 'overlay-network-type' in rdata:
'overlay_network_type': rdata['overlay-network-type'], neutron_settings['overlay_network_type'] = rdata['overlay-network-type']
} if 'enable-dvr' in rdata:
neutron_settings['enable_dvr'] = rdata['enable-dvr']
return neutron_settings return neutron_settings
return neutron_settings return neutron_settings
@ -158,6 +160,7 @@ class NetworkServiceContext(OSContextGenerator):
class L3AgentContext(OSContextGenerator): class L3AgentContext(OSContextGenerator):
def __call__(self): def __call__(self):
neutron_api_settings = _neutron_api_settings()
ctxt = {} ctxt = {}
if config('run-internal-router') == 'leader': if config('run-internal-router') == 'leader':
ctxt['handle_internal_only_router'] = eligible_leader(None) ctxt['handle_internal_only_router'] = eligible_leader(None)
@ -170,9 +173,12 @@ class L3AgentContext(OSContextGenerator):
if config('external-network-id'): if config('external-network-id'):
ctxt['ext_net_id'] = config('external-network-id') ctxt['ext_net_id'] = config('external-network-id')
if config('plugin'): if config('plugin'):
ctxt['plugin'] = config('plugin') ctxt['plugin'] = config('plugin')
if neutron_api_settings['enable_dvr'] == 'True':
ctxt['agent_mode'] = 'dvr_snat'
else:
ctxt['agent_mode'] = 'legacy'
return ctxt return ctxt
@ -243,6 +249,7 @@ class QuantumGatewayContext(OSContextGenerator):
'verbose': config('verbose'), 'verbose': config('verbose'),
'instance_mtu': config('instance-mtu'), 'instance_mtu': config('instance-mtu'),
'l2_population': neutron_api_settings['l2_population'], 'l2_population': neutron_api_settings['l2_population'],
'enable_dvr': neutron_api_settings['enable_dvr'],
'overlay_network_type': 'overlay_network_type':
neutron_api_settings['overlay_network_type'], neutron_api_settings['overlay_network_type'],
} }

View File

@ -413,6 +413,9 @@ def register_configs():
drop_config = NEUTRON_ML2_PLUGIN_CONF drop_config = NEUTRON_ML2_PLUGIN_CONF
if release >= 'icehouse': if release >= 'icehouse':
drop_config = NEUTRON_OVS_PLUGIN_CONF drop_config = NEUTRON_OVS_PLUGIN_CONF
# NOTE(gnuoy) neutron-vpn-agent supercedes l3-agent for icehouse
CONFIG_FILES[name][plugin][NEUTRON_L3_AGENT_CONF]['services'] = \
['neutron-vpn-agent']
if drop_config in CONFIG_FILES[name][plugin]: if drop_config in CONFIG_FILES[name][plugin]:
CONFIG_FILES[name][plugin].pop(drop_config) CONFIG_FILES[name][plugin].pop(drop_config)

View File

@ -0,0 +1,25 @@
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
###############################################################################
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
auth_url = {{ service_protocol }}://{{ keystone_host }}:{{ service_port }}/v2.0
auth_region = {{ region }}
admin_tenant_name = {{ service_tenant }}
admin_user = {{ service_username }}
admin_password = {{ service_password }}
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
handle_internal_only_routers = {{ handle_internal_only_router }}
{% if plugin == 'n1kv' %}
l3_agent_manager = neutron.agent.l3_agent.L3NATAgentWithStateReport
external_network_bridge = br-int
ovs_use_veth = False
use_namespaces = True
{% else %}
ovs_use_veth = True
{% endif %}
{% if ext_net_id -%}
gateway_external_network_id = {{ ext_net_id }}
{% endif -%}
agent_mode = {{ agent_mode }}

View File

@ -0,0 +1,33 @@
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
###############################################################################
[ml2]
type_drivers = gre,vxlan,vlan,flat
tenant_network_types = gre,vxlan,vlan,flat
mechanism_drivers = openvswitch,l2population
[ml2_type_gre]
tunnel_id_ranges = 1:1000
[ml2_type_vxlan]
vni_ranges = 1001:2000
[ml2_type_vlan]
network_vlan_ranges = physnet1:1000:2000
[ml2_type_flat]
flat_networks = physnet1
[ovs]
enable_tunneling = True
local_ip = {{ local_ip }}
bridge_mappings = physnet1:br-data
[agent]
tunnel_types = {{ overlay_network_type }}
l2_population = {{ l2_population }}
enable_distributed_routing = {{ enable_dvr }}
[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver