From 9cb8b2fb4655f8c1686b3af9a829d10aaaf56dce Mon Sep 17 00:00:00 2001 From: Liam Young Date: Tue, 24 Mar 2015 12:07:21 +0000 Subject: [PATCH 1/3] Moved contexts out into charmhelpers --- .../charmhelpers/contrib/openstack/context.py | 141 ++++++++++- hooks/quantum_contexts.py | 120 +--------- hooks/quantum_utils.py | 10 +- unit_tests/test_quantum_contexts.py | 221 +----------------- unit_tests/test_quantum_utils.py | 6 +- 5 files changed, 158 insertions(+), 340 deletions(-) diff --git a/hooks/charmhelpers/contrib/openstack/context.py b/hooks/charmhelpers/contrib/openstack/context.py index 90ac6d69..7c52bd73 100644 --- a/hooks/charmhelpers/contrib/openstack/context.py +++ b/hooks/charmhelpers/contrib/openstack/context.py @@ -47,6 +47,7 @@ from charmhelpers.core.hookenv import ( ) from charmhelpers.core.sysctl import create as sysctl_create +from charmhelpers.core.strutils import bool_from_string from charmhelpers.core.host import ( list_nics, @@ -67,6 +68,7 @@ from charmhelpers.contrib.hahelpers.apache import ( ) from charmhelpers.contrib.openstack.neutron import ( neutron_plugin_attribute, + parse_data_port_mappings, ) from charmhelpers.contrib.openstack.ip import ( resolve_address, @@ -82,7 +84,6 @@ from charmhelpers.contrib.network.ip import ( is_bridge_member, ) from charmhelpers.contrib.openstack.utils import get_host_ip - CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt' ADDRESS_TYPES = ['admin', 'internal', 'public'] @@ -1162,3 +1163,141 @@ class SysctlContext(OSContextGenerator): sysctl_create(sysctl_dict, '/etc/sysctl.d/50-{0}.conf'.format(charm_name())) return {'sysctl': sysctl_dict} + + +class NeutronAPIContext(OSContextGenerator): + ''' + Inspects current neutron-plugin-api relation for neutron settings. Return + defaults if it is not present. + ''' + interfaces = ['neutron-plugin-api'] + + def __call__(self): + self.neutron_defaults = { + 'l2_population': { + 'rel_key': 'l2-population', + 'default': False + }, + 'enable_dvr': { + 'rel_key': 'enable-dvr', + 'default': False + }, + 'enable_l3ha': { + 'rel_key': 'enable-l3ha', + 'default': False + }, + 'overlay_network_type': { + 'rel_key': 'overlay-network-type', + 'default': 'gre' + }, + 'network_device_mtu': { + 'rel_key': 'network-device-mtu', + 'default': None + }, + } + ctxt = self.get_neutron_options({}) + for rid in relation_ids('neutron-plugin-api'): + for unit in related_units(rid): + rdata = relation_get(rid=rid, unit=unit) + if 'l2-population' in rdata: + ctxt.update(self.get_neutron_options(rdata)) + + return ctxt + + def get_neutron_options(self, rdata): + settings = {} + for nkey in self.neutron_defaults.keys(): + defv = self.neutron_defaults[nkey]['default'] + rkey = self.neutron_defaults[nkey]['rel_key'] + if rkey in rdata.keys(): + if type(defv) is bool: + settings[nkey] = bool_from_string(rdata[rkey]) + else: + settings[nkey] = rdata[rkey] + else: + settings[nkey] = defv + return settings + + +class ExternalPortContext(NeutronPortContext): + + def __call__(self): + ctxt = {} + ports = config('ext-port') + if ports: + ports = [p.strip() for p in ports.split()] + ports = self.resolve_ports(ports) + if ports: + ctxt = {"ext_port": ports[0]} + napi_settings = NeutronAPIContext()() + mtu = napi_settings.get('network_device_mtu') + if mtu: + ctxt['ext_port_mtu'] = mtu + + return ctxt + + +class DataPortContext(NeutronPortContext): + + def __call__(self): + ports = config('data-port') + if ports: + portmap = parse_data_port_mappings(ports) + ports = portmap.values() + resolved = self.resolve_ports(ports) + normalized = {get_nic_hwaddr(port): port for port in resolved + if port not in ports} + normalized.update({port: port for port in resolved + if port in ports}) + if resolved: + return {bridge: normalized[port] for bridge, port in + portmap.iteritems() if port in normalized.keys()} + + return None + + +class PhyNICMTUContext(DataPortContext): + + def __call__(self): + ctxt = {} + mappings = super(PhyNICMTUContext, self).__call__() + if mappings and mappings.values(): + ports = mappings.values() + napi_settings = NeutronAPIContext()() + mtu = napi_settings.get('network_device_mtu') + if mtu: + ctxt["devs"] = '\\n'.join(ports) + ctxt['mtu'] = mtu + + return ctxt + + +class NetworkServiceContext(OSContextGenerator): + + def __init__(self, rel_name='quantum-network-service'): + self.rel_name = rel_name + self.interfaces = [rel_name] + + def __call__(self): + for rid in relation_ids(self.rel_name): + for unit in related_units(rid): + rdata = relation_get(rid=rid, unit=unit) + ctxt = { + 'keystone_host': rdata.get('keystone_host'), + 'service_port': rdata.get('service_port'), + 'auth_port': rdata.get('auth_port'), + 'service_tenant': rdata.get('service_tenant'), + 'service_username': rdata.get('service_username'), + 'service_password': rdata.get('service_password'), + 'quantum_host': rdata.get('quantum_host'), + 'quantum_port': rdata.get('quantum_port'), + 'quantum_url': rdata.get('quantum_url'), + 'region': rdata.get('region'), + 'service_protocol': + rdata.get('service_protocol') or 'http', + 'auth_protocol': + rdata.get('auth_protocol') or 'http', + } + if context_complete(ctxt): + return ctxt + return {} diff --git a/hooks/quantum_contexts.py b/hooks/quantum_contexts.py index 7856bf06..b262a019 100644 --- a/hooks/quantum_contexts.py +++ b/hooks/quantum_contexts.py @@ -4,9 +4,6 @@ import uuid import socket from charmhelpers.core.hookenv import ( config, - relation_ids, - related_units, - relation_get, unit_get, cached ) @@ -15,8 +12,7 @@ from charmhelpers.fetch import ( ) from charmhelpers.contrib.openstack.context import ( OSContextGenerator, - context_complete, - NeutronPortContext, + NeutronAPIContext, ) from charmhelpers.contrib.openstack.utils import ( get_os_codename_install_source @@ -28,12 +24,8 @@ from charmhelpers.contrib.network.ip import ( get_address_in_network, ) from charmhelpers.contrib.openstack.neutron import ( - parse_data_port_mappings, parse_vlan_range_mappings, ) -from charmhelpers.core.host import ( - get_nic_hwaddr, -) DB_USER = "quantum" QUANTUM_DB = "quantum" @@ -104,61 +96,6 @@ def core_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': False, - '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' in rdata: - neutron_settings.update({ - 'l2_population': rdata['l2-population'], - 'overlay_network_type': rdata['overlay-network-type'], - }) - - net_dev_mtu = rdata.get('network-device-mtu') - if net_dev_mtu: - neutron_settings['network_device_mtu'] = net_dev_mtu - - return neutron_settings - - -class NetworkServiceContext(OSContextGenerator): - interfaces = ['quantum-network-service'] - - def __call__(self): - for rid in relation_ids('quantum-network-service'): - for unit in related_units(rid): - rdata = relation_get(rid=rid, unit=unit) - ctxt = { - 'keystone_host': rdata.get('keystone_host'), - 'service_port': rdata.get('service_port'), - 'auth_port': rdata.get('auth_port'), - 'service_tenant': rdata.get('service_tenant'), - 'service_username': rdata.get('service_username'), - 'service_password': rdata.get('service_password'), - 'quantum_host': rdata.get('quantum_host'), - 'quantum_port': rdata.get('quantum_port'), - 'quantum_url': rdata.get('quantum_url'), - 'region': rdata.get('region'), - 'service_protocol': - rdata.get('service_protocol') or 'http', - 'auth_protocol': - rdata.get('auth_protocol') or 'http', - } - if context_complete(ctxt): - return ctxt - return {} - - class L3AgentContext(OSContextGenerator): def __call__(self): @@ -180,63 +117,10 @@ class L3AgentContext(OSContextGenerator): return ctxt -class ExternalPortContext(NeutronPortContext): - - def __call__(self): - ctxt = {} - ports = config('ext-port') - if ports: - ports = [p.strip() for p in ports.split()] - ports = self.resolve_ports(ports) - if ports: - ctxt = {"ext_port": ports[0]} - neutron_api_settings = _neutron_api_settings() - mtu = neutron_api_settings.get('network_device_mtu') - if mtu: - ctxt['ext_port_mtu'] = mtu - - return ctxt - - -class DataPortContext(NeutronPortContext): - - def __call__(self): - ports = config('data-port') - if ports: - portmap = parse_data_port_mappings(ports) - ports = portmap.values() - resolved = self.resolve_ports(ports) - normalized = {get_nic_hwaddr(port): port for port in resolved - if port not in ports} - normalized.update({port: port for port in resolved - if port in ports}) - if resolved: - return {bridge: normalized[port] for bridge, port in - portmap.iteritems() if port in normalized.keys()} - - return None - - -class PhyNICMTUContext(DataPortContext): - - def __call__(self): - ctxt = {} - mappings = super(PhyNICMTUContext, self).__call__() - if mappings and mappings.values(): - ports = mappings.values() - neutron_api_settings = _neutron_api_settings() - mtu = neutron_api_settings.get('network_device_mtu') - if mtu: - ctxt["devs"] = '\\n'.join(ports) - ctxt['mtu'] = mtu - - return ctxt - - class QuantumGatewayContext(OSContextGenerator): def __call__(self): - neutron_api_settings = _neutron_api_settings() + neutron_api_settings = NeutronAPIContext()() ctxt = { 'shared_secret': get_shared_secret(), 'local_ip': diff --git a/hooks/quantum_utils.py b/hooks/quantum_utils.py index e7a0f6c6..eaec1a87 100644 --- a/hooks/quantum_utils.py +++ b/hooks/quantum_utils.py @@ -41,7 +41,11 @@ from charmhelpers.contrib.openstack.neutron import ( import charmhelpers.contrib.openstack.context as context from charmhelpers.contrib.openstack.context import ( - SyslogContext + SyslogContext, + NetworkServiceContext, + ExternalPortContext, + PhyNICMTUContext, + DataPortContext, ) import charmhelpers.contrib.openstack.templating as templating from charmhelpers.contrib.openstack.neutron import headers_package @@ -50,11 +54,7 @@ from quantum_contexts import ( NEUTRON, QUANTUM, networking_name, QuantumGatewayContext, - NetworkServiceContext, L3AgentContext, - ExternalPortContext, - PhyNICMTUContext, - DataPortContext, remap_plugin ) from charmhelpers.contrib.openstack.neutron import ( diff --git a/unit_tests/test_quantum_contexts.py b/unit_tests/test_quantum_contexts.py index 5244ec89..e183c119 100644 --- a/unit_tests/test_quantum_contexts.py +++ b/unit_tests/test_quantum_contexts.py @@ -14,12 +14,8 @@ from test_utils import ( TO_PATCH = [ 'apt_install', 'config', - 'context_complete', 'eligible_leader', 'get_os_codename_install_source', - 'relation_get', - 'relation_ids', - 'related_units', 'unit_get', ] @@ -42,182 +38,6 @@ def patch_open(): yield mock_open, mock_file -class TestNetworkServiceContext(CharmTestCase): - - def setUp(self): - super(TestNetworkServiceContext, self).setUp(quantum_contexts, - TO_PATCH) - self.config.side_effect = self.test_config.get - self.context = quantum_contexts.NetworkServiceContext() - self.test_relation.set( - {'keystone_host': '10.5.0.1', - 'service_port': '5000', - 'auth_port': '20000', - 'service_tenant': 'tenant', - 'service_username': 'username', - 'service_password': 'password', - 'quantum_host': '10.5.0.2', - 'quantum_port': '9696', - 'quantum_url': 'http://10.5.0.2:9696/v2', - 'region': 'aregion'} - ) - self.data_result = { - 'keystone_host': '10.5.0.1', - 'service_port': '5000', - 'auth_port': '20000', - 'service_tenant': 'tenant', - 'service_username': 'username', - 'service_password': 'password', - 'quantum_host': '10.5.0.2', - 'quantum_port': '9696', - 'quantum_url': 'http://10.5.0.2:9696/v2', - 'region': 'aregion', - 'service_protocol': 'http', - 'auth_protocol': 'http', - } - - def test_not_related(self): - self.relation_ids.return_value = [] - self.assertEquals(self.context(), {}) - - def test_no_units(self): - self.relation_ids.return_value = [] - self.relation_ids.return_value = ['foo'] - self.related_units.return_value = [] - self.assertEquals(self.context(), {}) - - def test_no_data(self): - self.relation_ids.return_value = ['foo'] - self.related_units.return_value = ['bar'] - self.relation_get.side_effect = self.test_relation.get - self.context_complete.return_value = False - self.assertEquals(self.context(), {}) - - def test_data_multi_unit(self): - self.relation_ids.return_value = ['foo'] - self.related_units.return_value = ['bar', 'baz'] - self.context_complete.return_value = True - self.relation_get.side_effect = self.test_relation.get - self.assertEquals(self.context(), self.data_result) - - def test_data_single_unit(self): - self.relation_ids.return_value = ['foo'] - self.related_units.return_value = ['bar'] - self.context_complete.return_value = True - self.relation_get.side_effect = self.test_relation.get - self.assertEquals(self.context(), self.data_result) - - -class TestNeutronPortContext(CharmTestCase): - - def setUp(self): - super(TestNeutronPortContext, self).setUp(quantum_contexts, - TO_PATCH) - self.machine_macs = { - 'eth0': 'fe:c5:ce:8e:2b:00', - 'eth1': 'fe:c5:ce:8e:2b:01', - 'eth2': 'fe:c5:ce:8e:2b:02', - 'eth3': 'fe:c5:ce:8e:2b:03', - } - self.machine_nics = { - 'eth0': ['192.168.0.1'], - 'eth1': ['192.168.0.2'], - 'eth2': [], - 'eth3': [], - } - self.absent_macs = "aa:a5:ae:ae:ab:a4 " - - def fake_config(self, cfgdict): - - def _fake_config(key): - return cfgdict.get(key) - - return _fake_config - - def _fake_get_hwaddr(self, arg): - return self.machine_macs[arg] - - def _fake_get_ipv4(self, arg, fatal=False): - return self.machine_nics[arg] - - @patch('charmhelpers.contrib.openstack.context.config') - def test_no_ext_port(self, mock_config): - self.config.side_effect = config = self.fake_config({}) - mock_config.side_effect = config - self.assertEquals(quantum_contexts.ExternalPortContext()(), {}) - - @patch('charmhelpers.contrib.openstack.context.config') - def test_ext_port_eth(self, mock_config): - config = self.fake_config({'ext-port': 'eth1010'}) - self.config.side_effect = config - mock_config.side_effect = config - self.assertEquals(quantum_contexts.ExternalPortContext()(), - {'ext_port': 'eth1010'}) - - @patch('charmhelpers.contrib.openstack.context.get_nic_hwaddr') - @patch('charmhelpers.contrib.openstack.context.list_nics') - @patch('charmhelpers.contrib.openstack.context.get_ipv6_addr') - @patch('charmhelpers.contrib.openstack.context.get_ipv4_addr') - @patch('charmhelpers.contrib.openstack.context.config') - def test_ext_port_mac(self, mock_config, mock_get_ipv4_addr, - mock_get_ipv6_addr, mock_list_nics, - mock_get_nic_hwaddr): - config_macs = self.absent_macs + " " + self.machine_macs['eth2'] - config = self.fake_config({'ext-port': config_macs}) - self.config.side_effect = config - mock_config.side_effect = config - - mock_get_ipv4_addr.side_effect = self._fake_get_ipv4 - mock_get_ipv6_addr.return_value = [] - mock_list_nics.return_value = self.machine_macs.keys() - mock_get_nic_hwaddr.side_effect = self._fake_get_hwaddr - - self.assertEquals(quantum_contexts.ExternalPortContext()(), - {'ext_port': 'eth2'}) - - config = self.fake_config({'ext-port': self.absent_macs}) - self.config.side_effect = config - mock_config.side_effect = config - - self.assertEquals(quantum_contexts.ExternalPortContext()(), {}) - - @patch.object(quantum_contexts, '_neutron_api_settings') - @patch('charmhelpers.contrib.openstack.context.get_nic_hwaddr') - @patch('charmhelpers.contrib.openstack.context.list_nics') - @patch('charmhelpers.contrib.openstack.context.get_ipv6_addr') - @patch('charmhelpers.contrib.openstack.context.get_ipv4_addr') - @patch('charmhelpers.contrib.openstack.context.config') - def test_ext_port_mac_one_used_nic(self, mock_config, - mock_get_ipv4_addr, - mock_get_ipv6_addr, mock_list_nics, - mock_get_nic_hwaddr, - mock_neutron_api_settings): - - mock_neutron_api_settings.return_value = {'network_device_mtu': 1234} - config_macs = "%s %s" % (self.machine_macs['eth1'], - self.machine_macs['eth2']) - - mock_get_ipv4_addr.side_effect = self._fake_get_ipv4 - mock_get_ipv6_addr.return_value = [] - mock_list_nics.return_value = self.machine_macs.keys() - mock_get_nic_hwaddr.side_effect = self._fake_get_hwaddr - - config = self.fake_config({'ext-port': config_macs}) - self.config.side_effect = config - mock_config.side_effect = config - self.assertEquals(quantum_contexts.ExternalPortContext()(), - {'ext_port': 'eth2', 'ext_port_mtu': 1234}) - - @patch('charmhelpers.contrib.openstack.context.NeutronPortContext.' - 'resolve_ports') - def test_data_port_eth(self, mock_resolve): - self.config.side_effect = self.fake_config({'data-port': - 'phybr1:eth1010'}) - mock_resolve.side_effect = lambda ports: ports - self.assertEquals(quantum_contexts.DataPortContext()(), - {'phybr1': 'eth1010'}) - - class TestL3AgentContext(CharmTestCase): def setUp(self): @@ -259,9 +79,12 @@ class TestQuantumGatewayContext(CharmTestCase): TO_PATCH) self.config.side_effect = self.test_config.get + @patch('charmhelpers.contrib.openstack.context.relation_get') + @patch('charmhelpers.contrib.openstack.context.related_units') + @patch('charmhelpers.contrib.openstack.context.relation_ids') @patch.object(quantum_contexts, 'get_shared_secret') @patch.object(quantum_contexts, 'get_host_ip') - def test_all(self, _host_ip, _secret): + def test_all(self, _host_ip, _secret, _rids, _runits, _rget): self.test_config.set('plugin', 'ovs') self.test_config.set('debug', False) self.test_config.set('verbose', True) @@ -269,15 +92,14 @@ class TestQuantumGatewayContext(CharmTestCase): self.test_config.set('vlan-ranges', 'physnet1:1000:2000 physnet2:2001:3000') # Provided by neutron-api relation - self.relation_ids.return_value = ['neutron-plugin-api:0'] - self.related_units.return_value = ['neutron-api/0'] - rdata = {'network-device-mtu': 9000} - self.relation_get.side_effect = lambda *args, **kwargs: rdata + _rids.return_value = ['neutron-plugin-api:0'] + _runits.return_value = ['neutron-api/0'] + rdata = {'network-device-mtu': 9000, 'l2-population': 'False'} + _rget.side_effect = lambda *args, **kwargs: rdata self.get_os_codename_install_source.return_value = 'folsom' _host_ip.return_value = '10.5.0.1' _secret.return_value = 'testsecret' ctxt = quantum_contexts.QuantumGatewayContext()() - self.relation_ids.assert_called_with('neutron-plugin-api') self.assertEquals(ctxt, { 'shared_secret': 'testsecret', 'local_ip': '10.5.0.1', @@ -414,30 +236,3 @@ class TestMisc(CharmTestCase): self.config.return_value = 'ovs' self.assertEquals(quantum_contexts.core_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, - 'overlay-network-type': 'gre', }) - self.relation_get.side_effect = self.test_relation.get - self.assertEquals(quantum_contexts._neutron_api_settings(), - {'l2_population': True, - 'overlay_network_type': 'gre'}) - - def test_neutron_api_settings2(self): - self.relation_ids.return_value = ['foo'] - self.related_units.return_value = ['bar'] - self.test_relation.set({'l2-population': True, - 'overlay-network-type': 'gre', }) - self.relation_get.side_effect = self.test_relation.get - self.assertEquals(quantum_contexts._neutron_api_settings(), - {'l2_population': True, - 'overlay_network_type': 'gre'}) - - def test_neutron_api_settings_no_apiplugin(self): - self.config.return_value = 1500 - self.relation_ids.return_value = [] - self.assertEquals(quantum_contexts._neutron_api_settings(), - {'l2_population': False, - 'overlay_network_type': 'gre', }) diff --git a/unit_tests/test_quantum_utils.py b/unit_tests/test_quantum_utils.py index 60a87d03..1ceaa423 100644 --- a/unit_tests/test_quantum_utils.py +++ b/unit_tests/test_quantum_utils.py @@ -138,7 +138,7 @@ class TestQuantumUtils(CharmTestCase): self.get_os_codename_install_source.return_value = 'kilo' self.assertTrue('python-neutron-fwaas' in quantum_utils.get_packages()) - @patch('quantum_contexts.config') + @patch('charmhelpers.contrib.openstack.context.config') def test_configure_ovs_starts_service_if_required(self, mock_config): mock_config.side_effect = self.test_config.get self.config.return_value = 'ovs' @@ -151,7 +151,7 @@ class TestQuantumUtils(CharmTestCase): quantum_utils.configure_ovs() self.assertFalse(self.full_restart.called) - @patch('quantum_contexts.config') + @patch('charmhelpers.contrib.openstack.context.config') def test_configure_ovs_ovs_ext_port(self, mock_config): mock_config.side_effect = self.test_config.get self.config.side_effect = self.test_config.get @@ -167,7 +167,7 @@ class TestQuantumUtils(CharmTestCase): ]) self.add_bridge_port.assert_called_with('br-ex', 'eth0') - @patch('quantum_contexts.config') + @patch('charmhelpers.contrib.openstack.context.config') def test_configure_ovs_ovs_data_port(self, mock_config): mock_config.side_effect = self.test_config.get self.config.side_effect = self.test_config.get From 484416045d15aa26b15e78c77fe9095810f78308 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Tue, 24 Mar 2015 13:29:12 +0000 Subject: [PATCH 2/3] Sync charmhelpers --- charm-helpers-hooks.yaml | 3 +- .../charmhelpers/contrib/openstack/context.py | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/charm-helpers-hooks.yaml b/charm-helpers-hooks.yaml index 84cc6c76..e1644103 100644 --- a/charm-helpers-hooks.yaml +++ b/charm-helpers-hooks.yaml @@ -1,4 +1,5 @@ -branch: lp:charm-helpers +branch: lp:~gnuoy/charm-helpers/neutron-shuffle +#branch: lp:charm-helpers destination: hooks/charmhelpers include: - core diff --git a/hooks/charmhelpers/contrib/openstack/context.py b/hooks/charmhelpers/contrib/openstack/context.py index 7c52bd73..45e65790 100644 --- a/hooks/charmhelpers/contrib/openstack/context.py +++ b/hooks/charmhelpers/contrib/openstack/context.py @@ -1176,23 +1176,27 @@ class NeutronAPIContext(OSContextGenerator): self.neutron_defaults = { 'l2_population': { 'rel_key': 'l2-population', - 'default': False - }, - 'enable_dvr': { - 'rel_key': 'enable-dvr', - 'default': False - }, - 'enable_l3ha': { - 'rel_key': 'enable-l3ha', - 'default': False + 'default': False, }, 'overlay_network_type': { 'rel_key': 'overlay-network-type', - 'default': 'gre' + 'default': 'gre', + }, + 'neutron_security_groups': { + 'rel_key': 'neutron-security-groups', + 'default': False, }, 'network_device_mtu': { 'rel_key': 'network-device-mtu', - 'default': None + 'default': None, + }, + 'enable_dvr': { + 'rel_key': 'enable-dvr', + 'default': False, + }, + 'enable_l3ha': { + 'rel_key': 'enable-l3ha', + 'default': False, }, } ctxt = self.get_neutron_options({}) @@ -1251,7 +1255,7 @@ class DataPortContext(NeutronPortContext): if port in ports}) if resolved: return {bridge: normalized[port] for bridge, port in - portmap.iteritems() if port in normalized.keys()} + six.iteritems(portmap) if port in normalized.keys()} return None From 7868fdf9e96c2b556fc369a796f03cfcd99b30e7 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Tue, 24 Mar 2015 14:39:26 +0000 Subject: [PATCH 3/3] Only render network_device_mtu if the option is set --- templates/icehouse/neutron.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/icehouse/neutron.conf b/templates/icehouse/neutron.conf index 78814822..aa7ca65a 100644 --- a/templates/icehouse/neutron.conf +++ b/templates/icehouse/neutron.conf @@ -11,6 +11,8 @@ core_plugin = {{ core_plugin }} control_exchange = neutron notification_driver = neutron.openstack.common.notifier.list_notifier list_notifier_drivers = neutron.openstack.common.notifier.rabbit_notifier +{% if network_device_mtu -%} network_device_mtu = {{ network_device_mtu }} +{% endif -%} [agent] -root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf \ No newline at end of file +root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf