Remvoved OvS2.5 specific changes as it is no longer required

In pike release, we have migrated manifests from ovs2.5 to ovs2.6 and
retained the backward compatibility. Removing the ovs2.5 changes
in this cycle as it is no longer used.

Change-Id: I286b2f4d090dda34ec95f24f77baefcb7687ff85
This commit is contained in:
Saravanan KR 2017-12-06 17:20:58 +05:30
parent 146cdb1e8e
commit 3d91514806
2 changed files with 23 additions and 155 deletions

View File

@ -6,11 +6,6 @@
# [*memory_channels*]
# (optional) The number of memory channels to use as an integer.
#
# [*driver_type*]
# (Optional) The DPDK Driver type
# Defaults to 'vfio-pci'
# This parameter is required only for OVS versions <= 2.5.
#
# [*host_core_list*]
# (optional) The list of cores to be used by the lcore threads.
# The host_core_list is a string with format as <c1>[-c2][,c3[-c4],...]
@ -34,13 +29,21 @@
# socket 1 and no allocation for socket 0, the value should be "0,1024"
# Defaults to undef.
#
# DEPRECATED PARAMETERS
#
# [*driver_type*]
# (Optional) The DPDK Driver type
# Defaults to 'vfio-pci'
# This parameter is required only for OVS versions <= 2.5.
#
class vswitch::dpdk (
$memory_channels = undef,
$driver_type = 'vfio-pci',
$host_core_list = undef,
$package_ensure = 'present',
$pmd_core_list = undef,
$socket_mem = undef,
# DEPRECATED PARAMETERS
$driver_type = 'vfio-pci',
) {
include ::vswitch::params
@ -56,37 +59,6 @@ class vswitch::dpdk (
tag => 'openvswitch',
}
# DEPRECATED support for OVS 2.5
# DPDK_OPTIONS is no longer used in ovs 2.6, since it was a distribution
# specific hack to the ovs-ctl scripts. Instead dpdk information is
# pulled from the ovsdb.
if $socket_mem and !empty($socket_mem) {
unless $socket_mem =~ /^(\d+\,?)+$/ {
fail( 'socket_mem is in incorrect format')
}
$socket_string = "--socket-mem ${socket_mem}"
}
else {
$socket_string = undef
}
if $driver_type {
$pci_list = inline_template('<%= Facter.value("pci_address_driver_#@driver_type") %>')
if empty($pci_list) {
$white_list = undef
}
else {
$white_list = inline_template('-w <%= @pci_list.gsub(",", " -w ") %>')
}
}
$options = "DPDK_OPTIONS = \"-l ${host_core_list} -n ${memory_channels} ${socket_string} ${white_list}\""
file_line { '/etc/sysconfig/openvswitch':
path => '/etc/sysconfig/openvswitch',
match => '^DPDK_OPTIONS.*',
line => $options,
require => Package[$::vswitch::params::ovs_dpdk_package_name],
before => Service['openvswitch'],
}
$pmd_core_mask = range_to_mask($pmd_core_list)
$dpdk_lcore_mask = range_to_mask($host_core_list)
@ -98,9 +70,9 @@ class vswitch::dpdk (
}
$dpdk_configs = {
'other_config:dpdk-extra' => { value => $memory_channels_conf, skip_if_version => '2.5'},
'other_config:dpdk-socket-mem' => { value => $socket_mem, skip_if_version => '2.5'},
'other_config:dpdk-lcore-mask' => { value => $dpdk_lcore_mask, skip_if_version => '2.5'},
'other_config:dpdk-extra' => { value => $memory_channels_conf},
'other_config:dpdk-socket-mem' => { value => $socket_mem},
'other_config:dpdk-lcore-mask' => { value => $dpdk_lcore_mask},
'other_config:pmd-cpu-mask' => { value => $pmd_core_mask},
}
@ -111,10 +83,9 @@ class vswitch::dpdk (
}
vs_config { 'other_config:dpdk-init':
value => 'true',
skip_if_version => '2.5',
require => Service['openvswitch'],
wait => true,
value => 'true',
require => Service['openvswitch'],
wait => true,
}
service { 'openvswitch':

View File

@ -20,54 +20,6 @@ describe 'vswitch::dpdk' do
shared_examples_for 'vswitch::dpdk on RedHat' do
let(:params) { default_params }
context 'shall write DPDK_OPTIONS as well as ovsdb params' do
it 'include the class' do
is_expected.to contain_class('vswitch::dpdk')
end
it 'contains params' do
is_expected.to contain_class('vswitch::params')
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 => params[:package_ensure],
:before => 'Service[openvswitch]',
)
end
it 'should have dpdk driver modules file' do
is_expected.to contain_kmod__load('vfio-pci')
end
it 'configures dpdk options with socket memory' do
is_expected.to contain_file_line('/etc/sysconfig/openvswitch')
is_expected.to contain_vs_config('other_config:dpdk-init').with(
:value => 'true', :wait => true, :skip_if_version => "2.5",
)
is_expected.to contain_vs_config('other_config:pmd-cpu-mask').with(
:value => nil, :wait => false,
)
is_expected.to contain_vs_config('other_config:dpdk-socket-mem').with(
:value => nil, :wait => false, :skip_if_version => "2.5",
)
is_expected.to contain_vs_config('other_config:dpdk-lcore-mask').with(
:value => nil, :wait => false, :skip_if_version => "2.5",
)
is_expected.to contain_vs_config('other_config:dpdk-extra').with(
:value => nil, :wait => false, :skip_if_version => "2.5",
)
end
end
context 'when passing all empty params' do
before :each do
@ -77,25 +29,20 @@ describe 'vswitch::dpdk' do
params.merge!(:pmd_core_list => '')
end
it 'configures dpdk options' do
is_expected.to contain_file_line('/etc/sysconfig/openvswitch').with(
:path => '/etc/sysconfig/openvswitch',
:match => '^DPDK_OPTIONS.*',
:before => 'Service[openvswitch]',
)
is_expected.to contain_vs_config('other_config:dpdk-init').with(
:value => 'true', :wait => true, :skip_if_version => "2.5",
:value => 'true', :wait => true,
)
is_expected.to contain_vs_config('other_config:pmd-cpu-mask').with(
:value => nil, :wait => false,
)
is_expected.to contain_vs_config('other_config:dpdk-socket-mem').with(
:value => '', :wait => false, :skip_if_version => "2.5",
:value => '', :wait => false,
)
is_expected.to contain_vs_config('other_config:dpdk-lcore-mask').with(
:value => nil, :wait => false, :skip_if_version => "2.5",
:value => nil, :wait => false,
)
is_expected.to contain_vs_config('other_config:dpdk-extra').with(
:value => nil, :wait => false, :skip_if_version => "2.5",
:value => nil, :wait => false,
)
end
@ -109,74 +56,24 @@ describe 'vswitch::dpdk' do
params.merge!(:pmd_core_list => '22,23,24,25,66,67,68,69')
end
it 'configures dpdk options' do
is_expected.to contain_file_line('/etc/sysconfig/openvswitch').with(
:path => '/etc/sysconfig/openvswitch',
:match => '^DPDK_OPTIONS.*',
:line => 'DPDK_OPTIONS = "-l 1,2 -n 2 --socket-mem 1024 "',
:before => 'Service[openvswitch]',
)
is_expected.to contain_vs_config('other_config:dpdk-init').with(
:value => 'true', :wait => true, :skip_if_version => "2.5",
:value => 'true', :wait => true,
)
is_expected.to contain_vs_config('other_config:pmd-cpu-mask').with(
:value => '3c0000000003c00000', :wait => false,
)
is_expected.to contain_vs_config('other_config:dpdk-socket-mem').with(
:value => '1024', :wait => false, :skip_if_version => "2.5",
:value => '1024', :wait => false,
)
is_expected.to contain_vs_config('other_config:dpdk-lcore-mask').with(
:value => '6', :wait => false, :skip_if_version => "2.5",
:value => '6', :wait => false,
)
is_expected.to contain_vs_config('other_config:dpdk-extra').with(
:value => '-n 2', :wait => false, :skip_if_version => "2.5",
:value => '-n 2', :wait => false,
)
end
end
context 'when passing invalid socket_mem' do
before :each do
params.merge!(:socket_mem => "'1024'")
end
it { is_expected.to raise_error(Puppet::Error, /socket_mem is in incorrect format/) }
end
context 'when providing valid driver type facts' do
let :facts do
OSDefaults.get_facts({
:osfamily => 'Redhat',
:operatingsystem => 'RedHat',
:ovs_version => '2.5.1',
:pci_address_driver_test => '0000:00:05.0,0000:00:05.1'
})
end
before :each do
params.merge!(:host_core_list => '1,2')
params.merge!(:driver_type => 'test')
params.merge!(:memory_channels => 2)
end
it 'configures dpdk options with pci address for driver test' do
is_expected.to contain_file_line('/etc/sysconfig/openvswitch').with(
:path => '/etc/sysconfig/openvswitch',
:match => '^DPDK_OPTIONS.*',
:line => 'DPDK_OPTIONS = "-l 1,2 -n 2 -w 0000:00:05.0 -w 0000:00:05.1"',
:before => 'Service[openvswitch]',
)
is_expected.to contain_vs_config('other_config:dpdk-init').with(
:value => 'true', :wait => true, :skip_if_version => "2.5",
)
is_expected.to contain_vs_config('other_config:pmd-cpu-mask').with(
:value => nil, :wait => false,
)
is_expected.to contain_vs_config('other_config:dpdk-socket-mem').with(
:value => nil, :wait => false, :skip_if_version => "2.5",
)
is_expected.to contain_vs_config('other_config:dpdk-lcore-mask').with(
:value => '6', :wait => false, :skip_if_version => "2.5",
)
end
end
end
on_supported_os({