Fix failover when using SRIOV VIP

The previous patch[1] that added a check for Amphora status missed
adding a task that generates the Amphora status information when a
failvoer is triggered.
This patch corrects that by adding the AmphoraeGetConnectivityStatus
task to the get amphora for lb failover subflow.

[1] https://review.opendev.org/c/openstack/octavia/+/912599

Change-Id: I9150da04214f470060020123813bb71235acbc20
(cherry picked from commit a4317a80d61ce2d8e699ea7ca17f161ecc4db8ee)
This commit is contained in:
Michael Johnson 2024-05-17 16:46:33 +00:00
parent b61c340b09
commit 2733a6766f
3 changed files with 22 additions and 9 deletions

View File

@ -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(

View File

@ -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',

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Fixed an issue when failing over load balancers using SR-IOV VIP ports.