Merge "Fix listener update when using SRIOV VIP"

This commit is contained in:
Zuul 2024-05-15 18:08:58 +00:00 committed by Gerrit Code Review
commit b43620cfa8
3 changed files with 31 additions and 20 deletions

View File

@ -161,7 +161,7 @@ class ListenerFlows:
return update_listener_flow 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. """Creates a subflow that updates the firewall rules in the amphorae.
:returns: The subflow for updating 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, requires=constants.LOADBALANCER_ID,
provides=constants.AMPHORAE)) 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( fw_rules_subflow.add(network_tasks.GetAmphoraeNetworkConfigs(
name=sf_name + '-' + constants.GET_AMP_NETWORK_CONFIG, name=sf_name + '-' + constants.GET_AMP_NETWORK_CONFIG,
requires=constants.LOADBALANCER_ID, requires=constants.LOADBALANCER_ID,
@ -192,8 +200,10 @@ class ListenerFlows:
amp_0_subflow.add(amphora_driver_tasks.SetAmphoraFirewallRules( amp_0_subflow.add(amphora_driver_tasks.SetAmphoraFirewallRules(
name=sf_name + '-0-' + constants.SET_AMPHORA_FIREWALL_RULES, name=sf_name + '-0-' + constants.SET_AMPHORA_FIREWALL_RULES,
requires=(constants.AMPHORAE, constants.AMPHORA_FIREWALL_RULES), requires=(constants.AMPHORAE, constants.AMPHORA_FIREWALL_RULES,
inject={constants.AMPHORA_INDEX: 0})) constants.AMPHORAE_STATUS),
inject={constants.AMPHORA_INDEX: 0,
constants.TIMEOUT_DICT: timeout_dict}))
update_amps_subflow.add(amp_0_subflow) update_amps_subflow.add(amp_0_subflow)
@ -212,8 +222,10 @@ class ListenerFlows:
amp_1_subflow.add(amphora_driver_tasks.SetAmphoraFirewallRules( amp_1_subflow.add(amphora_driver_tasks.SetAmphoraFirewallRules(
name=sf_name + '-1-' + constants.SET_AMPHORA_FIREWALL_RULES, name=sf_name + '-1-' + constants.SET_AMPHORA_FIREWALL_RULES,
requires=(constants.AMPHORAE, requires=(constants.AMPHORAE,
constants.AMPHORA_FIREWALL_RULES), constants.AMPHORA_FIREWALL_RULES,
inject={constants.AMPHORA_INDEX: 1})) constants.AMPHORAE_STATUS),
inject={constants.AMPHORA_INDEX: 1,
constants.TIMEOUT_DICT: timeout_dict}))
update_amps_subflow.add(amp_1_subflow) update_amps_subflow.add(amp_1_subflow)

View File

@ -44,15 +44,14 @@ class TestListenerFlows(base.TestCase):
self.assertIn(constants.LISTENERS, listener_flow.requires) self.assertIn(constants.LISTENERS, listener_flow.requires)
self.assertIn(constants.LOADBALANCER_ID, 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, self.assertIn(constants.AMPHORAE_NETWORK_CONFIG,
listener_flow.provides) listener_flow.provides)
self.assertIn(constants.AMPHORAE, listener_flow.provides) self.assertIn(constants.AMPHORAE, listener_flow.provides)
self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides) self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides)
self.assertEqual(3, len(listener_flow.requires)) self.assertEqual(2, len(listener_flow.requires))
self.assertEqual(3, len(listener_flow.provides)) self.assertEqual(4, len(listener_flow.provides))
def test_get_delete_listener_flow(self, mock_get_net_driver): def test_get_delete_listener_flow(self, mock_get_net_driver):
flavor_dict = { flavor_dict = {
@ -66,15 +65,14 @@ class TestListenerFlows(base.TestCase):
self.assertIn(constants.LISTENER, listener_flow.requires) self.assertIn(constants.LISTENER, listener_flow.requires)
self.assertIn(constants.LOADBALANCER_ID, listener_flow.requires) self.assertIn(constants.LOADBALANCER_ID, listener_flow.requires)
self.assertIn(constants.PROJECT_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, self.assertIn(constants.AMPHORAE_NETWORK_CONFIG,
listener_flow.provides) listener_flow.provides)
self.assertIn(constants.AMPHORAE, listener_flow.provides) self.assertIn(constants.AMPHORAE, listener_flow.provides)
self.assertIn(constants.AMPHORA_FIREWALL_RULES, 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.requires))
self.assertEqual(3, len(listener_flow.provides)) self.assertEqual(4, len(listener_flow.provides))
def test_get_delete_listener_internal_flow(self, mock_get_net_driver): def test_get_delete_listener_internal_flow(self, mock_get_net_driver):
flavor_dict = { flavor_dict = {
@ -88,15 +86,14 @@ class TestListenerFlows(base.TestCase):
self.assertIn(constants.LOADBALANCER_ID, listener_flow.requires) self.assertIn(constants.LOADBALANCER_ID, listener_flow.requires)
self.assertIn(constants.PROJECT_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, self.assertIn(constants.AMPHORAE_NETWORK_CONFIG,
listener_flow.provides) listener_flow.provides)
self.assertIn(constants.AMPHORAE, listener_flow.provides) self.assertIn(constants.AMPHORAE, listener_flow.provides)
self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides) self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides)
self.assertEqual(3, len(listener_flow.requires)) self.assertEqual(2, len(listener_flow.requires))
self.assertEqual(3, len(listener_flow.provides)) self.assertEqual(4, len(listener_flow.provides))
def test_get_update_listener_flow(self, mock_get_net_driver): def test_get_update_listener_flow(self, mock_get_net_driver):
flavor_dict = { flavor_dict = {
@ -112,15 +109,14 @@ class TestListenerFlows(base.TestCase):
self.assertIn(constants.UPDATE_DICT, listener_flow.requires) self.assertIn(constants.UPDATE_DICT, listener_flow.requires)
self.assertIn(constants.LISTENERS, listener_flow.requires) self.assertIn(constants.LISTENERS, listener_flow.requires)
self.assertIn(constants.LOADBALANCER_ID, 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, self.assertIn(constants.AMPHORAE_NETWORK_CONFIG,
listener_flow.provides) listener_flow.provides)
self.assertIn(constants.AMPHORAE, listener_flow.provides) self.assertIn(constants.AMPHORAE, listener_flow.provides)
self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides) self.assertIn(constants.AMPHORA_FIREWALL_RULES, listener_flow.provides)
self.assertEqual(5, len(listener_flow.requires)) self.assertEqual(4, len(listener_flow.requires))
self.assertEqual(3, len(listener_flow.provides)) self.assertEqual(4, len(listener_flow.provides))
def test_get_create_all_listeners_flow(self, mock_get_net_driver): def test_get_create_all_listeners_flow(self, mock_get_net_driver):
flavor_dict = { flavor_dict = {
@ -131,12 +127,11 @@ class TestListenerFlows(base.TestCase):
self.assertIsInstance(listeners_flow, flow.Flow) self.assertIsInstance(listeners_flow, flow.Flow)
self.assertIn(constants.LOADBALANCER, listeners_flow.requires) self.assertIn(constants.LOADBALANCER, listeners_flow.requires)
self.assertIn(constants.LOADBALANCER_ID, 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.LOADBALANCER, listeners_flow.provides)
self.assertIn(constants.AMPHORAE_NETWORK_CONFIG, self.assertIn(constants.AMPHORAE_NETWORK_CONFIG,
listeners_flow.provides) listeners_flow.provides)
self.assertIn(constants.AMPHORAE, listeners_flow.provides) self.assertIn(constants.AMPHORAE, listeners_flow.provides)
self.assertIn(constants.AMPHORA_FIREWALL_RULES, self.assertIn(constants.AMPHORA_FIREWALL_RULES,
listeners_flow.provides) listeners_flow.provides)
self.assertEqual(3, len(listeners_flow.requires)) self.assertEqual(2, len(listeners_flow.requires))
self.assertEqual(5, len(listeners_flow.provides)) self.assertEqual(6, len(listeners_flow.provides))

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Fixed an issue updating listeners when using SR-IOV VIP ports.