Deprecate usage of Dynamic Kernel Module Support

... because it was required for very old versions of Ubuntu and Debian
and no longer required in recent versions.

Change-Id: Ib5d3ab7cd79470e446a13475d5886c76048bfe5b
This commit is contained in:
Takashi Kajinami 2022-02-27 22:43:47 +09:00
parent 144b4645c1
commit 3ff72b5736
3 changed files with 31 additions and 110 deletions

View File

@ -9,16 +9,6 @@
# (Optional) State of the openvswitch package
# Defaults to 'present'.
#
# [*dkms_ensure*]
# (optional) on debian/wheezy, ubuntu/precise, ubuntu/trusty and
# ubuntu/utopic dkms (Dynamic Kernel Module Support) is used to
# have a kernel module which matches the running kernel.
# In newer distributions (which ship with a newer kernel) dkms
# is not available anymore for openvswitch.
# 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
@ -40,51 +30,32 @@
# NOTE: that the configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
# DEPRECATED PARAMETERS
#
# [*dkms_ensure*]
# (optional) on debian/wheezy, ubuntu/precise, ubuntu/trusty and
# ubuntu/utopic dkms (Dynamic Kernel Module Support) is used to
# have a kernel module which matches the running kernel.
# In newer distributions (which ship with a newer kernel) dkms
# is not available anymore for openvswitch.
# For RedHat this parameter is ignored.
# If you like turn off dkms on Debian/Ubuntu set to false.
# defaults to undef.
#
class vswitch::ovs(
$package_ensure = 'present',
$dkms_ensure = false,
$enable_hw_offload = false,
$disable_emc = false,
$vlan_limit = undef,
$vs_config = {},
$dkms_ensure = undef,
) {
include vswitch::params
validate_legacy(Hash, 'validate_hash', $vs_config)
case $::osfamily {
'Debian': {
if $dkms_ensure {
package { $::vswitch::params::ovs_dkms_package_name:
ensure => $package_ensure,
}
# OVS doesn't build unless the kernel headers are present.
$kernelheaders_pkg = "linux-headers-${::kernelrelease}"
if ! defined(Package[$kernelheaders_pkg]) {
package { $kernelheaders_pkg: ensure => $package_ensure }
}
exec { 'rebuild-ovsmod':
command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log',
creates => "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko",
require => [Package[$::vswitch::params::ovs_dkms_package_name , $kernelheaders_pkg]],
before => Package['openvswitch-switch'],
refreshonly => true,
}
}
if $::ovs_version {
$major_version = regsubst($::ovs_version, '^(\d+).*', '\1')
if $major_version == '1' {
$kernel_mod_file = "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko"
} else {
$kernel_mod_file = "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch.ko"
}
}
}
default: {
# to appease the lint gods.
}
if $dkms_ensure {
warning('The dkms_ensure parameter is deprecated and has no effect')
}
if $enable_hw_offload {

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
The ``vswitch::ovs::dkms_ensure`` parameter has been deprecated and has
no effect.

View File

@ -4,7 +4,6 @@ describe 'vswitch::ovs' do
let :default_params do {
:package_ensure => 'present',
:dkms_ensure => false,
:enable_hw_offload => false,
:disable_emc => false,
}
@ -61,7 +60,6 @@ describe 'vswitch::ovs' do
let :params do
{
:package_ensure => 'latest',
:dkms_ensure => false,
:enable_hw_offload => true,
:disable_emc => true,
:vlan_limit => 2,
@ -93,56 +91,6 @@ describe 'vswitch::ovs' do
end
end
shared_examples_for "vswitch::ovs on Debian" do
context 'with dkms ensure true' do
let (:params) do
{
:package_ensure => 'latest',
:dkms_ensure => true
}
end
it 'install kernel module' do
is_expected.to contain_package(platform_params[:ovs_dkms_package_name]).with(
:name => platform_params[:ovs_dkms_package_name],
:ensure => params[:package_ensure],
)
end
it 'rebuilds kernel module' do
is_expected.to contain_exec('rebuild-ovsmod').with(
:command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log',
:refreshonly => true,
)
end
end
end
shared_examples_for "vswitch::ovs on RedHat" do
it 'does not rebuild kernel module' do
is_expected.to_not contain_exec('rebuild-ovsmod')
end
end
shared_examples_for 'do not install dkms' do
it 'does not rebuild kernel module' do
is_expected.to_not contain_exec('rebuild-ovsmod')
end
end
shared_examples_for 'install dkms' do
it 'install kernel module' do
is_expected.to contain_package(platform_params[:ovs_dkms_package_name]).with(
:name => platform_params[:ovs_dkms_package_name],
:ensure => params[:package_ensure],
)
end
it 'rebuilds kernel module' do
is_expected.to contain_exec('rebuild-ovsmod').with(
:command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log',
:refreshonly => true,
)
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
@ -156,32 +104,29 @@ describe 'vswitch::ovs' do
when 'Debian'
if facts[:operatingsystem] == 'Debian'
{
:ovs_package_name => 'openvswitch-switch',
:ovs_dkms_package_name => 'openvswitch-datapath-dkms',
:ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
:service_hasstatus => true,
:ovs_package_name => 'openvswitch-switch',
:ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
:service_hasstatus => true,
}
elsif facts[:operatingsystem] == 'Ubuntu'
{
:ovs_package_name => 'openvswitch-switch',
:ovs_dkms_package_name => 'openvswitch-datapath-dkms',
:ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
:service_hasstatus => true,
:ovs_package_name => 'openvswitch-switch',
:ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
:service_hasstatus => true,
}
end
when 'RedHat'
{
:ovs_package_name => 'openvswitch',
:ovs_service_name => 'openvswitch',
:provider => 'ovs_redhat',
:ovs_package_name => 'openvswitch',
:ovs_service_name => 'openvswitch',
:provider => 'ovs_redhat',
}
end
end
it_behaves_like "vswitch::ovs"
it_behaves_like "vswitch::ovs on #{facts[:osfamily]}"
end
end