From f7b4c844bc95056d8a242332bcf60fcb5b49d8f5 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 26 Aug 2022 01:22:28 +0900 Subject: [PATCH] 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 --- manifests/agents/ml2/mlnx.pp | 55 ++++++++++++------- ...ate-duplicate-params-c7813aa5f4bd36c9.yaml | 9 +++ spec/classes/neutron_agents_ml2_mlnx_spec.rb | 24 +++++++- 3 files changed, 65 insertions(+), 23 deletions(-) create mode 100644 releasenotes/notes/mlnx-deprecate-duplicate-params-c7813aa5f4bd36c9.yaml diff --git a/manifests/agents/ml2/mlnx.pp b/manifests/agents/ml2/mlnx.pp index 83402d6a3..551357553 100644 --- a/manifests/agents/ml2/mlnx.pp +++ b/manifests/agents/ml2/mlnx.pp @@ -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, { diff --git a/releasenotes/notes/mlnx-deprecate-duplicate-params-c7813aa5f4bd36c9.yaml b/releasenotes/notes/mlnx-deprecate-duplicate-params-c7813aa5f4bd36c9.yaml new file mode 100644 index 000000000..ef11a09ab --- /dev/null +++ b/releasenotes/notes/mlnx-deprecate-duplicate-params-c7813aa5f4bd36c9.yaml @@ -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`` diff --git a/spec/classes/neutron_agents_ml2_mlnx_spec.rb b/spec/classes/neutron_agents_ml2_mlnx_spec.rb index 6d1de73ec..a4ac24a25 100644 --- a/spec/classes/neutron_agents_ml2_mlnx_spec.rb +++ b/spec/classes/neutron_agents_ml2_mlnx_spec.rb @@ -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('') - should contain_neutron_dhcp_agent_config('DEFAULT/interface_driver').with_value('') should contain_neutron_dhcp_agent_config('DEFAULT/multi_interface_driver_mappings').with_value('') should contain_neutron_dhcp_agent_config('DEFAULT/ipoib_physical_interface').with_value('') 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('') should contain_neutron_l3_agent_config('DEFAULT/multi_interface_driver_mappings').with_value('') should contain_neutron_l3_agent_config('DEFAULT/ipoib_physical_interface').with_value('') 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({