dpdk: Allow Debian OS family

We've been limiting dpdk support to RHEL family but we don't have any
specific reasons to do so.

Change-Id: I0e97f00df57a7f8d35b8941c1a6a5309f25852ff
This commit is contained in:
Takashi Kajinami
2023-10-15 01:41:46 +09:00
parent ec83ceaf4e
commit 91231c2eea
4 changed files with 32 additions and 54 deletions

View File

@@ -124,10 +124,6 @@ class vswitch::dpdk (
kmod::load { 'vfio-pci': } kmod::load { 'vfio-pci': }
if $facts['os']['family'] != 'Redhat' {
fail( "${facts['os']['family']} not yet supported for dpdk installation by puppet-vswitch")
}
package { $::vswitch::params::ovs_dpdk_package_name: package { $::vswitch::params::ovs_dpdk_package_name:
ensure => $package_ensure, ensure => $package_ensure,
before => Service['openvswitch'], before => Service['openvswitch'],

View File

@@ -0,0 +1,4 @@
---
features:
- |
The ``vswitch::dpdk`` class now supports Debian OS family.

View File

@@ -2,35 +2,8 @@ require 'spec_helper'
describe 'vswitch::dpdk' do describe 'vswitch::dpdk' do
let :default_params do { shared_examples_for 'vswitch::dpdk' do
:package_ensure => 'present',
}
end
shared_examples_for 'vswitch::dpdk on Debian' do
let(:params) { default_params }
context 'basic parameters' do
before :each do
params.merge!(:host_core_list => '1,2')
end
it_raises 'a Puppet::Error', /Debian not yet supported for dpdk/
end
end
shared_examples_for 'vswitch::dpdk on RedHat' do
let(:params) { default_params }
context 'when passing all empty params' do context 'when passing all empty params' do
before :each do
params.merge!(:host_core_list => '')
params.merge!(:socket_mem => '')
params.merge!(:socket_limit => '')
params.merge!(:memory_channels => '' )
params.merge!(:pmd_core_list => '')
params.merge!(:enable_hw_offload => false)
params.merge!(:disable_emc => false)
end
it 'configures dpdk options' do it 'configures dpdk options' do
is_expected.to contain_vs_config('other_config:dpdk-init').with( is_expected.to contain_vs_config('other_config:dpdk-init').with(
:value => true, :wait => true, :restart => true, :value => true, :wait => true, :restart => true,
@@ -78,6 +51,23 @@ describe 'vswitch::dpdk' do
:ensure => 'absent', :wait => false, :ensure => 'absent', :wait => false,
) )
end end
it 'configures service' do
is_expected.to contain_service('openvswitch').with(
:ensure => true,
:enable => true,
:name => platform_params[:ovs_service_name],
)
end
it 'install package' do
is_expected.to contain_package(platform_params[:ovs_dpdk_package_name]).with(
:name => platform_params[:ovs_dpdk_package_name],
:ensure => 'present',
:before => 'Service[openvswitch]'
)
end
it 'restarts the service when needed' do it 'restarts the service when needed' do
is_expected.to contain_exec('restart openvswitch').with( is_expected.to contain_exec('restart openvswitch').with(
:path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'], :path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
@@ -88,8 +78,8 @@ describe 'vswitch::dpdk' do
end end
context 'when passing all params' do context 'when passing all params' do
before :each do let :params do
params.merge!({ {
:host_core_list => '1,2', :host_core_list => '1,2',
:socket_mem => '1024,1024', :socket_mem => '1024,1024',
:socket_limit => '2048,2048', :socket_limit => '2048,2048',
@@ -104,7 +94,7 @@ describe 'vswitch::dpdk' do
:pmd_auto_lb_rebal_interval => 1, :pmd_auto_lb_rebal_interval => 1,
:pmd_auto_lb_load_threshold => 95, :pmd_auto_lb_load_threshold => 95,
:pmd_auto_lb_improvement_threshold => 25, :pmd_auto_lb_improvement_threshold => 25,
}) }
end end
it 'configures dpdk options' do it 'configures dpdk options' do
is_expected.to contain_vs_config('other_config:dpdk-init').with( is_expected.to contain_vs_config('other_config:dpdk-init').with(
@@ -156,11 +146,11 @@ describe 'vswitch::dpdk' do
end end
context 'when passing arrays' do context 'when passing arrays' do
before :each do let :params do
params.merge!({ {
:socket_mem => [1024, 1024], :socket_mem => [1024, 1024],
:socket_limit => [2048, 2048], :socket_limit => [2048, 2048],
}) }
end end
it 'configures dpdk options with comma-separated lists' do it 'configures dpdk options with comma-separated lists' do
@@ -186,18 +176,17 @@ describe 'vswitch::dpdk' do
case facts[:os]['family'] case facts[:os]['family']
when 'Debian' when 'Debian'
{ {
# not supported :ovs_dpdk_package_name => 'openvswitch-switch-dpdk',
:ovs_service_name => 'openvswitch-switch',
} }
when 'RedHat' when 'RedHat'
{ {
:ovs_dpdk_package_name => 'openvswitch', :ovs_dpdk_package_name => 'openvswitch',
:ovs_service_name => 'openvswitch', :ovs_service_name => 'openvswitch',
:provider => 'ovs_redhat',
:ovsdb_service_name => 'ovsdb-server',
} }
end end
end end
it_behaves_like "vswitch::dpdk on #{facts[:os]['family']}" it_behaves_like "vswitch::dpdk"
end end
end end
end end

View File

@@ -2,16 +2,8 @@ require 'spec_helper'
describe 'vswitch::ovs' do describe 'vswitch::ovs' do
let :default_params do {
:package_ensure => 'present',
:enable_hw_offload => false,
:disable_emc => false,
}
end
shared_examples_for 'vswitch::ovs' do shared_examples_for 'vswitch::ovs' do
context 'default parameters' do context 'default parameters' do
let (:params) { default_params }
it 'contains the ovs class' do it 'contains the ovs class' do
is_expected.to contain_class('vswitch::ovs') is_expected.to contain_class('vswitch::ovs')
@@ -50,7 +42,7 @@ describe 'vswitch::ovs' do
it 'install package' do it 'install package' do
is_expected.to contain_package(platform_params[:ovs_package_name]).with( is_expected.to contain_package(platform_params[:ovs_package_name]).with(
:name => platform_params[:ovs_package_name], :name => platform_params[:ovs_package_name],
:ensure => params[:package_ensure], :ensure => 'present',
:before => 'Service[openvswitch]' :before => 'Service[openvswitch]'
) )
end end
@@ -114,20 +106,17 @@ describe 'vswitch::ovs' do
{ {
:ovs_package_name => 'openvswitch-switch', :ovs_package_name => 'openvswitch-switch',
:ovs_service_name => 'openvswitch-switch', :ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
} }
elsif facts[:os]['name'] == 'Ubuntu' elsif facts[:os]['name'] == 'Ubuntu'
{ {
:ovs_package_name => 'openvswitch-switch', :ovs_package_name => 'openvswitch-switch',
:ovs_service_name => 'openvswitch-switch', :ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
} }
end end
when 'RedHat' when 'RedHat'
{ {
:ovs_package_name => 'openvswitch', :ovs_package_name => 'openvswitch',
:ovs_service_name => 'openvswitch', :ovs_service_name => 'openvswitch',
:provider => 'ovs_redhat',
} }
end end
end end