From dc606b71320dcd96aff96cd6564387dac6d39d2c Mon Sep 17 00:00:00 2001 From: Arne Wiebalck Date: Tue, 26 Nov 2019 15:53:35 +0100 Subject: [PATCH] Get details when listing ports upon inspection of active nodes Add detail=True to make sure the inspector gets the node_uuid from the port list when inspecting active nodes, Change-Id: I1378a1a4d2a35ba8f182138877b5151f25d4c56d Story: #2006950 --- ironic_inspector/common/ironic.py | 2 +- ironic_inspector/test/unit/test_common_ironic.py | 12 ++++++++---- ..._uuid_for_manual_inspection-2fa3f11343cab417.yaml | 6 ++++++ 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/fix_node_uuid_for_manual_inspection-2fa3f11343cab417.yaml diff --git a/ironic_inspector/common/ironic.py b/ironic_inspector/common/ironic.py index 40c60e1aa..483665d61 100644 --- a/ironic_inspector/common/ironic.py +++ b/ironic_inspector/common/ironic.py @@ -217,7 +217,7 @@ def lookup_node_by_macs(macs, introspection_data=None, nodes = set() for mac in macs: - ports = ironic.port.list(address=mac) + ports = ironic.port.list(address=mac, fields=["uuid", "node_uuid"]) if not ports: continue elif fail: diff --git a/ironic_inspector/test/unit/test_common_ironic.py b/ironic_inspector/test/unit/test_common_ironic.py index a20c22218..3e60623d6 100644 --- a/ironic_inspector/test/unit/test_common_ironic.py +++ b/ironic_inspector/test/unit/test_common_ironic.py @@ -216,7 +216,8 @@ class TestLookupNode(base.NodeTest): uuid = ir_utils.lookup_node(macs=self.macs, ironic=self.ironic) self.assertEqual(self.node.uuid, uuid) self.ironic.port.list.assert_has_calls([ - mock.call(address=mac) for mac in self.macs + mock.call(address=mac, + fields=['uuid', 'node_uuid']) for mac in self.macs ]) def test_lookup_by_mac_duplicates(self): @@ -228,7 +229,8 @@ class TestLookupNode(base.NodeTest): ir_utils.lookup_node, macs=self.macs, ironic=self.ironic) self.ironic.port.list.assert_has_calls([ - mock.call(address=mac) for mac in self.macs + mock.call(address=mac, + fields=['uuid', 'node_uuid']) for mac in self.macs ]) def test_lookup_by_bmc_only(self): @@ -258,7 +260,8 @@ class TestLookupNode(base.NodeTest): ironic=self.ironic) self.assertEqual(self.node.uuid, uuid) self.ironic.port.list.assert_has_calls([ - mock.call(address=mac) for mac in self.macs + mock.call(address=mac, + fields=['uuid', 'node_uuid']) for mac in self.macs ]) self.assertEqual(1, self.ironic.node.list.call_count) @@ -273,6 +276,7 @@ class TestLookupNode(base.NodeTest): macs=self.macs, ironic=self.ironic) self.ironic.port.list.assert_has_calls([ - mock.call(address=mac) for mac in self.macs + mock.call(address=mac, + fields=['uuid', 'node_uuid']) for mac in self.macs ]) self.assertEqual(1, self.ironic.node.list.call_count) diff --git a/releasenotes/notes/fix_node_uuid_for_manual_inspection-2fa3f11343cab417.yaml b/releasenotes/notes/fix_node_uuid_for_manual_inspection-2fa3f11343cab417.yaml new file mode 100644 index 000000000..efe42296e --- /dev/null +++ b/releasenotes/notes/fix_node_uuid_for_manual_inspection-2fa3f11343cab417.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue during manual inspection of active nodes + where the node uuid was not passed back to the inspector + when it tried to identify a matching port.