Enable keepalived VRRP health check

The option ha_vrrp_health_check_interval [1] can re-trigger
the election process until a master is re-elected when multiple
masters problem appear. This is an important feature that enables
the system to recover automatically, we should enable it.

[1] https://docs.openstack.org/ocata/networking-guide/ \
        deploy-ovs-ha-vrrp.html#keepalived-vrrp-health-check

Change-Id: Iaf15ac77e249d1fe4a5101068761302e53385642
Closes-Bug: 1732154
This commit is contained in:
Zhang Hua 2018-09-11 15:33:42 +08:00
parent 1cd104b4f6
commit 7b60534ce8
4 changed files with 16 additions and 0 deletions

View File

@ -77,6 +77,7 @@ class L3AgentContext(OSContextGenerator):
ctxt['agent_mode'] = 'legacy'
ctxt['rpc_response_timeout'] = api_settings['rpc_response_timeout']
ctxt['report_interval'] = api_settings['report_interval']
ctxt['use_l3ha'] = api_settings['enable_l3ha']
return ctxt

View File

@ -30,6 +30,9 @@ 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
{% endif -%}
[AGENT]
extensions = fwaas

View File

@ -25,6 +25,9 @@ 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
{% endif -%}
[AGENT]
extensions = fwaas

View File

@ -63,6 +63,7 @@ class TestL3AgentContext(CharmTestCase):
DummyNeutronAPIContext(return_value={'enable_dvr': False,
'report_interval': 30,
'rpc_response_timeout': 60,
'enable_l3ha': True,
})
self.test_config.set('run-internal-router', 'none')
self.test_config.set('external-network-id', '')
@ -71,6 +72,7 @@ class TestL3AgentContext(CharmTestCase):
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'use_l3ha': True,
'external_configuration_new': True,
'handle_internal_only_router': False,
'plugin': 'ovs'})
@ -81,6 +83,7 @@ class TestL3AgentContext(CharmTestCase):
DummyNeutronAPIContext(return_value={'enable_dvr': False,
'report_interval': 30,
'rpc_response_timeout': 60,
'enable_l3ha': True,
})
self.test_config.set('run-internal-router', 'none')
self.test_config.set('ext-port', 'eth1')
@ -89,6 +92,7 @@ class TestL3AgentContext(CharmTestCase):
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'use_l3ha': True,
'handle_internal_only_router': False,
'plugin': 'ovs'})
@ -98,6 +102,7 @@ class TestL3AgentContext(CharmTestCase):
DummyNeutronAPIContext(return_value={'enable_dvr': False,
'report_interval': 30,
'rpc_response_timeout': 60,
'enable_l3ha': True,
})
self.test_config.set('run-internal-router', 'leader')
self.test_config.set('external-network-id', 'netid')
@ -106,6 +111,7 @@ class TestL3AgentContext(CharmTestCase):
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'use_l3ha': True,
'handle_internal_only_router': True,
'ext_net_id': 'netid',
'plugin': 'ovs'})
@ -116,6 +122,7 @@ class TestL3AgentContext(CharmTestCase):
DummyNeutronAPIContext(return_value={'enable_dvr': False,
'report_interval': 30,
'rpc_response_timeout': 60,
'enable_l3ha': True,
})
self.test_config.set('run-internal-router', 'all')
self.test_config.set('external-network-id', 'netid')
@ -124,6 +131,7 @@ class TestL3AgentContext(CharmTestCase):
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'use_l3ha': True,
'handle_internal_only_router': True,
'ext_net_id': 'netid',
'plugin': 'ovs'})
@ -134,6 +142,7 @@ class TestL3AgentContext(CharmTestCase):
DummyNeutronAPIContext(return_value={'enable_dvr': True,
'report_interval': 30,
'rpc_response_timeout': 60,
'enable_l3ha': True,
})
self.assertEqual(neutron_contexts.L3AgentContext()()['agent_mode'],
'dvr_snat')