Fix load balancers with failed amphora failover
This patch is a complement of [1] which we ensure
a fresh lb object, but only for AmpListenersUpdate
class.
It was observed, at least on train and ussuri
deployments that multiple failed amphoras were still
happening when using session persistence.
That is fixed and failover works flawless with session
persistence when we also ensure a fresh lb object on
AmphoraIndexListenerUpdate class.
[1] https://review.opendev.org/#/c/756597/
Change-Id: I923accd73e0c9cadc91c115157c576432f428622
Story: 2008099
Task: 40802
(cherry picked from commit f96251c742
)
This commit is contained in:
parent
fc058c3a83
commit
b17a5247c1
|
@ -78,6 +78,9 @@ class AmphoraIndexListenerUpdate(BaseAmphoraTask):
|
|||
# in a failover flow with both amps failing. Skip it and let
|
||||
# health manager fix it.
|
||||
try:
|
||||
# Make sure we have a fresh load balancer object
|
||||
loadbalancer = self.loadbalancer_repo.get(db_apis.get_session(),
|
||||
id=loadbalancer.id)
|
||||
self.amphora_driver.update_amphora_listeners(
|
||||
loadbalancer, amphorae[amphora_index], timeout_dict)
|
||||
except Exception as e:
|
||||
|
|
|
@ -110,17 +110,24 @@ class TestAmphoraDriverTasks(base.TestCase):
|
|||
mock_amphora_repo_update.assert_called_once_with(
|
||||
_session_mock, AMP_ID, status=constants.ERROR)
|
||||
|
||||
def test_amphorae_listeners_update(
|
||||
self, mock_driver, mock_generate_uuid, mock_log, mock_get_session,
|
||||
mock_listener_repo_get, mock_listener_repo_update,
|
||||
mock_amphora_repo_update):
|
||||
@mock.patch('octavia.db.repositories.LoadBalancerRepository.get')
|
||||
def test_amphorae_listeners_update(self,
|
||||
mock_lb_repo_get,
|
||||
mock_driver,
|
||||
mock_generate_uuid,
|
||||
mock_log,
|
||||
mock_get_session,
|
||||
mock_listener_repo_get,
|
||||
mock_listener_repo_update,
|
||||
mock_amphora_repo_update):
|
||||
|
||||
mock_lb_repo_get.return_value = _LB_mock
|
||||
amp_list_update_obj = amphora_driver_tasks.AmphoraIndexListenerUpdate()
|
||||
amp_list_update_obj.execute(_load_balancer_mock, 0,
|
||||
[_amphora_mock], self.timeout_dict)
|
||||
|
||||
mock_driver.update_amphora_listeners.assert_called_once_with(
|
||||
_load_balancer_mock, _amphora_mock, self.timeout_dict)
|
||||
_LB_mock, _amphora_mock, self.timeout_dict)
|
||||
|
||||
mock_driver.update_amphora_listeners.side_effect = Exception('boom')
|
||||
|
||||
|
|
Loading…
Reference in New Issue