Skip to content

Commit 8d27a62

Browse files
authored
Merge pull request #1380 from rackerlabs/fix-inspect-fail
fix(ironic): avoid inspection failure due to missing ports
2 parents 7f56558 + 7146067 commit 8d27a62

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 0df5807ead5570ab662db0e9d36e6e019b2cd850 Mon Sep 17 00:00:00 2001
2+
From: Doug Goldstein <[email protected]>
3+
Date: Thu, 6 Nov 2025 16:11:55 -0600
4+
Subject: [PATCH] fix: local_link_connection inspection hook does not fail on
5+
missing port
6+
7+
The code intended to not fail when a Port object was missing but to
8+
instead skip the handling of that node but instead there is an unhandled
9+
exception because the get_by_address() method throws PortNotFound
10+
instead of returning None when a port couldn't be found.
11+
12+
Change-Id: I04dfa09ada7e6a9d22ba16051cb5737daf3bc668
13+
Signed-off-by: Doug Goldstein <[email protected]>
14+
---
15+
.../modules/inspector/hooks/local_link_connection.py | 6 ++++--
16+
...t-hook-local-link-connection-crash-394edb1c35354968.yaml | 6 ++++++
17+
2 files changed, 10 insertions(+), 2 deletions(-)
18+
create mode 100644 releasenotes/notes/inspect-hook-local-link-connection-crash-394edb1c35354968.yaml
19+
20+
diff --git a/ironic/drivers/modules/inspector/hooks/local_link_connection.py b/ironic/drivers/modules/inspector/hooks/local_link_connection.py
21+
index a3fb9fc71..17bc82f01 100644
22+
--- a/ironic/drivers/modules/inspector/hooks/local_link_connection.py
23+
+++ b/ironic/drivers/modules/inspector/hooks/local_link_connection.py
24+
@@ -117,8 +117,10 @@ class LocalLinkConnectionHook(base.InspectionHook):
25+
continue
26+
27+
mac_address = iface['mac_address']
28+
- port = ironic_port.Port.get_by_address(task.context, mac_address)
29+
- if not port:
30+
+ try:
31+
+ port = ironic_port.Port.get_by_address(task.context,
32+
+ mac_address)
33+
+ except exception.PortNotFound:
34+
LOG.debug('Skipping LLDP processing for interface %s of node '
35+
'%s: matching port not found in Ironic.',
36+
mac_address, task.node.uuid)

containers/ironic/patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
0001-storage-controller_mode-update.patch
33
0001-pass-along-physical_network-to-neutron-from-the-bare.patch
44
0001-Solve-IPMI-call-issue-results-in-UTF-8-format-error-.patch
5+
0001-fix-local_link_connection-inspection-hook-does-not-f.patch

0 commit comments

Comments
 (0)