From 14011d69c18e628a3466fa71db25cefb7adff425 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 10 Mar 2021 23:37:31 +0900 Subject: [PATCH] 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 4887f4ccd6e1031c3f4cc8fdbc17b77b4eecda0b) --- manifests/dpdk.pp | 13 +++++++++++ manifests/ovs.pp | 17 ++++++++++++-- .../notes/vlan-limit-b40bd9ca223b76ca.yaml | 7 ++++++ spec/classes/vswitch_dpdk_spec.rb | 5 ++++ spec/classes/vswitch_ovs_spec.rb | 23 ++++++++++++++----- 5 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/vlan-limit-b40bd9ca223b76ca.yaml diff --git a/manifests/dpdk.pp b/manifests/dpdk.pp index 73053366..ece195b1 100644 --- a/manifests/dpdk.pp +++ b/manifests/dpdk.pp @@ -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', diff --git a/manifests/ovs.pp b/manifests/ovs.pp index 0bd2f077..c5f89936 100644 --- a/manifests/ovs.pp +++ b/manifests/ovs.pp @@ -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, diff --git a/releasenotes/notes/vlan-limit-b40bd9ca223b76ca.yaml b/releasenotes/notes/vlan-limit-b40bd9ca223b76ca.yaml new file mode 100644 index 00000000..f3ae851a --- /dev/null +++ b/releasenotes/notes/vlan-limit-b40bd9ca223b76ca.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + The following two parameters have been added. + + - ``vswitch::ovs::vlan_limit`` + - ``vswitch::dpdk::vlan_limit`` diff --git a/spec/classes/vswitch_dpdk_spec.rb b/spec/classes/vswitch_dpdk_spec.rb index a7f4728a..d878b820 100644 --- a/spec/classes/vswitch_dpdk_spec.rb +++ b/spec/classes/vswitch_dpdk_spec.rb @@ -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 diff --git a/spec/classes/vswitch_ovs_spec.rb b/spec/classes/vswitch_ovs_spec.rb index ecdeebd4..d5805797 100644 --- a/spec/classes/vswitch_ovs_spec.rb +++ b/spec/classes/vswitch_ovs_spec.rb @@ -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