Add configuration option to support additional dnsmasq flags.

This commit is contained in:
James Page 2015-11-20 09:19:09 +00:00
commit 00a624d5e8
4 changed files with 22 additions and 0 deletions

View File

@ -128,6 +128,12 @@ options:
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.
dnsmasq-flags:
type: string
default:
description: |
Comma-separated list of key=value config flags with the additional
dhcp options for neutron dnsmasq.
enable-l3-agent:
type: boolean
default: True

View File

@ -13,6 +13,7 @@ from charmhelpers.fetch import (
from charmhelpers.contrib.openstack.context import (
OSContextGenerator,
NeutronAPIContext,
config_flags_parser
)
from charmhelpers.contrib.openstack.utils import (
get_os_codename_install_source
@ -154,6 +155,10 @@ class NeutronGatewayContext(NeutronAPIContext):
if vlan_ranges:
ctxt['vlan_ranges'] = ','.join(vlan_ranges.split())
dnsmasq_flags = config('dnsmasq-flags')
if dnsmasq_flags:
ctxt['dnsmasq_flags'] = config_flags_parser(dnsmasq_flags)
net_dev_mtu = api_settings['network_device_mtu']
if net_dev_mtu:
ctxt['network_device_mtu'] = net_dev_mtu

View File

@ -1,3 +1,8 @@
{%- if instance_mtu -%}
dhcp-option=26,{{ instance_mtu }}
{% endif -%}
{% if dnsmasq_flags -%}
{% for key, value in dnsmasq_flags.iteritems() -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}

View File

@ -123,6 +123,8 @@ class TestNeutronGatewayContext(CharmTestCase):
self.test_config.set('debug', False)
self.test_config.set('verbose', True)
self.test_config.set('instance-mtu', 1420)
self.test_config.set('dnsmasq-flags', 'dhcp-userclass=set:ipxe,iPXE,'
'dhcp-match=set:ipxe,175')
self.test_config.set('vlan-ranges',
'physnet1:1000:2000 physnet2:2001:3000')
self.test_config.set('flat-network-providers', 'physnet3 physnet4')
@ -152,6 +154,10 @@ class TestNeutronGatewayContext(CharmTestCase):
'vlan_ranges': 'physnet1:1000:2000,physnet2:2001:3000',
'network_device_mtu': 9000,
'veth_mtu': 9000,
'dnsmasq_flags': {
'dhcp-userclass': 'set:ipxe,iPXE',
'dhcp-match': 'set:ipxe,175'
}
})