Provide option to disable EMC in puppet-vswitch

This patch disables EMC by setting emc-insert-inv-prob to 0.

Change-Id: I02dc94dbf4d9cee365b230a82dd5d5616d21406b
Closes-Bug: #1821821
This commit is contained in:
Yogananth Subramanian 2019-03-27 05:45:35 +05:30
parent d9a54416f9
commit 97eb675dcc
5 changed files with 47 additions and 0 deletions

View File

@ -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',

View File

@ -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,

View File

@ -0,0 +1,5 @@
---
features:
- Added the configuration option to disable Exact Match Cache (EMC).

View File

@ -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

View File

@ -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