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
Change-Id: I7692155fb113442b692267ab12b69ab90200bcb5
(cherry picked from commit 9b7791db52
)
This commit is contained in:
parent
4ec61cd4c4
commit
de20868ab7
|
@ -551,11 +551,6 @@ class MapLoadbalancerToAmphora(BaseDatabaseTask):
|
||||||
|
|
||||||
return amp.id
|
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):
|
class _MarkAmphoraRoleAndPriorityInDB(BaseDatabaseTask):
|
||||||
"""Alter the amphora role and priority in DB."""
|
"""Alter the amphora role and priority in DB."""
|
||||||
|
|
|
@ -592,11 +592,6 @@ class MapLoadbalancerToAmphora(BaseDatabaseTask):
|
||||||
# loadbalancer flow can executed properly
|
# loadbalancer flow can executed properly
|
||||||
return amp.to_dict()
|
return amp.to_dict()
|
||||||
|
|
||||||
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):
|
class _MarkAmphoraRoleAndPriorityInDB(BaseDatabaseTask):
|
||||||
"""Alter the amphora role and priority in DB."""
|
"""Alter the amphora role and priority in DB."""
|
||||||
|
|
|
@ -573,22 +573,6 @@ class TestDatabaseTasks(base.TestCase):
|
||||||
|
|
||||||
self.assertIsNone(amp_id)
|
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.'
|
@mock.patch('octavia.db.repositories.AmphoraRepository.'
|
||||||
'allocate_and_associate',
|
'allocate_and_associate',
|
||||||
side_effect=[_amphora_mock, None])
|
side_effect=[_amphora_mock, None])
|
||||||
|
@ -618,22 +602,6 @@ class TestDatabaseTasks(base.TestCase):
|
||||||
|
|
||||||
self.assertIsNone(amp_id)
|
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',
|
@mock.patch('octavia.db.repositories.AmphoraRepository.get',
|
||||||
return_value=_amphora_mock)
|
return_value=_amphora_mock)
|
||||||
@mock.patch('octavia.db.repositories.LoadBalancerRepository.get',
|
@mock.patch('octavia.db.repositories.LoadBalancerRepository.get',
|
||||||
|
|
|
@ -624,22 +624,6 @@ class TestDatabaseTasks(base.TestCase):
|
||||||
|
|
||||||
self.assertIsNone(amp_id)
|
self.assertIsNone(amp_id)
|
||||||
|
|
||||||
# Test revert
|
|
||||||
map_lb_to_amp.revert(None, LB_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, LB_ID)
|
|
||||||
repo.LoadBalancerRepository.update.assert_called_once_with(
|
|
||||||
'TEST',
|
|
||||||
id=LB_ID,
|
|
||||||
provisioning_status=constants.ERROR)
|
|
||||||
|
|
||||||
@mock.patch('octavia.db.repositories.AmphoraRepository.'
|
@mock.patch('octavia.db.repositories.AmphoraRepository.'
|
||||||
'allocate_and_associate',
|
'allocate_and_associate',
|
||||||
side_effect=[_db_amphora_mock, None])
|
side_effect=[_db_amphora_mock, None])
|
||||||
|
@ -669,22 +653,6 @@ class TestDatabaseTasks(base.TestCase):
|
||||||
|
|
||||||
self.assertIsNone(amp)
|
self.assertIsNone(amp)
|
||||||
|
|
||||||
# Test revert
|
|
||||||
map_lb_to_amp.revert(None, _db_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, _db_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',
|
@mock.patch('octavia.db.repositories.AmphoraRepository.get',
|
||||||
return_value=_db_amphora_mock)
|
return_value=_db_amphora_mock)
|
||||||
@mock.patch('octavia.db.repositories.LoadBalancerRepository.get',
|
@mock.patch('octavia.db.repositories.LoadBalancerRepository.get',
|
||||||
|
|
Loading…
Reference in New Issue