diff --git a/octavia/controller/worker/v2/flows/amphora_flows.py b/octavia/controller/worker/v2/flows/amphora_flows.py index 77ae132596..eaff37cf88 100644 --- a/octavia/controller/worker/v2/flows/amphora_flows.py +++ b/octavia/controller/worker/v2/flows/amphora_flows.py @@ -404,7 +404,7 @@ class AmphoraFlows(object): def get_amphora_for_lb_failover_subflow( self, prefix, role=constants.ROLE_STANDALONE, failed_amp_vrrp_port_id=None, is_vrrp_ipv6=False, - flavor_dict=None): + flavor_dict=None, timeout_dict=None): """Creates a new amphora that will be used in a failover flow. :requires: loadbalancer_id, flavor, vip, vip_sg_id, loadbalancer @@ -488,13 +488,24 @@ class AmphoraFlows(object): rebind={constants.AMPHORAE: constants.NEW_AMPHORAE}, provides=constants.AMPHORA_FIREWALL_RULES, inject={constants.AMPHORA_INDEX: 0})) + amp_for_failover_flow.add( + amphora_driver_tasks.AmphoraeGetConnectivityStatus( + name=(prefix + '-' + + constants.AMPHORAE_GET_CONNECTIVITY_STATUS), + requires=constants.AMPHORAE, + rebind={constants.AMPHORAE: constants.NEW_AMPHORAE}, + inject={constants.TIMEOUT_DICT: timeout_dict, + constants.NEW_AMPHORA_ID: constants.NIL_UUID}, + provides=constants.AMPHORAE_STATUS)) amp_for_failover_flow.add( amphora_driver_tasks.SetAmphoraFirewallRules( name=prefix + '-' + constants.SET_AMPHORA_FIREWALL_RULES, requires=(constants.AMPHORAE, - constants.AMPHORA_FIREWALL_RULES), + constants.AMPHORA_FIREWALL_RULES, + constants.AMPHORAE_STATUS), rebind={constants.AMPHORAE: constants.NEW_AMPHORAE}, - inject={constants.AMPHORA_INDEX: 0})) + inject={constants.AMPHORA_INDEX: 0, + constants.TIMEOUT_DICT: timeout_dict})) # Plug member ports amp_for_failover_flow.add(network_tasks.CalculateAmphoraDelta( diff --git a/octavia/tests/unit/controller/worker/v2/flows/test_load_balancer_flows.py b/octavia/tests/unit/controller/worker/v2/flows/test_load_balancer_flows.py index 4b8a4d0e09..fc48ce8b9c 100644 --- a/octavia/tests/unit/controller/worker/v2/flows/test_load_balancer_flows.py +++ b/octavia/tests/unit/controller/worker/v2/flows/test_load_balancer_flows.py @@ -344,7 +344,6 @@ class TestLoadBalancerFlows(base.TestCase): self.assertIn(constants.FLAVOR, failover_flow.requires) self.assertIn(constants.LOADBALANCER, failover_flow.requires) self.assertIn(constants.LOADBALANCER_ID, failover_flow.requires) - self.assertIn(constants.AMPHORAE_STATUS, failover_flow.requires) self.assertIn(constants.UPDATED_PORTS, failover_flow.provides) self.assertIn(constants.AMPHORA, failover_flow.provides) @@ -364,9 +363,9 @@ class TestLoadBalancerFlows(base.TestCase): self.assertIn(constants.SUBNET, failover_flow.provides) self.assertIn(constants.NEW_AMPHORAE, failover_flow.provides) - self.assertEqual(7, len(failover_flow.requires), + self.assertEqual(6, len(failover_flow.requires), failover_flow.requires) - self.assertEqual(16, len(failover_flow.provides), + self.assertEqual(17, len(failover_flow.provides), failover_flow.provides) @mock.patch('octavia.common.rpc.NOTIFIER', @@ -424,7 +423,6 @@ class TestLoadBalancerFlows(base.TestCase): self.assertIn(constants.FLAVOR, failover_flow.requires) self.assertIn(constants.LOADBALANCER, failover_flow.requires) self.assertIn(constants.LOADBALANCER_ID, failover_flow.requires) - self.assertIn(constants.AMPHORAE_STATUS, failover_flow.requires) self.assertIn(constants.UPDATED_PORTS, failover_flow.provides) self.assertIn(constants.AMPHORA, failover_flow.provides) @@ -445,9 +443,9 @@ class TestLoadBalancerFlows(base.TestCase): self.assertIn(constants.SUBNET, failover_flow.provides) self.assertIn(constants.NEW_AMPHORAE, failover_flow.provides) - self.assertEqual(7, len(failover_flow.requires), + self.assertEqual(6, len(failover_flow.requires), failover_flow.requires) - self.assertEqual(16, len(failover_flow.provides), + self.assertEqual(17, len(failover_flow.provides), failover_flow.provides) @mock.patch('octavia.common.rpc.NOTIFIER', diff --git a/releasenotes/notes/Fix-failover-for-SRIOV-VIPs-e2ab193c0de5eb1d.yaml b/releasenotes/notes/Fix-failover-for-SRIOV-VIPs-e2ab193c0de5eb1d.yaml new file mode 100644 index 0000000000..5744b6bbf0 --- /dev/null +++ b/releasenotes/notes/Fix-failover-for-SRIOV-VIPs-e2ab193c0de5eb1d.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixed an issue when failing over load balancers using SR-IOV VIP ports.