From b3c7e23e204f2c5a63885b758e5bdf7ba4a46a69 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Sun, 9 Jan 2022 01:26:43 -0500 Subject: [PATCH] Fix failover with L3 HA Since there was a few changes inside Neutron which now use primary instead of master, failover did not properly function. This patch handles both master/primary until Neutron moves those keywords into constants inside neutron-lib. Change-Id: I9ff278801a400c52cc52d23b62b0b8447f91ebd8 (cherry picked from commit 76b606b8dbb2010538b223823bcf66e9864354c3) --- neutron_vpnaas/services/vpn/agent.py | 2 +- neutron_vpnaas/tests/functional/common/test_scenario.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/neutron_vpnaas/services/vpn/agent.py b/neutron_vpnaas/services/vpn/agent.py index 202c4c95a..1353c326c 100644 --- a/neutron_vpnaas/services/vpn/agent.py +++ b/neutron_vpnaas/services/vpn/agent.py @@ -89,7 +89,7 @@ class VPNAgent(l3_extension.L3AgentExtension): for device_driver in self.device_drivers: if router_id in device_driver.processes: process = device_driver.processes[router_id] - if state == 'master': + if state in ('master', 'primary'): process.enable() else: process.disable() diff --git a/neutron_vpnaas/tests/functional/common/test_scenario.py b/neutron_vpnaas/tests/functional/common/test_scenario.py index 3b168da1e..6992a1ce2 100644 --- a/neutron_vpnaas/tests/functional/common/test_scenario.py +++ b/neutron_vpnaas/tests/functional/common/test_scenario.py @@ -486,7 +486,7 @@ class TestIPSecBase(framework.L3AgentTestFramework): site.backup_router = self.create_router(self.failover_agent, backup_info) linux_utils.wait_until_true( - lambda: site.router.ha_state == 'master') + lambda: site.router.ha_state in ('master', 'primary')) linux_utils.wait_until_true( lambda: site.backup_router.ha_state == 'backup') @@ -554,7 +554,8 @@ class TestIPSecBase(framework.L3AgentTestFramework): device_name = router1.get_ha_device_name() ha_device = ip_lib.IPDevice(device_name, router1.ns_name) ha_device.link.set_down() - linux_utils.wait_until_true(lambda: router2.ha_state == 'master') + linux_utils.wait_until_true( + lambda: router2.ha_state in ('master', 'primary')) linux_utils.wait_until_true(lambda: router1.ha_state == 'backup') def _ipsec_process_exists(self, conf, router, pid_files):