summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-10-17 13:53:59 +0000
committerGerrit Code Review <review@openstack.org>2017-10-17 13:54:00 +0000
commit185035e105f102ce637a820a405a391de9a4beac (patch)
treee63f5e2674067f4235056ce59d0564f7d5544deb
parentd6934de3ebf102162678b24c130c51128453e4f2 (diff)
parent71d1c26376c84783e2c0176b9222e0343df701eb (diff)
downloadironic-185035e105f102ce637a820a405a391de9a4beac.tar.gz
Merge "Skip PortNotFound when unbinding port" into stable/ocata
-rw-r--r--ironic/common/neutron.py3
-rw-r--r--ironic/tests/unit/common/test_neutron.py18
-rw-r--r--releasenotes/notes/ignore-port-not-found-when-unbinding-94fb63988e98cb21.yaml8
3 files changed, 29 insertions, 0 deletions
diff --git a/ironic/common/neutron.py b/ironic/common/neutron.py
index bf4294274..a9918dcb4 100644
--- a/ironic/common/neutron.py
+++ b/ironic/common/neutron.py
@@ -88,6 +88,9 @@ def unbind_neutron_port(port_id, client=None):
try:
client.update_port(port_id, body)
+ # NOTE(vsaienko): Ignore if port was deleted before calling vif detach.
+ except neutron_exceptions.PortNotFoundClient:
+ LOG.info('Port %s was not found while unbinding.', port_id)
except neutron_exceptions.NeutronClientException as e:
msg = (_('Unable to clear binding profile for '
'neutron port %(port_id)s. Error: '
diff --git a/ironic/tests/unit/common/test_neutron.py b/ironic/tests/unit/common/test_neutron.py
index 737667c51..5bba84d50 100644
--- a/ironic/tests/unit/common/test_neutron.py
+++ b/ironic/tests/unit/common/test_neutron.py
@@ -686,3 +686,21 @@ class TestUnbindPort(base.TestCase):
mock_client.assert_called_once_with()
mock_client.return_value.update_port.assert_called_once_with(port_id,
body)
+
+ @mock.patch.object(neutron, 'LOG')
+ def test_unbind_neutron_port_not_found(self, mock_log, mock_client):
+ port_id = 'fake-port-id'
+ mock_client.return_value.update_port.side_effect = (
+ neutron_client_exc.PortNotFoundClient())
+ body = {
+ 'port': {
+ 'binding:host_id': '',
+ 'binding:profile': {}
+ }
+ }
+ neutron.unbind_neutron_port(port_id)
+ mock_client.assert_called_once_with()
+ mock_client.return_value.update_port.assert_called_once_with(port_id,
+ body)
+ mock_log.info.assert_called_once_with('Port %s was not found while '
+ 'unbinding.', port_id)
diff --git a/releasenotes/notes/ignore-port-not-found-when-unbinding-94fb63988e98cb21.yaml b/releasenotes/notes/ignore-port-not-found-when-unbinding-94fb63988e98cb21.yaml
new file mode 100644
index 000000000..30e63af7b
--- /dev/null
+++ b/releasenotes/notes/ignore-port-not-found-when-unbinding-94fb63988e98cb21.yaml
@@ -0,0 +1,8 @@
+---
+fixes:
+ - Fixes a failure when deploying a node. This happened when a port or port
+ group's internal_info['tenant_vif_port_id'] still existed after the
+ corresponding neutron port was removed and prior to deletion of the
+ instance, causing future deployments of the bare metal node to fail. The
+ situation is now logged and does not block future deployments. See
+ https://bugs.launchpad.net/ironic/+bug/1685592 for details.