[gnuoy,r=james-page] Add l2population driver support, on by default.
This commit is contained in:
commit
19badbfbfa
|
@ -123,3 +123,10 @@ options:
|
|||
description: |
|
||||
SSL CA to use with the certificate and key provided - this is only
|
||||
required if you are providing a privately signed ssl_cert and ssl_key.
|
||||
l2-population:
|
||||
type: boolean
|
||||
default: True
|
||||
description: |
|
||||
Populate the forwarding tables of virtual switches (LinuxBridge or OVS),
|
||||
to decrease broadcast traffics inside the physical networks fabric while
|
||||
using overlays networks (VXLan, GRE).
|
||||
|
|
|
@ -11,6 +11,11 @@ from charmhelpers.contrib.hahelpers.cluster import (
|
|||
)
|
||||
|
||||
|
||||
def get_l2population():
|
||||
plugin = config('neutron-plugin')
|
||||
return config('l2-population') if plugin == "ovs" else False
|
||||
|
||||
|
||||
class ApacheSSLContext(context.ApacheSSLContext):
|
||||
|
||||
interfaces = ['https']
|
||||
|
@ -49,6 +54,10 @@ class NeutronCCContext(context.NeutronContext):
|
|||
def neutron_security_groups(self):
|
||||
return config('neutron-security-groups')
|
||||
|
||||
@property
|
||||
def neutron_l2_population(self):
|
||||
return get_l2population()
|
||||
|
||||
# Do not need the plugin agent installed on the api server
|
||||
def _ensure_packages(self):
|
||||
pass
|
||||
|
@ -60,6 +69,7 @@ class NeutronCCContext(context.NeutronContext):
|
|||
def __call__(self):
|
||||
from neutron_api_utils import api_port
|
||||
ctxt = super(NeutronCCContext, self).__call__()
|
||||
ctxt['l2_population'] = self.neutron_l2_population
|
||||
ctxt['external_network'] = config('neutron-external-network')
|
||||
ctxt['verbose'] = config('verbose')
|
||||
ctxt['debug'] = config('debug')
|
||||
|
|
|
@ -46,6 +46,7 @@ from neutron_api_utils import (
|
|||
register_configs,
|
||||
restart_map,
|
||||
)
|
||||
from neutron_api_context import get_l2population
|
||||
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
get_hacluster_config,
|
||||
|
@ -269,7 +270,8 @@ def neutron_api_relation_changed():
|
|||
@hooks.hook('neutron-plugin-api-relation-joined')
|
||||
def neutron_plugin_api_relation_joined(rid=None):
|
||||
relation_data = {
|
||||
'neutron-security-groups': config('neutron-security-groups')
|
||||
'neutron-security-groups': config('neutron-security-groups'),
|
||||
'l2-population': get_l2population(),
|
||||
}
|
||||
relation_set(relation_id=rid, **relation_data)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
[ml2]
|
||||
type_drivers = gre,vxlan
|
||||
tenant_network_types = gre,vxlan
|
||||
mechanism_drivers = openvswitch
|
||||
mechanism_drivers = openvswitch,l2population
|
||||
|
||||
[ml2_type_gre]
|
||||
tunnel_id_ranges = 1:1000
|
||||
|
|
|
@ -129,6 +129,7 @@ class NeutronAPIContextsTest(CharmTestCase):
|
|||
'external_network': 'bob',
|
||||
'neutron_bind_port': self.api_port,
|
||||
'verbose': True,
|
||||
'l2_population': True,
|
||||
}
|
||||
napi_ctxt = context.NeutronCCContext()
|
||||
with patch.object(napi_ctxt, '_ensure_packages'):
|
||||
|
|
|
@ -30,6 +30,9 @@ TO_PATCH = [
|
|||
'determine_ports',
|
||||
'do_openstack_upgrade',
|
||||
'execd_preinstall',
|
||||
'get_iface_for_address',
|
||||
'get_l2population',
|
||||
'get_netmask_for_address',
|
||||
'is_leader',
|
||||
'is_relation_made',
|
||||
'log',
|
||||
|
@ -262,10 +265,12 @@ class NeutronAPIHooksTests(CharmTestCase):
|
|||
self._call_hook('neutron-api-relation-changed')
|
||||
self.assertTrue(self.CONFIGS.write.called_with(NEUTRON_CONF))
|
||||
|
||||
def test_neutron_plugin_api_relation_joined(self):
|
||||
def test_neutron_plugin_api_relation_joined_nol2(self):
|
||||
_relation_data = {
|
||||
'neutron-security-groups': False,
|
||||
'l2-population': False,
|
||||
}
|
||||
self.get_l2population.return_value = False
|
||||
self._call_hook('neutron-plugin-api-relation-joined')
|
||||
self.relation_set.assert_called_with(
|
||||
relation_id=None,
|
||||
|
|
Loading…
Reference in New Issue