Fix missing dependency in amphora create flow
Task CertComputeCreate requires SERVER_GROUP_ID but this dependency is missing when nova anti-affinity is enabled and load balancer topology is SINGLE. This patch fixes this issue. Task: 40408 Story: 2007943 Closes-Bug: #1888397 Change-Id: I757d84e4624f488382ec4ff9af3f489cd9a85ed3
This commit is contained in:
parent
f14ccb52ed
commit
ae6f344359
@ -332,11 +332,12 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
|
|||||||
constants.FLAVOR: flavor,
|
constants.FLAVOR: flavor,
|
||||||
constants.AVAILABILITY_ZONE: availability_zone}
|
constants.AVAILABILITY_ZONE: availability_zone}
|
||||||
|
|
||||||
if not CONF.nova.enable_anti_affinity:
|
|
||||||
store[constants.SERVER_GROUP_ID] = None
|
|
||||||
|
|
||||||
topology = lb.topology
|
topology = lb.topology
|
||||||
|
|
||||||
|
if (not CONF.nova.enable_anti_affinity or
|
||||||
|
topology == constants.TOPOLOGY_SINGLE):
|
||||||
|
store[constants.SERVER_GROUP_ID] = None
|
||||||
|
|
||||||
store[constants.UPDATE_DICT] = {
|
store[constants.UPDATE_DICT] = {
|
||||||
constants.TOPOLOGY: topology
|
constants.TOPOLOGY: topology
|
||||||
}
|
}
|
||||||
|
@ -410,12 +410,41 @@ class TestControllerWorker(base.TestCase):
|
|||||||
|
|
||||||
_flow_mock.run.assert_called_once_with()
|
_flow_mock.run.assert_called_once_with()
|
||||||
|
|
||||||
|
def test_create_load_balancer_single_no_anti_affinity(
|
||||||
|
self, mock_api_get_session,
|
||||||
|
mock_dyn_log_listener, mock_taskflow_load, mock_pool_repo_get,
|
||||||
|
mock_member_repo_get, mock_l7rule_repo_get, mock_l7policy_repo_get,
|
||||||
|
mock_listener_repo_get, mock_lb_repo_get,
|
||||||
|
mock_health_mon_repo_get, mock_amp_repo_get):
|
||||||
|
# Test the code path with Nova anti-affinity disabled
|
||||||
|
self.conf.config(group="nova", enable_anti_affinity=False)
|
||||||
|
self._test_create_load_balancer_single(
|
||||||
|
mock_api_get_session,
|
||||||
|
mock_dyn_log_listener, mock_taskflow_load, mock_pool_repo_get,
|
||||||
|
mock_member_repo_get, mock_l7rule_repo_get,
|
||||||
|
mock_l7policy_repo_get, mock_listener_repo_get,
|
||||||
|
mock_lb_repo_get, mock_health_mon_repo_get, mock_amp_repo_get)
|
||||||
|
|
||||||
|
def test_create_load_balancer_single_anti_affinity(
|
||||||
|
self, mock_api_get_session,
|
||||||
|
mock_dyn_log_listener, mock_taskflow_load, mock_pool_repo_get,
|
||||||
|
mock_member_repo_get, mock_l7rule_repo_get, mock_l7policy_repo_get,
|
||||||
|
mock_listener_repo_get, mock_lb_repo_get,
|
||||||
|
mock_health_mon_repo_get, mock_amp_repo_get):
|
||||||
|
# Test the code path with Nova anti-affinity enabled
|
||||||
|
self.conf.config(group="nova", enable_anti_affinity=True)
|
||||||
|
self._test_create_load_balancer_single(
|
||||||
|
mock_api_get_session,
|
||||||
|
mock_dyn_log_listener, mock_taskflow_load, mock_pool_repo_get,
|
||||||
|
mock_member_repo_get, mock_l7rule_repo_get,
|
||||||
|
mock_l7policy_repo_get, mock_listener_repo_get,
|
||||||
|
mock_lb_repo_get, mock_health_mon_repo_get, mock_amp_repo_get)
|
||||||
|
|
||||||
@mock.patch('octavia.controller.worker.v1.flows.load_balancer_flows.'
|
@mock.patch('octavia.controller.worker.v1.flows.load_balancer_flows.'
|
||||||
'LoadBalancerFlows.get_create_load_balancer_flow',
|
'LoadBalancerFlows.get_create_load_balancer_flow',
|
||||||
return_value=_flow_mock)
|
return_value=_flow_mock)
|
||||||
def test_create_load_balancer_single(
|
def _test_create_load_balancer_single(
|
||||||
self,
|
self,
|
||||||
mock_get_create_load_balancer_flow,
|
|
||||||
mock_api_get_session,
|
mock_api_get_session,
|
||||||
mock_dyn_log_listener,
|
mock_dyn_log_listener,
|
||||||
mock_taskflow_load,
|
mock_taskflow_load,
|
||||||
@ -426,7 +455,8 @@ class TestControllerWorker(base.TestCase):
|
|||||||
mock_listener_repo_get,
|
mock_listener_repo_get,
|
||||||
mock_lb_repo_get,
|
mock_lb_repo_get,
|
||||||
mock_health_mon_repo_get,
|
mock_health_mon_repo_get,
|
||||||
mock_amp_repo_get):
|
mock_amp_repo_get,
|
||||||
|
mock_get_create_load_balancer_flow):
|
||||||
|
|
||||||
# Test the code path with an SINGLE topology
|
# Test the code path with an SINGLE topology
|
||||||
self.conf.config(group="controller_worker",
|
self.conf.config(group="controller_worker",
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixed an issue where amphora load balancers fail to create when Nova
|
||||||
|
anti-affinity is enabled and topology is SINGLE.
|
Loading…
Reference in New Issue
Block a user