diff --git a/manifests/dpdk.pp b/manifests/dpdk.pp index fae40e32..34f285f5 100644 --- a/manifests/dpdk.pp +++ b/manifests/dpdk.pp @@ -29,6 +29,9 @@ # socket 1 and no allocation for socket 0, the value should be "0,1024" # Defaults to undef. # +# [*disable_emc*] +# (optional) Configure OVS to disable EMC. +# # DEPRECATED PARAMETERS # # [*driver_type*] @@ -42,6 +45,7 @@ class vswitch::dpdk ( $package_ensure = 'present', $pmd_core_list = undef, $socket_mem = undef, + $disable_emc = false, # DEPRECATED PARAMETERS $driver_type = 'vfio-pci', ) { @@ -82,6 +86,14 @@ class vswitch::dpdk ( notify => Vs_config['other_config:dpdk-init'], } + if $disable_emc { + vs_config { 'other_config:emc-insert-inv-prob': + value => '0', + notify => Service['openvswitch'], + wait => false, + } + } + # lint:ignore:quoted_booleans vs_config { 'other_config:dpdk-init': value => 'true', diff --git a/manifests/ovs.pp b/manifests/ovs.pp index f86c923a..072a487a 100644 --- a/manifests/ovs.pp +++ b/manifests/ovs.pp @@ -24,11 +24,15 @@ # Hardware Offload. This feature is # supported from ovs 2.8.0. # Defaults to False. +# +# [*disable_emc*] +# (optional) Configure OVS to disable EMC. class vswitch::ovs( $package_ensure = 'present', $dkms_ensure = false, $enable_hw_offload = false, + $disable_emc = false, ) { include ::vswitch::params @@ -84,6 +88,14 @@ class vswitch::ovs( } # lint:endignore + if $disable_emc { + vs_config { 'other_config:emc-insert-inv-prob': + value => '0', + notify => Service['openvswitch'], + wait => false, + } + } + service { 'openvswitch': ensure => true, enable => true, diff --git a/releasenotes/notes/disable-emc-6562d898d7d560db.yaml b/releasenotes/notes/disable-emc-6562d898d7d560db.yaml new file mode 100644 index 00000000..b1165817 --- /dev/null +++ b/releasenotes/notes/disable-emc-6562d898d7d560db.yaml @@ -0,0 +1,5 @@ +--- +features: + - Added the configuration option to disable Exact Match Cache (EMC). + + diff --git a/spec/classes/vswitch_dpdk_spec.rb b/spec/classes/vswitch_dpdk_spec.rb index 8433d85e..a7f4728a 100644 --- a/spec/classes/vswitch_dpdk_spec.rb +++ b/spec/classes/vswitch_dpdk_spec.rb @@ -27,6 +27,7 @@ describe 'vswitch::dpdk' do params.merge!(:socket_mem => '') params.merge!(:memory_channels => '' ) params.merge!(:pmd_core_list => '') + params.merge!(:disable_emc => false) end it 'configures dpdk options' do is_expected.to contain_vs_config('other_config:dpdk-init').with( @@ -44,6 +45,7 @@ describe 'vswitch::dpdk' do is_expected.to contain_vs_config('other_config:dpdk-extra').with( :value => nil, :wait => false, ) + is_expected.to_not contain_vs_config('other_config:emc-insert-inv-prob') end end @@ -54,6 +56,7 @@ describe 'vswitch::dpdk' do params.merge!(:socket_mem => '1024') params.merge!(:memory_channels => 2) params.merge!(:pmd_core_list => '22,23,24,25,66,67,68,69') + params.merge!(:disable_emc => true) end it 'configures dpdk options' do is_expected.to contain_vs_config('other_config:dpdk-init').with( @@ -71,6 +74,9 @@ describe 'vswitch::dpdk' do is_expected.to contain_vs_config('other_config:dpdk-extra').with( :value => '-n 2', :wait => false, ) + is_expected.to contain_vs_config('other_config:emc-insert-inv-prob').with( + :value => '0', :notify => 'Service[openvswitch]', :wait => false, + ) end end diff --git a/spec/classes/vswitch_ovs_spec.rb b/spec/classes/vswitch_ovs_spec.rb index f2666615..ecdeebd4 100644 --- a/spec/classes/vswitch_ovs_spec.rb +++ b/spec/classes/vswitch_ovs_spec.rb @@ -6,6 +6,7 @@ describe 'vswitch::ovs' do :package_ensure => 'present', :dkms_ensure => false, :enable_hw_offload => false, + :disable_emc => false, } end @@ -48,6 +49,11 @@ describe 'vswitch::ovs' do it 'configures hw-offload option to false' do is_expected.to_not contain_vs_config('other_config:hw-offload') end + + it 'configures disable_emc option to false' do + is_expected.to_not contain_vs_config('other_config:emc-insert-inv-prob') + end + it 'configures service' do is_expected.to contain_service('openvswitch').with( :ensure => true, @@ -73,6 +79,7 @@ describe 'vswitch::ovs' do :package_ensure => 'latest', :dkms_ensure => false, :enable_hw_offload => true, + :disable_emc => true, } end it 'installs correct package' do @@ -87,6 +94,11 @@ describe 'vswitch::ovs' do :value => 'true', :notify => 'Service[openvswitch]', :wait => true, ) end + it 'configures disable_emc option' do + is_expected.to contain_vs_config('other_config:emc-insert-inv-prob').with( + :value => '0', :notify => 'Service[openvswitch]', :wait => false, + ) + end end end