Add keepalived-healthcheck-interval config option

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

Change-Id: I5bb7d362f0d957237e24f79f1f82583661bed470
Closes-Bug: #1890900
This commit is contained in:
Edward Hope-Morley 2020-08-08 15:37:50 +01:00
parent 4b6385b7cd
commit 5d83c2c702
6 changed files with 22 additions and 5 deletions

View File

@ -394,3 +394,12 @@ options:
order to support kernels with limited namespace support. i.e. Trusty. order to support kernels with limited namespace support. i.e. Trusty.
Changing the value after neutron DHCP agents are created will break Changing the value after neutron DHCP agents are created will break
access. The charm will go into a blocked state if this is attempted. access. The charm will go into a blocked state if this is attempted.
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. Note that this only applies when
using l3ha and dvr_snat.

View File

@ -201,6 +201,8 @@ class OVSPluginContext(context.NeutronContext):
ovs_ctxt['debug'] = conf['debug'] ovs_ctxt['debug'] = conf['debug']
ovs_ctxt['prevent_arp_spoofing'] = conf['prevent-arp-spoofing'] ovs_ctxt['prevent_arp_spoofing'] = conf['prevent-arp-spoofing']
ovs_ctxt['enable_dpdk'] = conf['enable-dpdk'] ovs_ctxt['enable_dpdk'] = conf['enable-dpdk']
ovs_ctxt['keepalived_healthcheck_interval'] = \
conf['keepalived-healthcheck-interval']
net_dev_mtu = neutron_api_settings.get('network_device_mtu') net_dev_mtu = neutron_api_settings.get('network_device_mtu')
if net_dev_mtu: if net_dev_mtu:

View File

@ -11,6 +11,6 @@ agent_mode = {{ agent_mode }}
gateway_external_network_id = gateway_external_network_id =
external_network_bridge = external_network_bridge =
{% endif %} {% endif %}
{% if use_l3ha and agent_mode == 'dvr_snat' -%} {% if use_l3ha and agent_mode == 'dvr_snat' and keepalived_healthcheck_interval -%}
ha_vrrp_health_check_interval = 30 ha_vrrp_health_check_interval = {{ keepalived_healthcheck_interval }}
{% endif %} {% endif %}

View File

@ -11,8 +11,8 @@ agent_mode = {{ agent_mode }}
gateway_external_network_id = gateway_external_network_id =
external_network_bridge = external_network_bridge =
{% endif %} {% endif %}
{% if use_l3ha and agent_mode == 'dvr_snat' -%} {% if use_l3ha and agent_mode == 'dvr_snat' and keepalived_healthcheck_interval -%}
ha_vrrp_health_check_interval = 30 ha_vrrp_health_check_interval = {{ keepalived_healthcheck_interval }}
{% endif %} {% endif %}
[AGENT] [AGENT]

View File

@ -12,6 +12,9 @@ agent_mode = {{ agent_mode }}
gateway_external_network_id = gateway_external_network_id =
external_network_bridge = external_network_bridge =
{% endif %} {% endif %}
{% if use_l3ha and agent_mode == 'dvr_snat' and keepalived_healthcheck_interval -%}
ha_vrrp_health_check_interval = {{ keepalived_healthcheck_interval }}
{% endif %}
[AGENT] [AGENT]
extensions = {{ l3_extension_plugins }} extensions = {{ l3_extension_plugins }}

View File

@ -133,7 +133,8 @@ class OVSPluginContextTest(CharmTestCase):
'enable-dpdk': False, 'enable-dpdk': False,
'security-group-log-output-base': '/var/log/nsg.log', 'security-group-log-output-base': '/var/log/nsg.log',
'security-group-log-rate-limit': None, 'security-group-log-rate-limit': None,
'security-group-log-burst-limit': 25} 'security-group-log-burst-limit': 25,
'keepalived-healthcheck-interval': 0}
def mock_config(key=None): def mock_config(key=None):
if key: if key:
@ -191,6 +192,7 @@ class OVSPluginContextTest(CharmTestCase):
'nsg_log_output_base': '/var/log/nsg.log', 'nsg_log_output_base': '/var/log/nsg.log',
'nsg_log_rate_limit': None, 'nsg_log_rate_limit': None,
'nsg_log_burst_limit': 25, 'nsg_log_burst_limit': 25,
'keepalived_healthcheck_interval': 0,
} }
self.assertEqual(expect, napi_ctxt()) self.assertEqual(expect, napi_ctxt())
@ -271,6 +273,7 @@ class OVSPluginContextTest(CharmTestCase):
'nsg_log_output_base': None, 'nsg_log_output_base': None,
'nsg_log_rate_limit': None, 'nsg_log_rate_limit': None,
'nsg_log_burst_limit': 25, 'nsg_log_burst_limit': 25,
'keepalived_healthcheck_interval': 30,
} }
self.maxDiff = None self.maxDiff = None
self.assertEqual(expect, napi_ctxt()) self.assertEqual(expect, napi_ctxt())