l3ha: fix status updates

In the scenario of a failover, since the state is not updated, the
router status remains as 'backup' in the agent and it skips on
checking it's status.

This patch updates the router info once there is updates to the
HA state so that it can force a status update correctly.

Change-Id: Id3ec0ec2517d0c8f09c558c25ceb53f7c9fdbcf5
This commit is contained in:
Mohammed Naser 2022-01-09 02:21:45 -05:00
parent 76b606b8db
commit d8bf2a1cc5

View File

@ -88,6 +88,10 @@ class VPNAgent(l3_extension.L3AgentExtension):
state = data['state']
for device_driver in self.device_drivers:
if router_id in device_driver.processes:
# NOTE(mnaser): We need to update the router object so it has
# the new HA state so we can do status updates.
device_driver.routers[router_id].ha_state = state
process = device_driver.processes[router_id]
if state in ('master', 'primary'):
process.enable()