[gnuoy,r=james-page] Add new relation to neutron-api for passing common neutron configuration from a central location - starting with l2population.
This commit is contained in:
commit
01ab9d50ba
@ -102,10 +102,3 @@ options:
|
|||||||
.
|
.
|
||||||
This network will be used for tenant network traffic in overlay
|
This network will be used for tenant network traffic in overlay
|
||||||
networks.
|
networks.
|
||||||
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).
|
|
||||||
|
1
hooks/neutron-plugin-api-relation-broken
Symbolic link
1
hooks/neutron-plugin-api-relation-broken
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
quantum_hooks.py
|
1
hooks/neutron-plugin-api-relation-changed
Symbolic link
1
hooks/neutron-plugin-api-relation-changed
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
quantum_hooks.py
|
1
hooks/neutron-plugin-api-relation-departed
Symbolic link
1
hooks/neutron-plugin-api-relation-departed
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
quantum_hooks.py
|
1
hooks/neutron-plugin-api-relation-joined
Symbolic link
1
hooks/neutron-plugin-api-relation-joined
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
quantum_hooks.py
|
@ -100,6 +100,27 @@ def core_plugin():
|
|||||||
return CORE_PLUGIN[networking_name()][plugin]
|
return CORE_PLUGIN[networking_name()][plugin]
|
||||||
|
|
||||||
|
|
||||||
|
def _neutron_api_settings():
|
||||||
|
'''
|
||||||
|
Inspects current neutron-plugin-api relation for neutron settings. Return
|
||||||
|
defaults if it is not present
|
||||||
|
'''
|
||||||
|
neutron_settings = {
|
||||||
|
'l2_population': True,
|
||||||
|
|
||||||
|
}
|
||||||
|
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'],
|
||||||
|
}
|
||||||
|
return neutron_settings
|
||||||
|
return neutron_settings
|
||||||
|
|
||||||
|
|
||||||
class NetworkServiceContext(OSContextGenerator):
|
class NetworkServiceContext(OSContextGenerator):
|
||||||
interfaces = ['quantum-network-service']
|
interfaces = ['quantum-network-service']
|
||||||
|
|
||||||
@ -181,6 +202,7 @@ class ExternalPortContext(OSContextGenerator):
|
|||||||
class QuantumGatewayContext(OSContextGenerator):
|
class QuantumGatewayContext(OSContextGenerator):
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
neutron_api_settings = _neutron_api_settings()
|
||||||
ctxt = {
|
ctxt = {
|
||||||
'shared_secret': get_shared_secret(),
|
'shared_secret': get_shared_secret(),
|
||||||
'local_ip':
|
'local_ip':
|
||||||
@ -191,7 +213,7 @@ class QuantumGatewayContext(OSContextGenerator):
|
|||||||
'debug': config('debug'),
|
'debug': config('debug'),
|
||||||
'verbose': config('verbose'),
|
'verbose': config('verbose'),
|
||||||
'instance_mtu': config('instance-mtu'),
|
'instance_mtu': config('instance-mtu'),
|
||||||
'l2_population': config('l2-population'),
|
'l2_population': neutron_api_settings['l2_population'],
|
||||||
}
|
}
|
||||||
return ctxt
|
return ctxt
|
||||||
|
|
||||||
|
@ -162,7 +162,8 @@ def amqp_departed():
|
|||||||
'pgsql-db-relation-changed',
|
'pgsql-db-relation-changed',
|
||||||
'amqp-relation-changed',
|
'amqp-relation-changed',
|
||||||
'cluster-relation-changed',
|
'cluster-relation-changed',
|
||||||
'cluster-relation-joined')
|
'cluster-relation-joined',
|
||||||
|
'neutron-plugin-api-relation-changed')
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def db_amqp_changed():
|
def db_amqp_changed():
|
||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
|
@ -27,6 +27,8 @@ requires:
|
|||||||
interface: rabbitmq
|
interface: rabbitmq
|
||||||
amqp-nova:
|
amqp-nova:
|
||||||
interface: rabbitmq
|
interface: rabbitmq
|
||||||
|
neutron-plugin-api:
|
||||||
|
interface: neutron-plugin-api
|
||||||
peers:
|
peers:
|
||||||
cluster:
|
cluster:
|
||||||
interface: quantum-gateway-ha
|
interface: quantum-gateway-ha
|
||||||
|
@ -353,3 +353,24 @@ class TestMisc(CharmTestCase):
|
|||||||
self.config.return_value = 'ovs'
|
self.config.return_value = 'ovs'
|
||||||
self.assertEquals(quantum_contexts.core_plugin(),
|
self.assertEquals(quantum_contexts.core_plugin(),
|
||||||
quantum_contexts.NEUTRON_ML2_PLUGIN)
|
quantum_contexts.NEUTRON_ML2_PLUGIN)
|
||||||
|
|
||||||
|
def test_neutron_api_settings(self):
|
||||||
|
self.relation_ids.return_value = ['foo']
|
||||||
|
self.related_units.return_value = ['bar']
|
||||||
|
self.test_relation.set({'l2-population': True})
|
||||||
|
self.relation_get.side_effect = self.test_relation.get
|
||||||
|
self.assertEquals(quantum_contexts._neutron_api_settings(),
|
||||||
|
{'l2_population': True})
|
||||||
|
|
||||||
|
def test_neutron_api_settings2(self):
|
||||||
|
self.relation_ids.return_value = ['foo']
|
||||||
|
self.related_units.return_value = ['bar']
|
||||||
|
self.test_relation.set({'l2-population': False})
|
||||||
|
self.relation_get.side_effect = self.test_relation.get
|
||||||
|
self.assertEquals(quantum_contexts._neutron_api_settings(),
|
||||||
|
{'l2_population': False})
|
||||||
|
|
||||||
|
def test_neutron_api_settings_no_apiplugin(self):
|
||||||
|
self.relation_ids.return_value = []
|
||||||
|
self.assertEquals(quantum_contexts._neutron_api_settings(),
|
||||||
|
{'l2_population': True})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user