mlnx: Deprecate duplicate parameters

This change deprecates the parameters which are conflicting with
other service classes such as neutron::agents::dhcp, so that we can
remove these parameters completely in a future release.

Related-Bug: #1987460
Change-Id: I2ed2241b304bf2280112b4f6beaff36975500f5e
This commit is contained in:
Takashi Kajinami 2022-08-26 01:22:28 +09:00
parent c4f3abe22e
commit f7b4c844bc
3 changed files with 65 additions and 23 deletions

View File

@ -33,14 +33,6 @@
# polling for local device changes.
# Defaults to $::os_service_default
#
# [*dhcp_broadcast_reply*]
# (optional) Use broadcast in DHCP replies
# Defaults to $::os_service_default
#
# [*interface_driver*]
# (optional) The driver used to manage the virtual interface.
# Defaults to $::os_service_default
#
# [*multi_interface_driver_mappings*]
# (optional) A per physnet interface driver mapping used by
# multidriver interface driver to manage the virtual
@ -60,6 +52,16 @@
# be active for an extended amount of time.
# Defaults to false
#
# DEPRECATED PARAMETERS
#
# [*dhcp_broadcast_reply*]
# (optional) Use broadcast in DHCP replies
# Defaults to undef
#
# [*interface_driver*]
# (optional) The driver used to manage the virtual interface.
# Defaults to undef
#
class neutron::agents::ml2::mlnx (
$package_ensure = 'present',
$enabled = true,
@ -67,11 +69,12 @@ class neutron::agents::ml2::mlnx (
$manage_package = true,
$physical_interface_mappings = $::os_service_default,
$polling_interval = $::os_service_default,
$dhcp_broadcast_reply = $::os_service_default,
$interface_driver = $::os_service_default,
$multi_interface_driver_mappings = $::os_service_default,
$ipoib_physical_interface = $::os_service_default,
$enable_multi_interface_driver_cache_maintenance = false,
# DEPRECATED PARAMETERS
$dhcp_broadcast_reply = undef,
$interface_driver = undef,
) {
include neutron::deps
@ -105,16 +108,28 @@ class neutron::agents::ml2::mlnx (
'DEFAULT/enable_multi_interface_driver_cache_maintenance' : value => $enable_multi_interface_driver_cache_maintenance;
}
# NOTE(tkajinam): These are required to allow workaround for bug 1987460
ensure_resource('neutron_dhcp_agent_config', 'DEFAULT/interface_driver', {
'value' => $interface_driver
})
ensure_resource('neutron_l3_agent_config', 'DEFAULT/interface_driver', {
'value' => $interface_driver
})
ensure_resource('neutron_dhcp_agent_config', 'DEFAULT/dhcp_broadcast_reply', {
'value' => $dhcp_broadcast_reply
})
if $interface_driver {
warning("The interface_driver parameter is deprecated. Use the same parameter of \
neutron::agents::dhcp and neutron::agents::l3.")
# NOTE(tkajinam): ensure_resource is required to allow workaround for
# bug 1987460
ensure_resource('neutron_dhcp_agent_config', 'DEFAULT/interface_driver', {
'value' => $interface_driver
})
ensure_resource('neutron_l3_agent_config', 'DEFAULT/interface_driver', {
'value' => $interface_driver
})
}
if $dhcp_broadcast_reply {
warning("The dhcp_broadcast_reply parameter is deprecated. \
Use the neutron::agents::dhcp::dhcp_broadcast_reply parameter instead.")
# NOTE(tkajinam): ensure_resource is required to allow workaround for
# bug 1987460
ensure_resource('neutron_dhcp_agent_config', 'DEFAULT/dhcp_broadcast_reply', {
'value' => $dhcp_broadcast_reply
})
}
if $manage_package {
ensure_packages($mlnx_agent_package, {

View File

@ -0,0 +1,9 @@
---
deprecations:
- |
The following parameters of the ``neutron::agents::ml2::mlnx`` class have
been deprecated. Use the parameters of the ``neutron::agents::dhcp`` class
and the ``neutron::agents::l3`` class.
- ``interface_driver``
- ``dhcp_broadcast_reply``

View File

@ -82,19 +82,37 @@ describe 'neutron::agents::ml2::mlnx' do
end
it 'configures neutron dhcp agent' do
should contain_neutron_dhcp_agent_config('DEFAULT/dhcp_broadcast_reply').with_value('<SERVICE DEFAULT>')
should contain_neutron_dhcp_agent_config('DEFAULT/interface_driver').with_value('<SERVICE DEFAULT>')
should contain_neutron_dhcp_agent_config('DEFAULT/multi_interface_driver_mappings').with_value('<SERVICE DEFAULT>')
should contain_neutron_dhcp_agent_config('DEFAULT/ipoib_physical_interface').with_value('<SERVICE DEFAULT>')
should contain_neutron_dhcp_agent_config('DEFAULT/enable_multi_interface_driver_cache_maintenance').with_value(false)
end
it 'configures neutron l3 agent' do
should contain_neutron_l3_agent_config('DEFAULT/interface_driver').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/multi_interface_driver_mappings').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/ipoib_physical_interface').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/enable_multi_interface_driver_cache_maintenance').with_value(false)
end
context 'with interface_driver' do
before :each do
params.merge!(:interface_driver => 'multi')
end
it 'configures neutron dhcp agent' do
should contain_neutron_dhcp_agent_config('DEFAULT/interface_driver').with_value('multi')
end
it 'configures neutron l3 agent' do
should contain_neutron_l3_agent_config('DEFAULT/interface_driver').with_value('multi')
end
end
context 'with dhcp_broadcast_reply' do
before :each do
params.merge!(:dhcp_broadcast_reply => true)
end
it 'configures neutron dhcp agent' do
should contain_neutron_dhcp_agent_config('DEFAULT/dhcp_broadcast_reply').with_value(true)
end
end
end
on_supported_os({