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)
This commit is contained in:
Takashi Kajinami 2021-03-10 23:37:31 +09:00 committed by Slawek Kaplonski
parent ff902e9c42
commit 14011d69c1
5 changed files with 57 additions and 8 deletions

View File

@ -31,6 +31,11 @@
#
# [*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*]
# (Optional) Number of cores to be used for OVS Revalidator threads.
@ -52,6 +57,7 @@ class vswitch::dpdk (
$pmd_core_list = undef,
$socket_mem = undef,
$disable_emc = false,
$vlan_limit = $::os_service_default,
$revalidator_cores = undef,
$handler_cores = undef,
# 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
vs_config { 'other_config:dpdk-init':
value => 'true',

View File

@ -23,16 +23,22 @@
# (optional) Configure OVS to use
# Hardware Offload. This feature is
# supported from ovs 2.8.0.
# Defaults to False.
# Defaults to false.
#
# [*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(
$package_ensure = 'present',
$dkms_ensure = false,
$enable_hw_offload = false,
$disable_emc = false,
$vlan_limit = $::os_service_default,
) {
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':
ensure => 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,
)
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
@ -57,6 +58,7 @@ describe 'vswitch::dpdk' do
params.merge!(:memory_channels => 2)
params.merge!(:pmd_core_list => '22,23,24,25,66,67,68,69')
params.merge!(:disable_emc => true)
params.merge!(:vlan_limit => 2)
end
it 'configures dpdk options' do
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(
:value => '0', :notify => 'Service[openvswitch]', :wait => false,
)
is_expected.to contain_vs_config('other_config:vlan-limit').with(
:value => '2', :wait => true,
)
end
end

View File

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