From 84163f18440a7403a4838d64da4b1ce601d7e1ed Mon Sep 17 00:00:00 2001 From: Zhang Hua Date: Thu, 4 Dec 2014 11:41:12 +0800 Subject: [PATCH 1/5] enable network-device-mtu --- hooks/neutron_ovs_context.py | 2 ++ templates/icehouse/neutron.conf | 3 ++- unit_tests/test_neutron_ovs_context.py | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hooks/neutron_ovs_context.py b/hooks/neutron_ovs_context.py index 7dbf5211..43952c52 100644 --- a/hooks/neutron_ovs_context.py +++ b/hooks/neutron_ovs_context.py @@ -36,6 +36,7 @@ def _neutron_api_settings(): 'l2_population': rdata['l2-population'], 'neutron_security_groups': rdata['neutron-security-groups'], 'overlay_network_type': rdata['overlay-network-type'], + 'network_device_mtu': rdata['network-device-mtu'], } # Override with configuration if set to true if config('disable-security-groups'): @@ -103,6 +104,7 @@ class OVSPluginContext(context.NeutronContext): neutron_api_settings = _neutron_api_settings() ovs_ctxt['neutron_security_groups'] = self.neutron_security_groups ovs_ctxt['l2_population'] = neutron_api_settings['l2_population'] + ovs_ctxt['network_device_mtu'] = neutron_api_settings['network_device_mtu'] ovs_ctxt['overlay_network_type'] = \ neutron_api_settings['overlay_network_type'] # TODO: We need to sort out the syslog and debug/verbose options as a diff --git a/templates/icehouse/neutron.conf b/templates/icehouse/neutron.conf index 964f6dce..c7af465a 100644 --- a/templates/icehouse/neutron.conf +++ b/templates/icehouse/neutron.conf @@ -1,4 +1,4 @@ -# grizzly +# icehouse ############################################################################### # [ WARNING ] # Configuration file maintained by Juju. Local changes may be overwritten. @@ -12,6 +12,7 @@ state_path = /var/lib/neutron lock_path = $state_path/lock bind_host = 0.0.0.0 bind_port = 9696 +network_device_mtu = {{ network_device_mtu }} {% if core_plugin -%} core_plugin = {{ core_plugin }} diff --git a/unit_tests/test_neutron_ovs_context.py b/unit_tests/test_neutron_ovs_context.py index 3e2ee906..a94b79ee 100644 --- a/unit_tests/test_neutron_ovs_context.py +++ b/unit_tests/test_neutron_ovs_context.py @@ -90,6 +90,7 @@ class OVSPluginContextTest(CharmTestCase): self.relation_ids.return_value = ['rid2'] self.test_relation.set({'neutron-security-groups': True, 'l2-population': True, + 'network-device-mtu': 1500, 'overlay-network-type': 'gre', }) self.get_host_ip.return_value = '127.0.0.15' @@ -100,6 +101,7 @@ class OVSPluginContextTest(CharmTestCase): 'neutron_security_groups': True, 'verbose': True, 'local_ip': '127.0.0.15', + 'network_device_mtu': 1500, 'config': 'neutron.randomconfig', 'use_syslog': True, 'network_manager': 'neutron', @@ -143,6 +145,7 @@ class OVSPluginContextTest(CharmTestCase): self.relation_ids.return_value = ['rid2'] self.test_relation.set({'neutron-security-groups': True, 'l2-population': True, + 'network-device-mtu': 1500, 'overlay-network-type': 'gre', }) self.get_host_ip.return_value = '127.0.0.15' @@ -153,6 +156,7 @@ class OVSPluginContextTest(CharmTestCase): 'neutron_security_groups': False, 'verbose': True, 'local_ip': '127.0.0.15', + 'network_device_mtu': 1500, 'config': 'neutron.randomconfig', 'use_syslog': True, 'network_manager': 'neutron', From 17aac1a67340964b5535d6920d8878c7dc67334d Mon Sep 17 00:00:00 2001 From: Zhang Hua Date: Fri, 5 Dec 2014 13:44:16 +0800 Subject: [PATCH 2/5] add default value for mtu --- hooks/neutron_ovs_context.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hooks/neutron_ovs_context.py b/hooks/neutron_ovs_context.py index 43952c52..33c53bda 100644 --- a/hooks/neutron_ovs_context.py +++ b/hooks/neutron_ovs_context.py @@ -26,6 +26,7 @@ def _neutron_api_settings(): 'neutron_security_groups': False, 'l2_population': True, 'overlay_network_type': 'gre', + 'network_device_mtu': 1500, } for rid in relation_ids('neutron-plugin-api'): for unit in related_units(rid): From 8f5a9fddeb825f56bb1ba55216168c45942f4e77 Mon Sep 17 00:00:00 2001 From: Zhang Hua Date: Thu, 11 Dec 2014 21:28:31 +0800 Subject: [PATCH 3/5] fix KeyError: network-device-mtu --- hooks/neutron_ovs_context.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hooks/neutron_ovs_context.py b/hooks/neutron_ovs_context.py index 33c53bda..f1ea9662 100644 --- a/hooks/neutron_ovs_context.py +++ b/hooks/neutron_ovs_context.py @@ -37,7 +37,8 @@ def _neutron_api_settings(): 'l2_population': rdata['l2-population'], 'neutron_security_groups': rdata['neutron-security-groups'], 'overlay_network_type': rdata['overlay-network-type'], - 'network_device_mtu': rdata['network-device-mtu'], + 'network_device_mtu': rdata['network-device-mtu'] + if 'network-device-mtu' in rdata else 1500, } # Override with configuration if set to true if config('disable-security-groups'): From 0a54cf6557bc18a7e6693f7e0485e8f6c28c420c Mon Sep 17 00:00:00 2001 From: Zhang Hua Date: Thu, 11 Dec 2014 21:54:19 +0800 Subject: [PATCH 4/5] fix hanging indent --- hooks/neutron_ovs_context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/neutron_ovs_context.py b/hooks/neutron_ovs_context.py index f1ea9662..add0e2f8 100644 --- a/hooks/neutron_ovs_context.py +++ b/hooks/neutron_ovs_context.py @@ -38,7 +38,7 @@ def _neutron_api_settings(): 'neutron_security_groups': rdata['neutron-security-groups'], 'overlay_network_type': rdata['overlay-network-type'], 'network_device_mtu': rdata['network-device-mtu'] - if 'network-device-mtu' in rdata else 1500, + if 'network-device-mtu' in rdata else 1500, } # Override with configuration if set to true if config('disable-security-groups'): From a09ac7db32b4b36b75b46a74ed5160cb0411f985 Mon Sep 17 00:00:00 2001 From: Zhang Hua Date: Thu, 11 Dec 2014 21:56:45 +0800 Subject: [PATCH 5/5] E501 line too long --- hooks/neutron_ovs_context.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hooks/neutron_ovs_context.py b/hooks/neutron_ovs_context.py index add0e2f8..669d3db4 100644 --- a/hooks/neutron_ovs_context.py +++ b/hooks/neutron_ovs_context.py @@ -106,7 +106,8 @@ class OVSPluginContext(context.NeutronContext): neutron_api_settings = _neutron_api_settings() ovs_ctxt['neutron_security_groups'] = self.neutron_security_groups ovs_ctxt['l2_population'] = neutron_api_settings['l2_population'] - ovs_ctxt['network_device_mtu'] = neutron_api_settings['network_device_mtu'] + ovs_ctxt['network_device_mtu'] = \ + neutron_api_settings['network_device_mtu'] ovs_ctxt['overlay_network_type'] = \ neutron_api_settings['overlay_network_type'] # TODO: We need to sort out the syslog and debug/verbose options as a