Support dnsmasq_config_file option for dhcp-agent
Allow to configure dnsmasq_config_file for the dhcp-agent. For common things like adapting the MTU size for instances via DHCP. closes-bug #1259495 Change-Id: Iee09eb9a66e84d49c0452fccf9c7d6bcb7ba8311
This commit is contained in:
@@ -38,16 +38,21 @@
|
||||
# CONFIG_NET_NS=y and iproute2 package that supports namespaces).
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*dnsmasq_config_file*]
|
||||
# (optional) Override the default dnsmasq settings with this file.
|
||||
# Defaults to undef
|
||||
#
|
||||
class neutron::agents::dhcp (
|
||||
$package_ensure = present,
|
||||
$enabled = true,
|
||||
$debug = false,
|
||||
$state_path = '/var/lib/neutron',
|
||||
$resync_interval = 30,
|
||||
$interface_driver = 'neutron.agent.linux.interface.OVSInterfaceDriver',
|
||||
$dhcp_driver = 'neutron.agent.linux.dhcp.Dnsmasq',
|
||||
$root_helper = 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf',
|
||||
$use_namespaces = true
|
||||
$package_ensure = present,
|
||||
$enabled = true,
|
||||
$debug = false,
|
||||
$state_path = '/var/lib/neutron',
|
||||
$resync_interval = 30,
|
||||
$interface_driver = 'neutron.agent.linux.interface.OVSInterfaceDriver',
|
||||
$dhcp_driver = 'neutron.agent.linux.dhcp.Dnsmasq',
|
||||
$root_helper = 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf',
|
||||
$use_namespaces = true,
|
||||
$dnsmasq_config_file = undef
|
||||
) {
|
||||
|
||||
include neutron::params
|
||||
@@ -78,6 +83,16 @@ class neutron::agents::dhcp (
|
||||
'DEFAULT/root_helper': value => $root_helper;
|
||||
}
|
||||
|
||||
if $dnsmasq_config_file {
|
||||
neutron_dhcp_agent_config {
|
||||
'DEFAULT/dnsmasq_config_file': value => $dnsmasq_config_file;
|
||||
}
|
||||
} else {
|
||||
neutron_dhcp_agent_config {
|
||||
'DEFAULT/dnsmasq_config_file': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $::neutron::params::dhcp_agent_package {
|
||||
Package['neutron'] -> Package['neutron-dhcp-agent']
|
||||
Package['neutron-dhcp-agent'] -> Neutron_config<||>
|
||||
|
||||
@@ -11,15 +11,16 @@ describe 'neutron::agents::dhcp' do
|
||||
end
|
||||
|
||||
let :default_params do
|
||||
{ :package_ensure => 'present',
|
||||
:enabled => true,
|
||||
:debug => false,
|
||||
:state_path => '/var/lib/neutron',
|
||||
:resync_interval => 30,
|
||||
:interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
|
||||
:dhcp_driver => 'neutron.agent.linux.dhcp.Dnsmasq',
|
||||
:root_helper => 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf',
|
||||
:use_namespaces => true }
|
||||
{ :package_ensure => 'present',
|
||||
:enabled => true,
|
||||
:debug => false,
|
||||
:state_path => '/var/lib/neutron',
|
||||
:resync_interval => 30,
|
||||
:interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
|
||||
:dhcp_driver => 'neutron.agent.linux.dhcp.Dnsmasq',
|
||||
:root_helper => 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf',
|
||||
:use_namespaces => true,
|
||||
:dnsmasq_config_file => nil }
|
||||
end
|
||||
|
||||
|
||||
@@ -66,6 +67,17 @@ describe 'neutron::agents::dhcp' do
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'neutron dhcp agent with dnsmasq_config_file specified' do
|
||||
before do
|
||||
params.merge!(
|
||||
:dnsmasq_config_file => '/foo'
|
||||
)
|
||||
end
|
||||
it 'configures dnsmasq_config_file' do
|
||||
should contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_config_file').with_value(params[:dnsmasq_config_file])
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'dnsmasq dhcp_driver' do
|
||||
it 'installs dnsmasq packages' do
|
||||
if platform_params.has_key?(:dhcp_agent_package)
|
||||
@@ -97,6 +109,7 @@ describe 'neutron::agents::dhcp' do
|
||||
end
|
||||
|
||||
it_configures 'neutron dhcp agent'
|
||||
it_configures 'neutron dhcp agent with dnsmasq_config_file specified'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
@@ -111,5 +124,6 @@ describe 'neutron::agents::dhcp' do
|
||||
end
|
||||
|
||||
it_configures 'neutron dhcp agent'
|
||||
it_configures 'neutron dhcp agent with dnsmasq_config_file specified'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user