From 0da18826895522e3c5513dbfb1dca25e6bb9df8a Mon Sep 17 00:00:00 2001 From: Moshe Levi Date: Mon, 11 Sep 2017 12:56:21 +0300 Subject: [PATCH] add support for ovs hw-offload Ovs 2.8 has support for hardware offload [1] This patch provides an option to configure it. [1] https://patchwork.ozlabs.org/patch/767853/ Change-Id: I3c0d24a31f0a1cac2cb8c5da8125051d4348eed6 --- manifests/ovs.pp | 19 +++++++++++++++++-- .../ovs-hw-offload-020fe686bbced136.yaml | 4 ++++ spec/classes/vswitch_ovs_spec.rb | 12 +++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/ovs-hw-offload-020fe686bbced136.yaml diff --git a/manifests/ovs.pp b/manifests/ovs.pp index 09550507..155dcf29 100644 --- a/manifests/ovs.pp +++ b/manifests/ovs.pp @@ -18,10 +18,17 @@ # For RedHat this parameter is ignored. # If you like turn off dkms on Debian/Ubuntu set to # false. defaults to false. +# +# [*enable_hw_offload*] +# (optional) Configure OVS to use +# Hardware Offload. This feature is +# supported from ovs 2.8.0. +# Defaults to False. class vswitch::ovs( - $package_ensure = 'present', - $dkms_ensure = false, + $package_ensure = 'present', + $dkms_ensure = false, + $enable_hw_offload = false, ) { include ::vswitch::params @@ -67,6 +74,14 @@ class vswitch::ovs( } } + if $enable_hw_offload { + vs_config { 'other_config:hw-offload': + value => 'true', + notify => Service['openvswitch'], + wait => true, + } + } + service { 'openvswitch': ensure => true, enable => true, diff --git a/releasenotes/notes/ovs-hw-offload-020fe686bbced136.yaml b/releasenotes/notes/ovs-hw-offload-020fe686bbced136.yaml new file mode 100644 index 00000000..31455ecf --- /dev/null +++ b/releasenotes/notes/ovs-hw-offload-020fe686bbced136.yaml @@ -0,0 +1,4 @@ +--- +features: + - Added the configuration option to enable ovs hardware offload. + This feature is support with ovs 2.8.0. \ No newline at end of file diff --git a/spec/classes/vswitch_ovs_spec.rb b/spec/classes/vswitch_ovs_spec.rb index 0b437afb..d90ac76d 100644 --- a/spec/classes/vswitch_ovs_spec.rb +++ b/spec/classes/vswitch_ovs_spec.rb @@ -4,7 +4,8 @@ describe 'vswitch::ovs' do let :default_params do { :package_ensure => 'present', - :dkms_ensure => false + :dkms_ensure => false, + :enable_hw_offload => false, } end @@ -44,6 +45,9 @@ describe 'vswitch::ovs' do is_expected.to contain_class('vswitch::params') end + it 'configures hw-offload option to false' do + is_expected.to_not contain_vs_config('other_config:hw-offload') + end it 'configures service' do is_expected.to contain_service('openvswitch').with( :ensure => true, @@ -68,6 +72,7 @@ describe 'vswitch::ovs' do { :package_ensure => 'latest', :dkms_ensure => false, + :enable_hw_offload => true, } end it 'installs correct package' do @@ -77,6 +82,11 @@ describe 'vswitch::ovs' do :before => 'Service[openvswitch]' ) end + it 'configures hw-offload option' do + is_expected.to contain_vs_config('other_config:hw-offload').with( + :value => 'true', :notify => 'Service[openvswitch]', :wait => true, + ) + end end end