Add instance-mtu config opt

This brings this charm inline with the neutron-gateway charm
in terms of configurability when using a local dhcp agent.

Change-Id: Idc4f7735aaa9236d8a476fd3bae6aaf52b9dc043
Closes-Bug: 1777888
This commit is contained in:
Edward Hope-Morley 2018-06-20 15:13:25 +01:00
parent 5f40de5527
commit 9e1018bcfb
4 changed files with 17 additions and 0 deletions

View File

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

View File

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

View File

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

View File

@ -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,
}
)