diff --git a/config.yaml b/config.yaml index d49f7006..339e7a70 100644 --- a/config.yaml +++ b/config.yaml @@ -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. diff --git a/hooks/neutron_contexts.py b/hooks/neutron_contexts.py index 7aa7c821..4abec69e 100644 --- a/hooks/neutron_contexts.py +++ b/hooks/neutron_contexts.py @@ -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() diff --git a/templates/newton/l3_agent.ini b/templates/newton/l3_agent.ini index 4ff0c2cc..f187e223 100644 --- a/templates/newton/l3_agent.ini +++ b/templates/newton/l3_agent.ini @@ -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] diff --git a/templates/queens/l3_agent.ini b/templates/queens/l3_agent.ini index d5e003e3..60583cae 100644 --- a/templates/queens/l3_agent.ini +++ b/templates/queens/l3_agent.ini @@ -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] diff --git a/templates/rocky/l3_agent.ini b/templates/rocky/l3_agent.ini index 10424b02..f60312a2 100644 --- a/templates/rocky/l3_agent.ini +++ b/templates/rocky/l3_agent.ini @@ -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] diff --git a/templates/stein/l3_agent.ini b/templates/stein/l3_agent.ini index e2e99d9d..d4623e92 100644 --- a/templates/stein/l3_agent.ini +++ b/templates/stein/l3_agent.ini @@ -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] diff --git a/unit_tests/test_neutron_contexts.py b/unit_tests/test_neutron_contexts.py index 3f3e272c..8119ab83 100644 --- a/unit_tests/test_neutron_contexts.py +++ b/unit_tests/test_neutron_contexts.py @@ -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')