summaryrefslogtreecommitdiff
path: root/ironic/tests
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2018-06-21 16:16:45 +0100
committerMark Goddard <mark@stackhpc.com>2018-06-26 08:36:47 +0000
commit909cdce36dcc5dfa9264c974188e77560d945ced (patch)
treebf5a01677869fb0a8c7315a5b984397b2951f003 /ironic/tests
parent00102e3e46c7bda873c9975364ea07f22c34d12d (diff)
downloadironic-909cdce36dcc5dfa9264c974188e77560d945ced.tar.gz
Fix error when deleting a non-existent port
Fixes an issue seen during node tear down where a port being deleted by the Bare Metal service could be deleted by the Compute service, leading to an unhandled error from the Networking service. This change simply ignores the PortNotFoundClient exception raises, as is done when attempting to unbind a port that does not exist. See [1] for details. [1] https://storyboard.openstack.org/#!/story/2002637> Change-Id: Icd2aaa1276e75f08f99553bbc9a873102d896fb9 Story: 2002637 Task: 22285 (cherry picked from commit bfed31bb4c599b7063da80798db8078a64c13368)
Diffstat (limited to 'ironic/tests')
-rw-r--r--ironic/tests/unit/common/test_neutron.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ironic/tests/unit/common/test_neutron.py b/ironic/tests/unit/common/test_neutron.py
index 181c9299e..ce17933b0 100644
--- a/ironic/tests/unit/common/test_neutron.py
+++ b/ironic/tests/unit/common/test_neutron.py
@@ -390,6 +390,18 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
self.client_mock.delete_port.assert_called_once_with(
self.neutron_port['id'])
+ def test_remove_neutron_ports_delete_race(self):
+ with task_manager.acquire(self.context, self.node.uuid) as task:
+ self.client_mock.delete_port.side_effect = \
+ neutron_client_exc.PortNotFoundClient
+ self.client_mock.list_ports.return_value = {
+ 'ports': [self.neutron_port]}
+ neutron.remove_neutron_ports(task, {'param': 'value'})
+ self.client_mock.list_ports.assert_called_once_with(
+ **{'param': 'value'})
+ self.client_mock.delete_port.assert_called_once_with(
+ self.neutron_port['id'])
+
def test_get_node_portmap(self):
with task_manager.acquire(self.context, self.node.uuid) as task:
portmap = neutron.get_node_portmap(task)