From f40c3138f6941cb6663ac9d4931b3533a45084bb Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 15 Sep 2024 23:57:38 +0900 Subject: [PATCH] l3: Deprecate redundant ha_enabled This option does not actually disable the HA router because of service defaults defined in neutron. Deprecate the parameter to reduce unnecessary complexity. Also replace hard-coded default by service defaults. The switch does not affect any parameters but ha_vrrp_advert_int, which was increased from the default value (2) for no reason. Change-Id: I7857db215ad44fc25384eaf826a4a1f8888a51b7 --- manifests/agents/l3.pp | 56 +++++++++---------- ...deprecate-ha_enabled-491a96d498503066.yaml | 5 ++ spec/classes/neutron_agents_l3_spec.rb | 24 ++++---- 3 files changed, 42 insertions(+), 43 deletions(-) create mode 100644 releasenotes/notes/deprecate-ha_enabled-491a96d498503066.yaml diff --git a/manifests/agents/l3.pp b/manifests/agents/l3.pp index 46f32c942..2e222ffdf 100644 --- a/manifests/agents/l3.pp +++ b/manifests/agents/l3.pp @@ -46,10 +46,6 @@ # (optional) can be set to False if the Nova metadata server is not available # Defaults to $facts['os_service_default'] # -# [*ha_enabled*] -# (optional) Enabled or not HA for L3 agent. -# Defaults to false -# # [*ha_vrrp_auth_type*] # (optional) VRRP authentication type. Can be AH or PASS. # Defaults to "PASS" @@ -60,19 +56,14 @@ # # [*ha_vrrp_advert_int*] # (optional) The advertisement interval in seconds. -# Defaults to '2' +# Defaults to $facts['os_service_default'] # # [*agent_mode*] # (optional) The working mode for the agent. # 'legacy': default behavior (without DVR) # 'dvr': enable DVR for an L3 agent running on compute node (DVR in production) # 'dvr_snat': enable DVR with centralized SNAT support (DVR for single-host, for testing only) -# Defaults to 'legacy' -# -# [*purge_config*] -# (optional) Whether to set only the specified config options -# in the l3 config. -# Defaults to false. +# Defaults to $facts['os_service_default'] # # [*availability_zone*] # (optional) The availability zone of the agent. @@ -130,6 +121,17 @@ # Used by logging service plugin. # Defaults to $facts['os_service_default']. # +# [*purge_config*] +# (optional) Whether to set only the specified config options +# in the l3 config. +# Defaults to false. +# +# DEPRECATED PARAMETERS +# +# [*ha_enabled*] +# (optional) Enabled or not HA for L3 agent. +# Defaults to undef +# class neutron::agents::l3 ( $package_ensure = 'present', Boolean $enabled = true, @@ -141,12 +143,10 @@ class neutron::agents::l3 ( $periodic_interval = $facts['os_service_default'], $periodic_fuzzy_delay = $facts['os_service_default'], $enable_metadata_proxy = $facts['os_service_default'], - Boolean $ha_enabled = false, - $ha_vrrp_auth_type = 'PASS', + $ha_vrrp_auth_type = $facts['os_service_default'], $ha_vrrp_auth_password = $facts['os_service_default'], - $ha_vrrp_advert_int = '3', - $agent_mode = 'legacy', - Boolean $purge_config = false, + $ha_vrrp_advert_int = $facts['os_service_default'], + $agent_mode = $facts['os_service_default'], $availability_zone = $facts['os_service_default'], $extensions = $facts['os_service_default'], $report_interval = $facts['os_service_default'], @@ -158,27 +158,20 @@ class neutron::agents::l3 ( $network_log_rate_limit = $facts['os_service_default'], $network_log_burst_limit = $facts['os_service_default'], $network_log_local_output_log_base = $facts['os_service_default'], + Boolean $purge_config = false, + # DEPRECATED PARAMETERS + Optional[Boolean] $ha_enabled = undef, ) { include neutron::deps include neutron::params - resources { 'neutron_l3_agent_config': - purge => $purge_config, + if $ha_enabled != undef { + warning('The ha_enabled parameter has been deprecated and has no effect.') } - if $ha_enabled { - neutron_l3_agent_config { - 'DEFAULT/ha_vrrp_auth_type': value => $ha_vrrp_auth_type; - 'DEFAULT/ha_vrrp_auth_password': value => $ha_vrrp_auth_password, secret => true; - 'DEFAULT/ha_vrrp_advert_int': value => $ha_vrrp_advert_int; - } - } else { - neutron_l3_agent_config { - 'DEFAULT/ha_vrrp_auth_type': ensure => absent; - 'DEFAULT/ha_vrrp_auth_password': ensure => absent; - 'DEFAULT/ha_vrrp_advert_int': ensure => absent; - } + resources { 'neutron_l3_agent_config': + purge => $purge_config, } neutron_l3_agent_config { @@ -189,6 +182,9 @@ class neutron::agents::l3 ( 'DEFAULT/periodic_interval': value => $periodic_interval; 'DEFAULT/periodic_fuzzy_delay': value => $periodic_fuzzy_delay; 'DEFAULT/enable_metadata_proxy': value => $enable_metadata_proxy; + 'DEFAULT/ha_vrrp_auth_type': value => $ha_vrrp_auth_type; + 'DEFAULT/ha_vrrp_auth_password': value => $ha_vrrp_auth_password, secret => true; + 'DEFAULT/ha_vrrp_advert_int': value => $ha_vrrp_advert_int; 'DEFAULT/agent_mode': value => $agent_mode; 'DEFAULT/radvd_user': value => $radvd_user; 'ovs/integration_bridge': value => $ovs_integration_bridge; diff --git a/releasenotes/notes/deprecate-ha_enabled-491a96d498503066.yaml b/releasenotes/notes/deprecate-ha_enabled-491a96d498503066.yaml new file mode 100644 index 000000000..3702f8dbd --- /dev/null +++ b/releasenotes/notes/deprecate-ha_enabled-491a96d498503066.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - | + The ``neutron::agents::l3::ha_enabled`` parameter has been deprecated and + has no effect now. diff --git a/spec/classes/neutron_agents_l3_spec.rb b/spec/classes/neutron_agents_l3_spec.rb index d96436ca4..74c9211ff 100644 --- a/spec/classes/neutron_agents_l3_spec.rb +++ b/spec/classes/neutron_agents_l3_spec.rb @@ -7,14 +7,8 @@ describe 'neutron::agents::l3' do let :default_params do { - :package_ensure => 'present', - :enabled => true, - :interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver', - :ha_enabled => false, - :ha_vrrp_auth_type => 'PASS', - :ha_vrrp_advert_int => '3', - :agent_mode => 'legacy', - :purge_config => false + :package_ensure => 'present', + :interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver', } end @@ -30,9 +24,6 @@ describe 'neutron::agents::l3' do it { should contain_class('neutron::params') } it 'configures l3_agent.ini' do - should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_type').with_ensure('absent') - should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_password').with_ensure('absent') - should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_advert_int').with_ensure('absent') should contain_neutron_l3_agent_config('DEFAULT/debug').with_value('') should contain_neutron_l3_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]) should contain_neutron_l3_agent_config('DEFAULT/handle_internal_only_routers').with_value('') @@ -40,6 +31,10 @@ describe 'neutron::agents::l3' do should contain_neutron_l3_agent_config('DEFAULT/periodic_interval').with_value('') should contain_neutron_l3_agent_config('DEFAULT/periodic_fuzzy_delay').with_value('') should contain_neutron_l3_agent_config('DEFAULT/enable_metadata_proxy').with_value('') + should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_type').with_value('') + should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_password').with_value('').with_secret(true) + should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_advert_int').with_value('') + should contain_neutron_l3_agent_config('DEFAULT/agent_mode').with_value('') should contain_neutron_l3_agent_config('DEFAULT/radvd_user').with_value('') should contain_neutron_l3_agent_config('ovs/integration_bridge').with_value('') should contain_neutron_l3_agent_config('agent/availability_zone').with_value('') @@ -118,8 +113,11 @@ describe 'neutron::agents::l3' do context 'with HA routers' do before :each do - params.merge!(:ha_enabled => true, - :ha_vrrp_auth_password => 'secrete') + params.merge!({ + :ha_vrrp_auth_type => 'PASS', + :ha_vrrp_auth_password => 'secrete', + :ha_vrrp_advert_int => 3, + }) end it 'should configure VRRP' do should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_type').with_value(p[:ha_vrrp_auth_type])