diff --git a/manifests/init.pp b/manifests/init.pp index 5ede77778..8e658cc88 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -75,6 +75,10 @@ # (optional) Allow sending resource operation notification to DHCP agent. # Defaults to true # +# [*advertise_mtu*] +# (optional) VMs will receive DHCP and RA MTU option when the network's preferred MTU is known +# Defaults to false +# # [*allow_bulk*] # (optional) Enable bulk crud operations # Defaults to true @@ -245,6 +249,7 @@ class neutron ( $dhcp_agents_per_network = 1, $network_device_mtu = undef, $dhcp_agent_notification = true, + $advertise_mtu = false, $allow_bulk = true, $allow_pagination = false, $allow_sorting = false, @@ -359,6 +364,7 @@ class neutron ( 'DEFAULT/dhcp_lease_duration': value => $dhcp_lease_duration; 'DEFAULT/dhcp_agents_per_network': value => $dhcp_agents_per_network; 'DEFAULT/dhcp_agent_notification': value => $dhcp_agent_notification; + 'DEFAULT/advertise_mtu': value => $advertise_mtu; 'DEFAULT/allow_bulk': value => $allow_bulk; 'DEFAULT/allow_pagination': value => $allow_pagination; 'DEFAULT/allow_sorting': value => $allow_sorting; diff --git a/manifests/plugins/ml2.pp b/manifests/plugins/ml2.pp index b99b8deb0..4a93ebeb9 100644 --- a/manifests/plugins/ml2.pp +++ b/manifests/plugins/ml2.pp @@ -100,6 +100,17 @@ # and if admin state management is desired. # Defaults to false. # +# [*physical_network_mtus*] +# (optional) For L2 mechanism drivers, per-physical network MTU setting. +# Should be an array with 'physnetX1:9000'. +# Defaults to undef. +# +# [*path_mtu*] +# (optional) For L3 mechanism drivers, determines the maximum permissible +# size of an unfragmented packet travelling from and to addresses where +# encapsulated traffic is sent. +# Defaults to 0. +# class neutron::plugins::ml2 ( $type_drivers = ['local', 'flat', 'vlan', 'gre', 'vxlan'], @@ -114,6 +125,8 @@ class neutron::plugins::ml2 ( $package_ensure = 'present', $supported_pci_vendor_devs = ['15b3:1004', '8086:10ca'], $sriov_agent_required = false, + $physical_network_mtus = undef, + $path_mtu = 0, ) { include ::neutron::params @@ -183,9 +196,21 @@ class neutron::plugins::ml2 ( 'ml2/type_drivers': value => join($type_drivers, ','); 'ml2/tenant_network_types': value => join($tenant_network_types, ','); 'ml2/mechanism_drivers': value => join($mechanism_drivers, ','); + 'ml2/path_mtu': value => $path_mtu; 'securitygroup/enable_security_group': value => $enable_security_group; } + if empty($physical_network_mtus) { + neutron_plugin_ml2 { + 'ml2/physical_network_mtus': ensure => absent; + } + } else { + validate_array($physical_network_mtus) + neutron_plugin_ml2 { + 'ml2/physical_network_mtus': value => join($physical_network_mtus, ','); + } + } + Neutron_plugin_ml2<||> ~> Exec<| title == 'neutron-db-sync' |> } diff --git a/spec/classes/neutron_init_spec.rb b/spec/classes/neutron_init_spec.rb index 5f73459bf..af56a2b26 100644 --- a/spec/classes/neutron_init_spec.rb +++ b/spec/classes/neutron_init_spec.rb @@ -131,6 +131,7 @@ describe 'neutron' do is_expected.to contain_neutron_config('DEFAULT/dhcp_agents_per_network').with_value(1) is_expected.to contain_neutron_config('DEFAULT/network_device_mtu').with_ensure('absent') is_expected.to contain_neutron_config('DEFAULT/dhcp_agent_notification').with_value(true) + is_expected.to contain_neutron_config('DEFAULT/advertise_mtu').with_value(false) is_expected.to contain_neutron_config('DEFAULT/allow_bulk').with_value(true) is_expected.to contain_neutron_config('DEFAULT/allow_pagination').with_value(false) is_expected.to contain_neutron_config('DEFAULT/allow_sorting').with_value(false) @@ -450,6 +451,18 @@ describe 'neutron' do end end + shared_examples_for 'with advertise_mtu defined' do + before do + params.merge!( + :advertise_mtu => true + ) + end + + it do + is_expected.to contain_neutron_config('DEFAULT/advertise_mtu').with_value(params[:advertise_mtu]) + end + end + context 'on Debian platforms' do let :facts do default_facts.merge({ :osfamily => 'Debian' }) diff --git a/spec/classes/neutron_plugins_ml2_spec.rb b/spec/classes/neutron_plugins_ml2_spec.rb index f1b507355..49395b7f5 100644 --- a/spec/classes/neutron_plugins_ml2_spec.rb +++ b/spec/classes/neutron_plugins_ml2_spec.rb @@ -37,6 +37,8 @@ describe 'neutron::plugins::ml2' do :tunnel_id_ranges => ['20:100'], :vxlan_group => '224.0.0.1', :vni_ranges => ['10:100'], + :path_mtu => '0', + :physical_network_mtus => '', :package_ensure => 'present' } end @@ -65,6 +67,8 @@ describe 'neutron::plugins::ml2' do is_expected.to contain_neutron_plugin_ml2('ml2/type_drivers').with_value(p[:type_drivers].join(',')) is_expected.to contain_neutron_plugin_ml2('ml2/tenant_network_types').with_value(p[:tenant_network_types].join(',')) is_expected.to contain_neutron_plugin_ml2('ml2/mechanism_drivers').with_value(p[:mechanism_drivers].join(',')) + is_expected.to contain_neutron_plugin_ml2('ml2/path_mtu').with_value(p[:path_mtu]) + is_expected.to contain_neutron_plugin_ml2('ml2/physical_network_mtus').with_ensure('absent') end it 'creates plugin symbolic link' do @@ -170,6 +174,26 @@ describe 'neutron::plugins::ml2' do it_raises 'a Puppet::Error', /vni ranges are invalid./ end + context 'with path_mtu set' do + before :each do + params.merge!(:path_mtu => '9000') + end + + it 'should set the path_mtu on the ml2 plugin' do + is_expected.to contain_neutron_plugin_ml2('ml2/path_mtu').with_value(p[:path_mtu]) + end + end + + context 'with physical_network_mtus set' do + before :each do + params.merge!(:physical_network_mtus => ['physnet1:9000']) + end + + it 'should set the physical_network_mtus on the ml2 plugin' do + is_expected.to contain_neutron_plugin_ml2('ml2/physical_network_mtus').with_value(p[:physical_network_mtus].join(',')) + end + end + context 'when overriding package ensure state' do before :each do params.merge!(:package_ensure => 'latest')