Added config option for the additional dnsmasq flags

This commit is contained in:
Ionut Balutoiu 2015-11-17 15:46:49 +02:00
parent 76074ea8c1
commit ebec1a4119
4 changed files with 27 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

@ -17,6 +17,7 @@ TO_PATCH = [
'eligible_leader',
'get_os_codename_install_source',
'unit_get',
'config_flags_parser'
]
@ -123,6 +124,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')
@ -131,6 +134,10 @@ class TestNeutronGatewayContext(CharmTestCase):
_runits.return_value = ['neutron-api/0']
_rget.side_effect = lambda *args, **kwargs: rdata
self.get_os_codename_install_source.return_value = 'folsom'
self.config_flags_parser.return_value = {
'dhcp-userclass': 'set:ipxe,iPXE',
'dhcp-match': 'set:ipxe,175'
}
_host_ip.return_value = '10.5.0.1'
_secret.return_value = 'testsecret'
ctxt = neutron_contexts.NeutronGatewayContext()()
@ -152,6 +159,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'
}
})