diff --git a/manifests/dpdk.pp b/manifests/dpdk.pp index 1013e46c..da01bcd4 100644 --- a/manifests/dpdk.pp +++ b/manifests/dpdk.pp @@ -58,6 +58,26 @@ # (Optional) Enable TSO support. # Defaults to false. # +# [*pmd_auto_lb*] +# (Optional) Configures PMD Auto Load Balancing +# Defaults to false. +# +# [*pmd_auto_lb_rebal_interval*] +# (Optional) The minimum time (in minutes) 2 consecutive PMD Auto Load +# Balancing iterations. +# Defaults to undef. +# +# [*pmd_auto_lb_load_threshold*] +# (Optional) Specifies the minimum PMD thread load threshold of any +# non-isolated PMD threads when a PMD Auto Load Balance may be triggered. +# Defaults to undef. +# +# [*pmd_auto_lb_improvement_threshold*] +# (Optional) Specifies the minimum evaluated % improvement in load +# distribution across the non-isolated PMD threads that will allow a PMD Auto +# Load Balance to occur. +# Defaults to undef. +# # [*vs_config*] # (optional) allow configuration of arbitrary vswitch configurations. # The value is an hash of vs_config resources. Example: @@ -66,25 +86,30 @@ # or Puppet catalog compilation will fail with duplicate resources. # class vswitch::dpdk ( - $memory_channels = undef, - $host_core_list = undef, - $package_ensure = 'present', - $pmd_core_list = undef, - $socket_mem = undef, - $socket_limit = undef, - $enable_hw_offload = false, - $disable_emc = false, - $vlan_limit = undef, - $revalidator_cores = undef, - $handler_cores = undef, - $enable_tso = false, - $vs_config = {}, + $memory_channels = undef, + $host_core_list = undef, + $package_ensure = 'present', + $pmd_core_list = undef, + $socket_mem = undef, + $socket_limit = undef, + $enable_hw_offload = false, + $disable_emc = false, + $vlan_limit = undef, + $revalidator_cores = undef, + $handler_cores = undef, + $enable_tso = false, + $pmd_auto_lb = false, + $pmd_auto_lb_rebal_interval = undef, + $pmd_auto_lb_load_threshold = undef, + $pmd_auto_lb_improvement_threshold = undef, + $vs_config = {}, ) { include vswitch::params validate_legacy(Boolean, 'validate_bool', $enable_hw_offload) validate_legacy(Boolean, 'validate_bool', $disable_emc) validate_legacy(Boolean, 'validate_bool', $enable_tso) + validate_legacy(Boolean, 'validate_bool', $pmd_auto_lb) validate_legacy(Hash, 'validate_hash', $vs_config) kmod::load { 'vfio-pci': } @@ -174,6 +199,57 @@ class vswitch::dpdk ( } } + if $pmd_auto_lb { + vs_config { 'other_config:pmd-auto-lb': + value => true, + wait => false, + } + + if $pmd_auto_lb_rebal_interval { + vs_config { 'other_config:pmd-auto-lb-rebal-interval': + value => $pmd_auto_lb_rebal_interval, + wait => false; + } + } else { + vs_config { 'other_config:pmd-auto-lb-rebal-interval': + ensure => absent, + wait => false, + } + } + + if $pmd_auto_lb_load_threshold { + vs_config { 'other_config:pmd-auto-lb-load-threshold': + value => $pmd_auto_lb_load_threshold, + wait => false + } + } else { + vs_config { 'other_config:pmd-auto-lb-load-threshold': + ensure => absent, + wait => false + } + } + + if $pmd_auto_lb_improvement_threshold { + vs_config { 'other_config:pmd-auto-lb-improvement-threshold': + value => $pmd_auto_lb_improvement_threshold, + wait => false + } + } else { + vs_config { 'other_config:pmd-auto-lb-improvement-threshold': + ensure => absent, + wait => false + } + } + + } else { + vs_config { + 'other_config:pmd-auto-lb': ensure => absent, wait => false; + 'other_config:pmd-auto-lb-rebal-interval': ensure => absent, wait => false; + 'other_config:pmd-auto-lb-load-threshold': ensure => absent, wait => false; + 'other_config:pmd-auto-lb-improvement-threshold': ensure => absent, wait => false; + } + } + vs_config { 'other_config:dpdk-init': value => true, wait => true, diff --git a/releasenotes/notes/pmd-auto-lb-2cc96b8c12678785.yaml b/releasenotes/notes/pmd-auto-lb-2cc96b8c12678785.yaml new file mode 100644 index 00000000..b513b468 --- /dev/null +++ b/releasenotes/notes/pmd-auto-lb-2cc96b8c12678785.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + The ``vswitch::dpdk`` class now supports the following parameters to enable + and tune PMD Auto Balancing feature. + + - ``pmd_auto_lb`` + - ``pmd_auto_lb_rebal_interval`` + - ``pmd_auto_lb_load_threshold`` + - ``pmd_auto_lb_improvement_threshold`` diff --git a/spec/classes/vswitch_dpdk_spec.rb b/spec/classes/vswitch_dpdk_spec.rb index a71b6cff..4f02867e 100644 --- a/spec/classes/vswitch_dpdk_spec.rb +++ b/spec/classes/vswitch_dpdk_spec.rb @@ -62,6 +62,18 @@ describe 'vswitch::dpdk' do is_expected.to contain_vs_config('other_config:userspace-tso-enable').with( :ensure => 'absent', :wait => false, ) + is_expected.to contain_vs_config('other_config:pmd-auto-lb').with( + :ensure => 'absent', :wait => false, + ) + is_expected.to contain_vs_config('other_config:pmd-auto-lb-rebal-interval').with( + :ensure => 'absent', :wait => false, + ) + is_expected.to contain_vs_config('other_config:pmd-auto-lb-load-threshold').with( + :ensure => 'absent', :wait => false, + ) + is_expected.to contain_vs_config('other_config:pmd-auto-lb-improvement-threshold').with( + :ensure => 'absent', :wait => false, + ) end it 'restarts the service when needed' do is_expected.to contain_exec('restart openvswitch').with( @@ -74,15 +86,21 @@ describe 'vswitch::dpdk' do context 'when passing all params' do before :each do - params.merge!(:host_core_list => '1,2') - params.merge!(:socket_mem => '1024,1024') - params.merge!(:socket_limit => '2048,2048') - params.merge!(:memory_channels => 2) - params.merge!(:pmd_core_list => '22,23,24,25,66,67,68,69') - params.merge!(:enable_hw_offload => true) - params.merge!(:disable_emc => true) - params.merge!(:vlan_limit => 2) - params.merge!(:enable_tso => true) + params.merge!({ + :host_core_list => '1,2', + :socket_mem => '1024,1024', + :socket_limit => '2048,2048', + :memory_channels => 2, + :pmd_core_list => '22,23,24,25,66,67,68,69', + :enable_hw_offload => true, + :disable_emc => true, + :vlan_limit => 2, + :enable_tso => true, + :pmd_auto_lb => true, + :pmd_auto_lb_rebal_interval => 1, + :pmd_auto_lb_load_threshold => 95, + :pmd_auto_lb_improvement_threshold => 25, + }) end it 'configures dpdk options' do is_expected.to contain_vs_config('other_config:dpdk-init').with( @@ -115,6 +133,18 @@ describe 'vswitch::dpdk' do is_expected.to contain_vs_config('other_config:userspace-tso-enable').with( :value => true, :wait => false, ) + is_expected.to contain_vs_config('other_config:pmd-auto-lb').with( + :value => true, :wait => false, + ) + is_expected.to contain_vs_config('other_config:pmd-auto-lb-rebal-interval').with( + :value => 1, :wait => false, + ) + is_expected.to contain_vs_config('other_config:pmd-auto-lb-load-threshold').with( + :value => 95, :wait => false, + ) + is_expected.to contain_vs_config('other_config:pmd-auto-lb-improvement-threshold').with( + :value => 25, :wait => false, + ) end end