From 2da560c8835938f0b7ce2aa68460f6ba1c008f2b Mon Sep 17 00:00:00 2001 From: Robert Starmer Date: Fri, 13 Jun 2014 18:24:36 -0700 Subject: [PATCH] Add network_device_mtu to neutron.conf Already a parameter for L3_agent, but that isn't exactly the right configuration, due to the fact that this parameter is specifically a L2 feature. Added in neutron.conf to set the default MTU for all created networks. Discussion available here: http://lists.openstack.org/pipermail/openstack-dev/2013-October/017033.html https://bugs.launchpad.net/openstack-manuals/+bug/1242534 Added test to validate parameter Fixed mis-spelled parameter in test Added deprecation warninigs to agents/l3.pp Closes-Bug: #1329643 Change-Id: Id8544799855c500f0c871681695db502ab4dc87c --- manifests/agents/l3.pp | 3 +++ manifests/init.pp | 16 ++++++++++++++++ spec/classes/neutron_init_spec.rb | 14 ++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/manifests/agents/l3.pp b/manifests/agents/l3.pp index 10b685cf1..5465d6118 100644 --- a/manifests/agents/l3.pp +++ b/manifests/agents/l3.pp @@ -70,6 +70,7 @@ # [*network_device_mtu*] # (optional) The MTU size for the interfaces managed by the L3 agent # Defaults to undef +# Should be deprecated in the next major release in favor of a global parameter # # [*router_delete_namespaces*] # (optional) namespaces can be deleted cleanly on the host running the L3 agent @@ -117,10 +118,12 @@ } if $network_device_mtu { + warning('The neutron::l3_agent::newtork_device_mtu parameter is deprecated, use neutron::newtork_device_mtu instead.') neutron_l3_agent_config { 'DEFAULT/network_device_mtu': value => $network_device_mtu; } } else { + warning('The neutron::l3_agent::newtork_device_mtu parameter is deprecated, use neutron::newtork_device_mtu instead.') neutron_l3_agent_config { 'DEFAULT/network_device_mtu': ensure => absent; } diff --git a/manifests/init.pp b/manifests/init.pp index 6f63b0f7b..703dd610c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -61,6 +61,10 @@ # This enables redundant DHCP agents for configured networks. # Defaults to 1 # +# [*network_device_mtu*] +# (optional) The MTU size for the interfaces managed by neutron +# Defaults to undef +# # [*allow_bulk*] # (optional) Enable bulk crud operations # Defaults to true @@ -188,6 +192,7 @@ $mac_generation_retries = 16, $dhcp_lease_duration = 86400, $dhcp_agents_per_network = 1, + $network_device_mtu = undef, $allow_bulk = true, $allow_pagination = false, $allow_sorting = false, @@ -317,6 +322,17 @@ } } + if $network_device_mtu { + neutron_config { + 'DEFAULT/network_device_mtu': value => $network_device_mtu; + } + } else { + neutron_config { + 'DEFAULT/network_device_mtu': ensure => absent; + } + } + + if $service_plugins { if is_array($service_plugins) { neutron_config { 'DEFAULT/service_plugins': value => join($service_plugins, ',') } diff --git a/spec/classes/neutron_init_spec.rb b/spec/classes/neutron_init_spec.rb index afe2e1577..5777b0e24 100644 --- a/spec/classes/neutron_init_spec.rb +++ b/spec/classes/neutron_init_spec.rb @@ -110,6 +110,7 @@ should contain_neutron_config('DEFAULT/mac_generation_retries').with_value(16) should contain_neutron_config('DEFAULT/dhcp_lease_duration').with_value(86400) should contain_neutron_config('DEFAULT/dhcp_agents_per_network').with_value(1) + should contain_neutron_config('DEFAULT/network_device_mtu').with_ensure('absent') should contain_neutron_config('DEFAULT/allow_bulk').with_value(true) should contain_neutron_config('DEFAULT/allow_pagination').with_value(false) should contain_neutron_config('DEFAULT/allow_sorting').with_value(false) @@ -323,6 +324,19 @@ end end + + shared_examples_for 'with network_device_mtu defined' do + before do + params.merge!( + :network_device_mtu => 9000 + ) + end + + it do + should contina_neutron_config('DEFAULT/network_device_mtu').with_value(params[:newtork_device_mtu]) + end + end + context 'on Debian platforms' do let :facts do { :osfamily => 'Debian' }