Browse Source

Fix LB set in ERROR too early in MapLoadbalancerToAmphora

This is a follow up patch for I48b0f5a773209b1c1b056d71c0da05d6fd82ca73,
this fix applies only on Wallaby and older releases because the code was
removed during the Xena cycle.

It removes calls to mark_loadbalancer_prov_status_error in revert method
of tasks (except in LoadBalancer*ToErrorOnRevertTask)

Story 2009651
Task 43810
Story 2009652
Task 43811

Conflicts:
	octavia/tests/unit/controller/worker/v1/tasks/test_database_tasks.py
	octavia/tests/unit/controller/worker/v2/tasks/test_database_tasks.py

Change-Id: I7692155fb113442b692267ab12b69ab90200bcb5
(cherry picked from commit 9b7791db52)
(cherry picked from commit de20868ab7)
(cherry picked from commit 0d25fe5fff)
changes/50/820350/1
Gregory Thiemonge 6 months ago
parent
commit
51c6d8bd90
  1. 5
      octavia/controller/worker/v1/tasks/database_tasks.py
  2. 16
      octavia/tests/unit/controller/worker/v1/tasks/test_database_tasks.py

5
octavia/controller/worker/v1/tasks/database_tasks.py

@ -545,11 +545,6 @@ class MapLoadbalancerToAmphora(BaseDatabaseTask):
return amp.id
def revert(self, result, loadbalancer_id, *args, **kwargs):
LOG.warning("Reverting Amphora allocation for the load "
"balancer %s in the database.", loadbalancer_id)
self.task_utils.mark_loadbalancer_prov_status_error(loadbalancer_id)
class _MarkAmphoraRoleAndPriorityInDB(BaseDatabaseTask):
"""Alter the amphora role and priority in DB."""

16
octavia/tests/unit/controller/worker/v1/tasks/test_database_tasks.py

@ -573,22 +573,6 @@ class TestDatabaseTasks(base.TestCase):
self.assertIsNone(amp_id)
# Test revert
map_lb_to_amp.revert(None, self.loadbalancer_mock.id)
repo.LoadBalancerRepository.update.assert_called_once_with(
'TEST',
id=LB_ID,
provisioning_status=constants.ERROR)
# Test revert with exception
repo.LoadBalancerRepository.update.reset_mock()
mock_loadbalancer_repo_update.side_effect = Exception('fail')
map_lb_to_amp.revert(None, self.loadbalancer_mock.id)
repo.LoadBalancerRepository.update.assert_called_once_with(
'TEST',
id=LB_ID,
provisioning_status=constants.ERROR)
@mock.patch('octavia.db.repositories.AmphoraRepository.get',
return_value=_amphora_mock)
@mock.patch('octavia.db.repositories.LoadBalancerRepository.get',

Loading…
Cancel
Save