Merge "Fix port abandonment on failover flow revert"

This commit is contained in:
Zuul 2024-04-29 13:01:48 +00:00 committed by Gerrit Code Review
commit 639aa813c5
3 changed files with 16 additions and 6 deletions

View File

@ -984,10 +984,9 @@ class CreateVIPBasePort(BaseNetworkTask):
return
try:
port_name = constants.AMP_BASE_PORT_PREFIX + amphora_id
for port in result:
self.network_driver.delete_port(port.id)
self.network_driver.delete_port(result[constants.ID])
LOG.info('Deleted port %s with ID %s for amphora %s due to a '
'revert.', port_name, port.id, amphora_id)
'revert.', port_name, result[constants.ID], amphora_id)
except Exception as e:
LOG.error('Failed to delete port %s. Resources may still be in '
'use for a port intended for amphora %s due to error '

View File

@ -1670,7 +1670,11 @@ class TestNetworkTasks(base.TestCase):
# Test revert
mock_driver.reset_mock()
net_task.revert([port_mock], vip_dict, VIP_SG_ID, AMP_ID,
# The execute path generates a port dict, so this will be the result
# passed into the revert method by Taskflow
port_dict = {constants.ID: PORT_ID}
net_task.revert(port_dict, vip_dict, VIP_SG_ID, AMP_ID,
additional_vips)
mock_driver.delete_port.assert_called_once_with(PORT_ID)
@ -1678,7 +1682,7 @@ class TestNetworkTasks(base.TestCase):
# Test revert exception
mock_driver.reset_mock()
net_task.revert([port_mock], vip_dict, VIP_SG_ID, AMP_ID,
net_task.revert(port_dict, vip_dict, VIP_SG_ID, AMP_ID,
additional_vips)
mock_driver.delete_port.assert_called_once_with(PORT_ID)

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixed an issue when a failover reverts, a neutron port may get abandoned.
The issue was logged with "Failed to delete port",
"Resources may still be in use for a port intended for amphora", and
"Search for a port named octavia-lb-vrrp-<uuid>".