Browse Source

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
changes/82/742382/1
Carlos Goncalves 2 years ago
parent
commit
ae6f344359
  1. 7
      octavia/controller/worker/v1/controller_worker.py
  2. 36
      octavia/tests/unit/controller/worker/v1/test_controller_worker.py
  3. 5
      releasenotes/notes/fix-missing-amphora-create-dependency-a954ded0d260d462.yaml

7
octavia/controller/worker/v1/controller_worker.py

@ -332,11 +332,12 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
constants.FLAVOR: flavor,
constants.AVAILABILITY_ZONE: availability_zone}
if not CONF.nova.enable_anti_affinity:
store[constants.SERVER_GROUP_ID] = None
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] = {
constants.TOPOLOGY: topology
}

36
octavia/tests/unit/controller/worker/v1/test_controller_worker.py

@ -410,12 +410,41 @@ class TestControllerWorker(base.TestCase):
_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.'
'LoadBalancerFlows.get_create_load_balancer_flow',
return_value=_flow_mock)
def test_create_load_balancer_single(
def _test_create_load_balancer_single(
self,
mock_get_create_load_balancer_flow,
mock_api_get_session,
mock_dyn_log_listener,
mock_taskflow_load,
@ -426,7 +455,8 @@ class TestControllerWorker(base.TestCase):
mock_listener_repo_get,
mock_lb_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
self.conf.config(group="controller_worker",

5
releasenotes/notes/fix-missing-amphora-create-dependency-a954ded0d260d462.yaml

@ -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…
Cancel
Save