summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-09-19 18:52:22 +0000
committerGerrit Code Review <review@openstack.org>2018-09-19 18:52:23 +0000
commit94d03ef7a918208b7dd3012b20bb5dc45d137239 (patch)
treeab5dc6c9911edf712c6c58c3917f59160b2b8188
parent6c107103790b52e11e9d6029fd3e948bd0ce33d6 (diff)
parentd2d24dd80ef7661bf4f273f3645f2cfe1ab6a161 (diff)
downloadironic-94d03ef7a918208b7dd3012b20bb5dc45d137239.tar.gz
Merge "Don't validate local_link_connection when port has client-id" into stable/ocata
-rw-r--r--ironic/common/neutron.py6
-rw-r--r--ironic/tests/unit/common/test_neutron.py27
-rw-r--r--releasenotes/notes/dont-validate-local_link_connection-when-port-has-client-id-8e584586dc4fca50.yaml7
3 files changed, 40 insertions, 0 deletions
diff --git a/ironic/common/neutron.py b/ironic/common/neutron.py
index b27488744..81c6ff7f6 100644
--- a/ironic/common/neutron.py
+++ b/ironic/common/neutron.py
@@ -410,6 +410,12 @@ def validate_port_info(node, port):
:param port: Ironic port object.
:returns: True if port info is valid, False otherwise.
"""
+ # Note(moshele): client-id in the port extra field indicates an InfiniBand
+ # port. In this case we don't require local_link_connection to be
+ # populated because the network topology is discoverable by the Infiniband
+ # Subnet Manager.
+ if port.extra.get('client-id'):
+ return True
if (node.network_interface == 'neutron' and
not port.local_link_connection):
LOG.warning(_LW("The local_link_connection is required for "
diff --git a/ironic/tests/unit/common/test_neutron.py b/ironic/tests/unit/common/test_neutron.py
index a6094e019..a18699a15 100644
--- a/ironic/tests/unit/common/test_neutron.py
+++ b/ironic/tests/unit/common/test_neutron.py
@@ -507,6 +507,33 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
self.assertTrue(res)
self.assertFalse(log_mock.warning.called)
+ @mock.patch.object(neutron, 'LOG', autospec=True)
+ def test_validate_port_info_flat_interface_with_client_id(self, log_mock):
+ self.node.network_interface = 'flat'
+ self.node.save()
+ llc = {}
+ port = object_utils.create_test_port(
+ self.context, node_id=self.node.id, uuid=uuidutils.generate_uuid(),
+ address='52:54:00:cf:2d:33', local_link_connection=llc,
+ extra={'client-id': self._CLIENT_ID})
+ res = neutron.validate_port_info(self.node, port)
+ self.assertTrue(res)
+ self.assertFalse(log_mock.warning.called)
+
+ @mock.patch.object(neutron, 'LOG', autospec=True)
+ def test_validate_port_info_neutron_interface_with_client_id(
+ self, log_mock):
+ self.node.network_interface = 'neutron'
+ self.node.save()
+ llc = {}
+ port = object_utils.create_test_port(
+ self.context, node_id=self.node.id, uuid=uuidutils.generate_uuid(),
+ address='52:54:00:cf:2d:33', local_link_connection=llc,
+ extra={'client-id': self._CLIENT_ID})
+ res = neutron.validate_port_info(self.node, port)
+ self.assertTrue(res)
+ self.assertFalse(log_mock.warning.called)
+
@mock.patch.object(neutron, 'get_client', autospec=True)
class TestValidateNetwork(base.TestCase):
diff --git a/releasenotes/notes/dont-validate-local_link_connection-when-port-has-client-id-8e584586dc4fca50.yaml b/releasenotes/notes/dont-validate-local_link_connection-when-port-has-client-id-8e584586dc4fca50.yaml
new file mode 100644
index 000000000..d7d83bb89
--- /dev/null
+++ b/releasenotes/notes/dont-validate-local_link_connection-when-port-has-client-id-8e584586dc4fca50.yaml
@@ -0,0 +1,7 @@
+---
+fixes:
+ - |
+ Fixes an issue with validation of Infiniband ports. Infiniband ports do not
+ require the ``local_link_connection`` field to be populated as the network
+ topology is discoverable by the Infiniband Subnet Manager. See `bug 1753222
+ <https://launchpad.net/bugs/1753222>`_ for details.