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
This commit is contained in:
Moshe Levi 2017-09-11 12:56:21 +03:00
parent aedfc5985a
commit 0da1882689
3 changed files with 32 additions and 3 deletions

View File

@ -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,
$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,

View File

@ -0,0 +1,4 @@
---
features:
- Added the configuration option to enable ovs hardware offload.
This feature is support with ovs 2.8.0.

View File

@ -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