diff --git a/config.yaml b/config.yaml index 59b91a05..4bfedc99 100644 --- a/config.yaml +++ b/config.yaml @@ -127,6 +127,14 @@ options: Comma-separated list of key=value config flags with the additional dhcp options for neutron dnsmasq. Note, this option is only valid when enable-local-dhcp-and-metadata option is set to True. + instance-mtu: + type: int + default: + description: | + Configure DHCP services to provide MTU configuration to instances + within the cloud. This is useful in deployments where its not + possible to increase MTU on switches and physical servers to + accommodate the packet overhead of using GRE tunnels. dns-servers: type: string default: diff --git a/hooks/neutron_ovs_context.py b/hooks/neutron_ovs_context.py index 498b8e1f..a9519483 100644 --- a/hooks/neutron_ovs_context.py +++ b/hooks/neutron_ovs_context.py @@ -222,6 +222,8 @@ class DHCPAgentContext(OSContextGenerator): if neutron_api_settings.get('dns_domain'): ctxt['dns_domain'] = neutron_api_settings.get('dns_domain') + ctxt['instance_mtu'] = config('instance-mtu') + return ctxt diff --git a/templates/dnsmasq.conf b/templates/dnsmasq.conf index a7d8e928..48a5c032 100644 --- a/templates/dnsmasq.conf +++ b/templates/dnsmasq.conf @@ -1,3 +1,6 @@ +{%- if instance_mtu -%} +dhcp-option=26,{{ instance_mtu }} +{% endif -%} {% if dnsmasq_flags -%} {% for key, value in dnsmasq_flags.items() -%} {{ key }} = {{ value }} diff --git a/unit_tests/test_neutron_ovs_context.py b/unit_tests/test_neutron_ovs_context.py index caa09fb0..bcabd33b 100644 --- a/unit_tests/test_neutron_ovs_context.py +++ b/unit_tests/test_neutron_ovs_context.py @@ -294,6 +294,7 @@ class DHCPAgentContextTest(CharmTestCase): self.assertEqual( context.DHCPAgentContext()(), {'dns_domain': 'openstack.example.', + 'instance_mtu': None, 'dns_servers': None} ) self.relation_ids.assert_called_with('neutron-plugin') @@ -325,6 +326,7 @@ class DHCPAgentContextTest(CharmTestCase): context.DHCPAgentContext()(), {'availability_zone': 'nova', 'dns_domain': 'openstack.example.', + 'instance_mtu': None, 'dns_servers': '8.8.8.8,4.4.4.4'} ) self.relation_ids.assert_called_with('neutron-plugin') @@ -354,6 +356,7 @@ class DHCPAgentContextTest(CharmTestCase): self.assertEqual( context.DHCPAgentContext()(), {'availability_zone': 'nova', + 'instance_mtu': None, 'dns_servers': '8.8.8.8'} ) self.relation_ids.assert_called_with('neutron-plugin') @@ -390,6 +393,7 @@ class DHCPAgentContextTest(CharmTestCase): 'dhcp-match': 'set:ipxe,175', 'server': '1.2.3.4', }, + 'instance_mtu': None, 'dns_servers': None, } )