Skip to content

Commit a4317a8

Browse files
committed
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
1 parent b71e752 commit a4317a8

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

octavia/controller/worker/v2/flows/amphora_flows.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def update_amphora_config_flow(self):
404404
def get_amphora_for_lb_failover_subflow(
405405
self, prefix, role=constants.ROLE_STANDALONE,
406406
failed_amp_vrrp_port_id=None, is_vrrp_ipv6=False,
407-
flavor_dict=None):
407+
flavor_dict=None, timeout_dict=None):
408408
"""Creates a new amphora that will be used in a failover flow.
409409
410410
:requires: loadbalancer_id, flavor, vip, vip_sg_id, loadbalancer
@@ -488,13 +488,24 @@ def get_amphora_for_lb_failover_subflow(
488488
rebind={constants.AMPHORAE: constants.NEW_AMPHORAE},
489489
provides=constants.AMPHORA_FIREWALL_RULES,
490490
inject={constants.AMPHORA_INDEX: 0}))
491+
amp_for_failover_flow.add(
492+
amphora_driver_tasks.AmphoraeGetConnectivityStatus(
493+
name=(prefix + '-' +
494+
constants.AMPHORAE_GET_CONNECTIVITY_STATUS),
495+
requires=constants.AMPHORAE,
496+
rebind={constants.AMPHORAE: constants.NEW_AMPHORAE},
497+
inject={constants.TIMEOUT_DICT: timeout_dict,
498+
constants.NEW_AMPHORA_ID: constants.NIL_UUID},
499+
provides=constants.AMPHORAE_STATUS))
491500
amp_for_failover_flow.add(
492501
amphora_driver_tasks.SetAmphoraFirewallRules(
493502
name=prefix + '-' + constants.SET_AMPHORA_FIREWALL_RULES,
494503
requires=(constants.AMPHORAE,
495-
constants.AMPHORA_FIREWALL_RULES),
504+
constants.AMPHORA_FIREWALL_RULES,
505+
constants.AMPHORAE_STATUS),
496506
rebind={constants.AMPHORAE: constants.NEW_AMPHORAE},
497-
inject={constants.AMPHORA_INDEX: 0}))
507+
inject={constants.AMPHORA_INDEX: 0,
508+
constants.TIMEOUT_DICT: timeout_dict}))
498509

499510
# Plug member ports
500511
amp_for_failover_flow.add(network_tasks.CalculateAmphoraDelta(

octavia/tests/unit/controller/worker/v2/flows/test_load_balancer_flows.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ def _test_get_failover_LB_flow_single(self, amphorae):
344344
self.assertIn(constants.FLAVOR, failover_flow.requires)
345345
self.assertIn(constants.LOADBALANCER, failover_flow.requires)
346346
self.assertIn(constants.LOADBALANCER_ID, failover_flow.requires)
347-
self.assertIn(constants.AMPHORAE_STATUS, failover_flow.requires)
348347

349348
self.assertIn(constants.UPDATED_PORTS, failover_flow.provides)
350349
self.assertIn(constants.AMPHORA, failover_flow.provides)
@@ -364,9 +363,9 @@ def _test_get_failover_LB_flow_single(self, amphorae):
364363
self.assertIn(constants.SUBNET, failover_flow.provides)
365364
self.assertIn(constants.NEW_AMPHORAE, failover_flow.provides)
366365

367-
self.assertEqual(7, len(failover_flow.requires),
366+
self.assertEqual(6, len(failover_flow.requires),
368367
failover_flow.requires)
369-
self.assertEqual(16, len(failover_flow.provides),
368+
self.assertEqual(17, len(failover_flow.provides),
370369
failover_flow.provides)
371370

372371
@mock.patch('octavia.common.rpc.NOTIFIER',
@@ -424,7 +423,6 @@ def _test_get_failover_LB_flow_no_amps_act_stdby(self, amphorae):
424423
self.assertIn(constants.FLAVOR, failover_flow.requires)
425424
self.assertIn(constants.LOADBALANCER, failover_flow.requires)
426425
self.assertIn(constants.LOADBALANCER_ID, failover_flow.requires)
427-
self.assertIn(constants.AMPHORAE_STATUS, failover_flow.requires)
428426

429427
self.assertIn(constants.UPDATED_PORTS, failover_flow.provides)
430428
self.assertIn(constants.AMPHORA, failover_flow.provides)
@@ -445,9 +443,9 @@ def _test_get_failover_LB_flow_no_amps_act_stdby(self, amphorae):
445443
self.assertIn(constants.SUBNET, failover_flow.provides)
446444
self.assertIn(constants.NEW_AMPHORAE, failover_flow.provides)
447445

448-
self.assertEqual(7, len(failover_flow.requires),
446+
self.assertEqual(6, len(failover_flow.requires),
449447
failover_flow.requires)
450-
self.assertEqual(16, len(failover_flow.provides),
448+
self.assertEqual(17, len(failover_flow.provides),
451449
failover_flow.provides)
452450

453451
@mock.patch('octavia.common.rpc.NOTIFIER',
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
Fixed an issue when failing over load balancers using SR-IOV VIP ports.

0 commit comments

Comments
 (0)