summaryrefslogtreecommitdiff
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:55 +0000
commit27fea91b0bc4e26fb25d147339376945b2c5a252 (patch)
tree35393fd5f98a07d778d4a593b31f872586a0b247
parent00914c802ded15a6ad4643a1a8b277a5342ed5a6 (diff)
Fix error when deleting a non-existent portstable/ocata
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)
Notes
Notes (review): Code-Review+2: Dmitry Tantsur <divius.inside@gmail.com> Code-Review+2: Ruby Loo <opensrloo@gmail.com> Workflow+1: Ruby Loo <opensrloo@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 26 Jun 2018 13:53:47 +0000 Reviewed-on: https://review.openstack.org/578027 Project: openstack/ironic Branch: refs/heads/stable/ocata
-rw-r--r--ironic/common/neutron.py3
-rw-r--r--ironic/tests/unit/common/test_neutron.py12
-rw-r--r--releasenotes/notes/story-2002637-4825d60b096e475b.yaml7
3 files changed, 22 insertions, 0 deletions
diff --git a/ironic/common/neutron.py b/ironic/common/neutron.py
index a9918dc..b274887 100644
--- a/ironic/common/neutron.py
+++ b/ironic/common/neutron.py
@@ -310,6 +310,9 @@ def remove_neutron_ports(task, params):
310 310
311 try: 311 try:
312 client.delete_port(port['id']) 312 client.delete_port(port['id'])
313 # NOTE(mgoddard): Ignore if the port was deleted by nova.
314 except neutron_exceptions.PortNotFoundClient:
315 LOG.info('Port %s was not found while deleting.', port['id'])
313 except neutron_exceptions.NeutronClientException as e: 316 except neutron_exceptions.NeutronClientException as e:
314 msg = (_('Could not remove VIF %(vif)s of node %(node)s, possibly ' 317 msg = (_('Could not remove VIF %(vif)s of node %(node)s, possibly '
315 'a network issue: %(exc)s') % 318 'a network issue: %(exc)s') %
diff --git a/ironic/tests/unit/common/test_neutron.py b/ironic/tests/unit/common/test_neutron.py
index 5bba84d..a6094e0 100644
--- a/ironic/tests/unit/common/test_neutron.py
+++ b/ironic/tests/unit/common/test_neutron.py
@@ -438,6 +438,18 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
438 self.client_mock.delete_port.assert_called_once_with( 438 self.client_mock.delete_port.assert_called_once_with(
439 self.neutron_port['id']) 439 self.neutron_port['id'])
440 440
441 def test_remove_neutron_ports_delete_race(self):
442 with task_manager.acquire(self.context, self.node.uuid) as task:
443 self.client_mock.delete_port.side_effect = \
444 neutron_client_exc.PortNotFoundClient
445 self.client_mock.list_ports.return_value = {
446 'ports': [self.neutron_port]}
447 neutron.remove_neutron_ports(task, {'param': 'value'})
448 self.client_mock.list_ports.assert_called_once_with(
449 **{'param': 'value'})
450 self.client_mock.delete_port.assert_called_once_with(
451 self.neutron_port['id'])
452
441 def test_get_node_portmap(self): 453 def test_get_node_portmap(self):
442 with task_manager.acquire(self.context, self.node.uuid) as task: 454 with task_manager.acquire(self.context, self.node.uuid) as task:
443 portmap = neutron.get_node_portmap(task) 455 portmap = neutron.get_node_portmap(task)
diff --git a/releasenotes/notes/story-2002637-4825d60b096e475b.yaml b/releasenotes/notes/story-2002637-4825d60b096e475b.yaml
new file mode 100644
index 0000000..cd86d7e
--- /dev/null
+++ b/releasenotes/notes/story-2002637-4825d60b096e475b.yaml
@@ -0,0 +1,7 @@
1---
2fixes:
3 - |
4 Fixes an issue seen during node tear down where a port being deleted by the
5 Bare Metal service could be deleted by the Compute service, leading to an
6 unhandled error from the Networking service. See `story 2002637
7 <https://storyboard.openstack.org/#!/story/2002637>`__ for further details.