Add support for vlan_limit option

This change introduces support for the vlan_limit option.
This parameter is currently set to 1 by default, but we should set
it to 2 to enable vlan_transparent, which requires nested vlans.

Related-Bug: #1918418
Change-Id: Id9aaab2a1e3ad2d2d43cd5cddf389d20abaf4461
(cherry picked from commit 4887f4ccd6)
(cherry picked from commit 14011d69c1)
(cherry picked from commit 03d1cc9088)
This commit is contained in:
Takashi Kajinami 2021-03-10 23:37:31 +09:00
parent 2cc977b9cc
commit d8acf3cd85
5 changed files with 57 additions and 8 deletions

View File

@ -31,6 +31,11 @@
# #
# [*disable_emc*] # [*disable_emc*]
# (optional) Configure OVS to disable EMC. # (optional) Configure OVS to disable EMC.
# Defaults to false
#
# [*vlan_limit*]
# (optional) Number of vlan layers allowed.
# Default to $::os_service_default
# #
# [*revalidator_cores*] # [*revalidator_cores*]
# (Optional) Number of cores to be used for OVS Revalidator threads. # (Optional) Number of cores to be used for OVS Revalidator threads.
@ -52,6 +57,7 @@ class vswitch::dpdk (
$pmd_core_list = undef, $pmd_core_list = undef,
$socket_mem = undef, $socket_mem = undef,
$disable_emc = false, $disable_emc = false,
$vlan_limit = $::os_service_default,
$revalidator_cores = undef, $revalidator_cores = undef,
$handler_cores = undef, $handler_cores = undef,
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
@ -103,6 +109,13 @@ class vswitch::dpdk (
} }
} }
if ! is_service_default($vlan_limit) {
vs_config { 'other_config:vlan-limit':
value => "${vlan_limit}",
wait => true,
}
}
# lint:ignore:quoted_booleans # lint:ignore:quoted_booleans
vs_config { 'other_config:dpdk-init': vs_config { 'other_config:dpdk-init':
value => 'true', value => 'true',

View File

@ -23,16 +23,22 @@
# (optional) Configure OVS to use # (optional) Configure OVS to use
# Hardware Offload. This feature is # Hardware Offload. This feature is
# supported from ovs 2.8.0. # supported from ovs 2.8.0.
# Defaults to False. # Defaults to false.
# #
# [*disable_emc*] # [*disable_emc*]
# (optional) Configure OVS to disable EMC. # (optional) Configure OVS to disable EMC.
# Defaults to false.
#
# [*vlan_limit*]
# (optional) Number of vlan layers allowed.
# Default to $::os_service_default
#
class vswitch::ovs( class vswitch::ovs(
$package_ensure = 'present', $package_ensure = 'present',
$dkms_ensure = false, $dkms_ensure = false,
$enable_hw_offload = false, $enable_hw_offload = false,
$disable_emc = false, $disable_emc = false,
$vlan_limit = $::os_service_default,
) { ) {
include ::vswitch::params include ::vswitch::params
@ -96,6 +102,13 @@ class vswitch::ovs(
} }
} }
if ! is_service_default($vlan_limit) {
vs_config { 'other_config:vlan-limit':
value => "${vlan_limit}",
wait => true,
}
}
service { 'openvswitch': service { 'openvswitch':
ensure => true, ensure => true,
enable => true, enable => true,

View File

@ -0,0 +1,7 @@
---
features:
- |
The following two parameters have been added.
- ``vswitch::ovs::vlan_limit``
- ``vswitch::dpdk::vlan_limit``

View File

@ -46,6 +46,7 @@ describe 'vswitch::dpdk' do
:value => nil, :wait => false, :value => nil, :wait => false,
) )
is_expected.to_not contain_vs_config('other_config:emc-insert-inv-prob') is_expected.to_not contain_vs_config('other_config:emc-insert-inv-prob')
is_expected.to_not contain_vs_config('other_config:vlan-limit')
end end
end end
@ -57,6 +58,7 @@ describe 'vswitch::dpdk' do
params.merge!(:memory_channels => 2) params.merge!(:memory_channels => 2)
params.merge!(:pmd_core_list => '22,23,24,25,66,67,68,69') params.merge!(:pmd_core_list => '22,23,24,25,66,67,68,69')
params.merge!(:disable_emc => true) params.merge!(:disable_emc => true)
params.merge!(:vlan_limit => 2)
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(
@ -77,6 +79,9 @@ describe 'vswitch::dpdk' do
is_expected.to contain_vs_config('other_config:emc-insert-inv-prob').with( is_expected.to contain_vs_config('other_config:emc-insert-inv-prob').with(
:value => '0', :notify => 'Service[openvswitch]', :wait => false, :value => '0', :notify => 'Service[openvswitch]', :wait => false,
) )
is_expected.to contain_vs_config('other_config:vlan-limit').with(
:value => '2', :wait => true,
)
end end
end end

View File

@ -3,10 +3,10 @@ require 'spec_helper'
describe 'vswitch::ovs' do describe 'vswitch::ovs' do
let :default_params do { let :default_params do {
:package_ensure => 'present', :package_ensure => 'present',
:dkms_ensure => false, :dkms_ensure => false,
:enable_hw_offload => false, :enable_hw_offload => false,
:disable_emc => false, :disable_emc => false,
} }
end end
@ -54,6 +54,10 @@ describe 'vswitch::ovs' do
is_expected.to_not contain_vs_config('other_config:emc-insert-inv-prob') is_expected.to_not contain_vs_config('other_config:emc-insert-inv-prob')
end end
it 'does not set vlan-limit option' do
is_expected.to_not contain_vs_config('other_config:vlan-limit')
end
it 'configures service' do it 'configures service' do
is_expected.to contain_service('openvswitch').with( is_expected.to contain_service('openvswitch').with(
:ensure => true, :ensure => true,
@ -76,10 +80,11 @@ describe 'vswitch::ovs' do
context 'custom parameters' do context 'custom parameters' do
let :params do let :params do
{ {
:package_ensure => 'latest', :package_ensure => 'latest',
:dkms_ensure => false, :dkms_ensure => false,
:enable_hw_offload => true, :enable_hw_offload => true,
:disable_emc => true, :disable_emc => true,
:vlan_limit => 2,
} }
end end
it 'installs correct package' do it 'installs correct package' do
@ -99,6 +104,12 @@ describe 'vswitch::ovs' do
:value => '0', :notify => 'Service[openvswitch]', :wait => false, :value => '0', :notify => 'Service[openvswitch]', :wait => false,
) )
end end
it 'configures vlan-limit option' do
is_expected.to contain_vs_config('other_config:vlan-limit').with(
:value => '2', :wait => true,
)
end
end end
end end