Add keepalived-healthcheck-interval config option

Defaults to 30s (i.e. enabled) but also allows disabling
healthchecks by setting to 0.

Change-Id: I49603c22d8085aabd6085058e4d4eb9c74e84a20
Closes-Bug: #1890900
This commit is contained in:
Edward Hope-Morley 2020-08-08 15:39:31 +01:00
parent a8f1661d61
commit 8d71c41481
7 changed files with 22 additions and 8 deletions

View File

@ -362,3 +362,11 @@ options:
description: |
Manually disable lbaas services. Set this option to True if Octavia
is used with neutron. This option is ignored for Train+ OpenStack.
keepalived-healthcheck-interval:
type: int
default: 30
description: |
By default all HA routers will check their external network gateway
by sending a ping and if that fails they trigger a vrrp transition. This
option defines how frequently this check is performed. Setting this value
to 0 will disable the healthchecks.

View File

@ -175,6 +175,8 @@ class NeutronGatewayContext(NeutronAPIContext):
'availability_zone': get_availability_zone(),
'enable_nfg_logging': api_settings['enable_nfg_logging'],
'ovsdb_timeout': config('ovsdb-timeout'),
'keepalived_healthcheck_interval':
config('keepalived-healthcheck-interval')
}
ctxt['local_ip'] = get_local_ip()

View File

@ -30,8 +30,8 @@ gateway_external_network_id = {{ ext_net_id }}
external_network_bridge = br-ex
{% endif -%}
agent_mode = {{ agent_mode }}
{% if use_l3ha -%}
ha_vrrp_health_check_interval = 30
{% if use_l3ha and keepalived_healthcheck_interval -%}
ha_vrrp_health_check_interval = {{ keepalived_healthcheck_interval }}
{% endif -%}
[AGENT]

View File

@ -25,8 +25,8 @@ gateway_external_network_id = {{ ext_net_id }}
external_network_bridge = br-ex
{% endif -%}
agent_mode = {{ agent_mode }}
{% if use_l3ha -%}
ha_vrrp_health_check_interval = 30
{% if use_l3ha and keepalived_healthcheck_interval -%}
ha_vrrp_health_check_interval = {{ keepalived_healthcheck_interval }}
{% endif -%}
[AGENT]

View File

@ -25,8 +25,8 @@ gateway_external_network_id = {{ ext_net_id }}
external_network_bridge = br-ex
{% endif -%}
agent_mode = {{ agent_mode }}
{% if use_l3ha -%}
ha_vrrp_health_check_interval = 30
{% if use_l3ha and keepalived_healthcheck_interval -%}
ha_vrrp_health_check_interval = {{ keepalived_healthcheck_interval }}
{% endif -%}
[AGENT]

View File

@ -25,8 +25,8 @@ gateway_external_network_id = {{ ext_net_id }}
external_network_bridge = br-ex
{% endif -%}
agent_mode = {{ agent_mode }}
{% if use_l3ha -%}
ha_vrrp_health_check_interval = 30
{% if use_l3ha and keepalived_healthcheck_interval -%}
ha_vrrp_health_check_interval = {{ keepalived_healthcheck_interval }}
{% endif -%}
[AGENT]

View File

@ -204,6 +204,8 @@ class TestNeutronGatewayContext(CharmTestCase):
self.test_config.set('ovsdb-timeout', 10)
self.test_config.set('keepalived-healthcheck-interval', 0)
self.network_get_primary_address.side_effect = NotImplementedError
self.unit_get.return_value = '10.5.0.1'
# Provided by neutron-api relation
@ -237,6 +239,7 @@ class TestNeutronGatewayContext(CharmTestCase):
'nfg_log_output_base': '/var/log/firewall-logs',
'nfg_log_rate_limit': 100,
'ovsdb_timeout': 10,
'keepalived_healthcheck_interval': 0,
})
@patch.object(neutron_contexts, 'validate_nfg_log_path', lambda x: x)
@ -299,6 +302,7 @@ class TestNeutronGatewayContext(CharmTestCase):
'nfg_log_output_base': None,
'nfg_log_rate_limit': None,
'ovsdb_timeout': 60,
'keepalived_healthcheck_interval': 30,
})
@patch('os.environ.get')