From 70f15c54d29d085c6ea4753ac66ee2195c427078 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Mon, 13 May 2024 21:59:16 +0000 Subject: [PATCH] Fix listener update when using SRIOV VIP The previous patch[1] that added a check for Amphora status missed adding a task that generates the Amphora status information when a listener is updated. This patch corrects that by adding the AmphoraeGetConnectivityStatus task to the firewall rules subflow. [1] https://review.opendev.org/c/openstack/octavia/+/912599 Change-Id: I325de85b03080db646da847b58c15c3fbbdc6be2 --- .../worker/v2/flows/listener_flows.py | 22 ++++++++++++---- .../worker/v2/flows/test_listener_flows.py | 25 ++++++++----------- ...pdate-for-SRIOV-VIPs-8348b7fe0c02b9c4.yaml | 4 +++ 3 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 releasenotes/notes/Fix-Listener-Update-for-SRIOV-VIPs-8348b7fe0c02b9c4.yaml diff --git a/octavia/controller/worker/v2/flows/listener_flows.py b/octavia/controller/worker/v2/flows/listener_flows.py index 3087aa3aa6..15ba267727 100644 --- a/octavia/controller/worker/v2/flows/listener_flows.py +++ b/octavia/controller/worker/v2/flows/listener_flows.py @@ -161,7 +161,7 @@ class ListenerFlows: return update_listener_flow - def _get_firewall_rules_subflow(self, flavor_dict): + def _get_firewall_rules_subflow(self, flavor_dict, timeout_dict=None): """Creates a subflow that updates the firewall rules in the amphorae. :returns: The subflow for updating firewall rules in the amphorae. @@ -174,6 +174,14 @@ class ListenerFlows: requires=constants.LOADBALANCER_ID, provides=constants.AMPHORAE)) + fw_rules_subflow.add( + amphora_driver_tasks.AmphoraeGetConnectivityStatus( + name=constants.AMPHORAE_GET_CONNECTIVITY_STATUS, + requires=constants.AMPHORAE, + inject={constants.TIMEOUT_DICT: timeout_dict, + constants.NEW_AMPHORA_ID: constants.NIL_UUID}, + provides=constants.AMPHORAE_STATUS)) + fw_rules_subflow.add(network_tasks.GetAmphoraeNetworkConfigs( name=sf_name + '-' + constants.GET_AMP_NETWORK_CONFIG, requires=constants.LOADBALANCER_ID, @@ -192,8 +200,10 @@ class ListenerFlows: amp_0_subflow.add(amphora_driver_tasks.SetAmphoraFirewallRules( name=sf_name + '-0-' + constants.SET_AMPHORA_FIREWALL_RULES, - requires=(constants.AMPHORAE, constants.AMPHORA_FIREWALL_RULES), - inject={constants.AMPHORA_INDEX: 0})) + requires=(constants.AMPHORAE, constants.AMPHORA_FIREWALL_RULES, + constants.AMPHORAE_STATUS), + inject={constants.AMPHORA_INDEX: 0, + constants.TIMEOUT_DICT: timeout_dict})) update_amps_subflow.add(amp_0_subflow) @@ -212,8 +222,10 @@ class ListenerFlows: amp_1_subflow.add(amphora_driver_tasks.SetAmphoraFirewallRules( name=sf_name + '-1-' + constants.SET_AMPHORA_FIREWALL_RULES, requires=(constants.AMPHORAE, - constants.AMPHORA_FIREWALL_RULES), - inject={constants.AMPHORA_INDEX: 1})) + constants.AMPHORA_FIREWALL_RULES, + constants.AMPHORAE_STATUS), + inject={constants.AMPHORA_INDEX: 1, + constants.TIMEOUT_DICT: timeout_dict})) update_amps_subflow.add(amp_1_subflow) diff --git a/octavia/tests/unit/controller/worker/v2/flows/test_listener_flows.py b/octavia/tests/unit/controller/worker/v2/flows/test_listener_flows.py index e45627156b..2f03f87a0a 100644 --- a/octavia/tests/unit/controller/worker/v2/flows/test_listener_flows.py +++ b/octavia/tests/unit/controller/worker/v2/flows/test_listener_flows.py @@ -44,15 +44,14 @@ class TestListenerFlows(base.TestCase): self.assertIn(constants.LISTENERS, listener_flow.requires) self.assertIn(constants.LOADBALANCER_ID, listener_flow.requires) - self.assertIn(constants.AMPHORAE_STATUS, listener_flow.requires) self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, listener_flow.provides) self.assertIn(constants.AMPHORAE, listener_flow.provides) self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides) - self.assertEqual(3, len(listener_flow.requires)) - self.assertEqual(3, len(listener_flow.provides)) + self.assertEqual(2, len(listener_flow.requires)) + self.assertEqual(4, len(listener_flow.provides)) def test_get_delete_listener_flow(self, mock_get_net_driver): flavor_dict = { @@ -66,15 +65,14 @@ class TestListenerFlows(base.TestCase): self.assertIn(constants.LISTENER, listener_flow.requires) self.assertIn(constants.LOADBALANCER_ID, listener_flow.requires) self.assertIn(constants.PROJECT_ID, listener_flow.requires) - self.assertIn(constants.AMPHORAE_STATUS, listener_flow.requires) self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, listener_flow.provides) self.assertIn(constants.AMPHORAE, listener_flow.provides) self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides) - self.assertEqual(4, len(listener_flow.requires)) - self.assertEqual(3, len(listener_flow.provides)) + self.assertEqual(3, len(listener_flow.requires)) + self.assertEqual(4, len(listener_flow.provides)) def test_get_delete_listener_internal_flow(self, mock_get_net_driver): flavor_dict = { @@ -88,15 +86,14 @@ class TestListenerFlows(base.TestCase): self.assertIn(constants.LOADBALANCER_ID, listener_flow.requires) self.assertIn(constants.PROJECT_ID, listener_flow.requires) - self.assertIn(constants.AMPHORAE_STATUS, listener_flow.requires) self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, listener_flow.provides) self.assertIn(constants.AMPHORAE, listener_flow.provides) self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides) - self.assertEqual(3, len(listener_flow.requires)) - self.assertEqual(3, len(listener_flow.provides)) + self.assertEqual(2, len(listener_flow.requires)) + self.assertEqual(4, len(listener_flow.provides)) def test_get_update_listener_flow(self, mock_get_net_driver): flavor_dict = { @@ -112,15 +109,14 @@ class TestListenerFlows(base.TestCase): self.assertIn(constants.UPDATE_DICT, listener_flow.requires) self.assertIn(constants.LISTENERS, listener_flow.requires) self.assertIn(constants.LOADBALANCER_ID, listener_flow.requires) - self.assertIn(constants.AMPHORAE_STATUS, listener_flow.requires) self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, listener_flow.provides) self.assertIn(constants.AMPHORAE, listener_flow.provides) self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides) - self.assertEqual(5, len(listener_flow.requires)) - self.assertEqual(3, len(listener_flow.provides)) + self.assertEqual(4, len(listener_flow.requires)) + self.assertEqual(4, len(listener_flow.provides)) def test_get_create_all_listeners_flow(self, mock_get_net_driver): flavor_dict = { @@ -131,12 +127,11 @@ class TestListenerFlows(base.TestCase): self.assertIsInstance(listeners_flow, flow.Flow) self.assertIn(constants.LOADBALANCER, listeners_flow.requires) self.assertIn(constants.LOADBALANCER_ID, listeners_flow.requires) - self.assertIn(constants.AMPHORAE_STATUS, listeners_flow.requires) self.assertIn(constants.LOADBALANCER, listeners_flow.provides) self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, listeners_flow.provides) self.assertIn(constants.AMPHORAE, listeners_flow.provides) self.assertIn(constants.AMPHORA_FIREWALL_RULES, listeners_flow.provides) - self.assertEqual(3, len(listeners_flow.requires)) - self.assertEqual(5, len(listeners_flow.provides)) + self.assertEqual(2, len(listeners_flow.requires)) + self.assertEqual(6, len(listeners_flow.provides)) diff --git a/releasenotes/notes/Fix-Listener-Update-for-SRIOV-VIPs-8348b7fe0c02b9c4.yaml b/releasenotes/notes/Fix-Listener-Update-for-SRIOV-VIPs-8348b7fe0c02b9c4.yaml new file mode 100644 index 0000000000..1598881d83 --- /dev/null +++ b/releasenotes/notes/Fix-Listener-Update-for-SRIOV-VIPs-8348b7fe0c02b9c4.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixed an issue updating listeners when using SR-IOV VIP ports.