synced /next

This commit is contained in:
Edward Hope-Morley 2014-09-30 16:40:25 +01:00
commit 1ec9dd6831
6 changed files with 37 additions and 8 deletions

View File

@ -73,7 +73,7 @@ options:
with the other members of the HA Cluster.
ha-mcastport:
type: int
default: 5404
default: 5424
description: |
Default multicast port number that will be used to communicate between
HA Cluster nodes.
@ -123,6 +123,13 @@ 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).
prefer-ipv6:
type: boolean
default: False
@ -135,3 +142,4 @@ options:
order for this charm to function correctly, the privacy extension must be
disabled and a non-temporary address must be configured/available on
your network interface.

View File

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

View File

@ -1,6 +1,7 @@
#!/usr/bin/python
import sys
import uuid
from subprocess import check_call
from charmhelpers.core.hookenv import (
@ -48,6 +49,7 @@ from neutron_api_utils import (
do_openstack_upgrade,
setup_ipv6
)
from neutron_api_context import get_l2population
from charmhelpers.contrib.hahelpers.cluster import (
get_hacluster_config,
@ -224,7 +226,7 @@ def relation_broken():
@hooks.hook('identity-service-relation-joined')
def identity_joined(rid=None):
def identity_joined(rid=None, relation_trigger=False):
public_url = '{}:{}'.format(canonical_url(CONFIGS, PUBLIC),
api_port('neutron-server'))
admin_url = '{}:{}'.format(canonical_url(CONFIGS, ADMIN),
@ -232,14 +234,16 @@ def identity_joined(rid=None):
internal_url = '{}:{}'.format(canonical_url(CONFIGS, INTERNAL),
api_port('neutron-server')
)
endpoints = {
rel_settings = {
'quantum_service': 'quantum',
'quantum_region': config('region'),
'quantum_public_url': public_url,
'quantum_admin_url': admin_url,
'quantum_internal_url': internal_url,
}
relation_set(relation_id=rid, relation_settings=endpoints)
if relation_trigger:
rel_settings['relation_trigger'] = str(uuid.uuid4())
relation_set(relation_id=rid, relation_settings=rel_settings)
@hooks.hook('identity-service-relation-changed')
@ -270,7 +274,7 @@ def neutron_api_relation_joined(rid=None):
# Nova-cc may have grabbed the quantum endpoint so kick identity-service
# relation to register that its here
for r_id in relation_ids('identity-service'):
identity_joined(rid=r_id)
identity_joined(rid=r_id, relation_trigger=True)
@hooks.hook('neutron-api-relation-changed')
@ -282,7 +286,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)

View File

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

View File

@ -135,6 +135,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'):

View File

@ -31,6 +31,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',
@ -263,10 +266,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,