From e5fa32b1da33fdd3d59eb45e62ef77b0414eee95 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 18 Feb 2014 19:43:42 +0100 Subject: [PATCH] network/dhcp: templatize dnsmasq configuration The only way I found to fix the MTU configuration is to use DHCP. To do that, we need to configure Neutron DHCP Agent and create a dedicated file. This file has been introduced as a new template. Close bug #270 Signed-off-by: Emilien Macchi --- manifests/network/dhcp.pp | 15 ++++++++++++++- spec/classes/cloud_network_dhcp_spec.rb | 12 +++++++++++- templates/network/dnsmasq-neutron.conf.erb | 1 + 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 templates/network/dnsmasq-neutron.conf.erb diff --git a/manifests/network/dhcp.pp b/manifests/network/dhcp.pp index 365b156d..e891a22c 100644 --- a/manifests/network/dhcp.pp +++ b/manifests/network/dhcp.pp @@ -17,7 +17,8 @@ # class cloud::network::dhcp( - $debug = $os_params::debug + $veth_mtu = $os_params::veth_mtu, + $debug = $os_params::debug ) { include 'cloud::network' @@ -26,4 +27,16 @@ class cloud::network::dhcp( debug => $debug } + neutron_dhcp_agent_config { + 'DEFAULT/dnsmasq_config_file': value => '/etc/neutron/dnsmasq-neutron.conf'; + } + + file { '/etc/neutron/dnsmasq-neutron.conf': + content => template('cloud/network/dnsmasq-neutron.conf.erb'), + owner => 'root', + mode => '0755', + group => 'root', + notify => Service['neutron-dhcp-agent'] + } + } diff --git a/spec/classes/cloud_network_dhcp_spec.rb b/spec/classes/cloud_network_dhcp_spec.rb index b78aed76..49a1a33a 100644 --- a/spec/classes/cloud_network_dhcp_spec.rb +++ b/spec/classes/cloud_network_dhcp_spec.rb @@ -37,7 +37,8 @@ describe 'cloud::network::dhcp' do end let :params do - { :debug => true } + { :veth_mtu => '1400', + :debug => true } end it 'configure neutron common' do @@ -77,6 +78,15 @@ describe 'cloud::network::dhcp' do should contain_class('neutron::agents::dhcp').with( :debug => true ) + + should contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_config_file').with_value('/etc/neutron/dnsmasq-neutron.conf') + + should contain_file('/etc/neutron/dnsmasq-neutron.conf').with( + :mode => '0755', + :owner => 'root', + :group => 'root' + ) + verify_contents(subject, '/etc/neutron/dnsmasq-neutron.conf', ["dhcp-options-force=26,1400"]) end end diff --git a/templates/network/dnsmasq-neutron.conf.erb b/templates/network/dnsmasq-neutron.conf.erb new file mode 100644 index 00000000..d18d9671 --- /dev/null +++ b/templates/network/dnsmasq-neutron.conf.erb @@ -0,0 +1 @@ +dhcp-options-force=26,<%= @veth_mtu %>