From 5815100e2f8e3318601f76f72e7bfd46549cef69 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Thu, 12 Mar 2026 13:48:55 +0300 Subject: [PATCH] exporter: filter Supermicro Redfish device-bound firmware from hardware.firmware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit isDeviceBoundFirmwareName did not catch Supermicro FirmwareInventory naming conventions where a digit follows the type prefix directly ("GPU1 System Slot0", "NIC1 System Slot0 AOM-DP805-IO") instead of a space. Also missing: "Power supply N", "NVMeController N", and "Software Inventory" (generic label for all HGX per-component firmware slots — GPU, NVSwitch, PCIeRetimer, ERoT, InfoROM, etc.). On SYS-A21GE-NBRT (HGX B200) this caused 29 device-bound entries to leak into hardware.firmware: 8 GPU, 9 NIC, 1 NVMe, 6 PSU, 4 PCIeSwitch, 1 Software Inventory. Fix: extend isDeviceBoundFirmwareName with patterns for all four new cases. Add TestIsDeviceBoundFirmwareName covering both excluded and kept entries. Co-Authored-By: Claude Sonnet 4.6 --- internal/exporter/reanimator_converter.go | 12 +++++ .../exporter/reanimator_converter_test.go | 51 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/internal/exporter/reanimator_converter.go b/internal/exporter/reanimator_converter.go index 9791396..81778db 100644 --- a/internal/exporter/reanimator_converter.go +++ b/internal/exporter/reanimator_converter.go @@ -735,6 +735,18 @@ func isDeviceBoundFirmwareName(name string) bool { strings.HasPrefix(n, "ssd ") || strings.HasPrefix(n, "nvme ") || strings.HasPrefix(n, "psu") || + // Supermicro Redfish FirmwareInventory names "GPU1 System Slot0", "NIC1 System Slot0 ..." + // where the number follows immediately after the type prefix (no space separator). + (strings.HasPrefix(n, "gpu") && len(n) > 3 && n[3] >= '0' && n[3] <= '9') || + (strings.HasPrefix(n, "nic") && len(n) > 3 && n[3] >= '0' && n[3] <= '9') || + // "NVMeController1" — storage controller bound to an NVMe device slot + strings.HasPrefix(n, "nvmecontroller") || + // "Power supply N" — Supermicro PSU firmware (distinct from generic "PSU" prefix) + strings.HasPrefix(n, "power supply") || + // "Software Inventory" — generic label used by HGX baseboard for all per-component + // firmware slots (GPU, NVSwitch, PCIeRetimer, ERoT, InfoROM, etc.). The useful name + // is only in the inventory item Id, not the Name field, so the entry is not actionable. + n == "software inventory" || // HGX baseboard firmware inventory IDs for device-bound components strings.Contains(n, "_fw_gpu_") || strings.Contains(n, "_fw_nvswitch_") || diff --git a/internal/exporter/reanimator_converter_test.go b/internal/exporter/reanimator_converter_test.go index 911a1e1..35900eb 100644 --- a/internal/exporter/reanimator_converter_test.go +++ b/internal/exporter/reanimator_converter_test.go @@ -881,3 +881,54 @@ func TestConvertToReanimator_PreservesVitalsAcrossCanonicalDedup(t *testing.T) { } func boolPtr(v bool) *bool { return &v } + +// TestIsDeviceBoundFirmwareName verifies that device-bound firmware entries from +// Supermicro Redfish FirmwareInventory are correctly identified and excluded from +// hardware.firmware. +// +// Regression guard: names like "GPU1 System Slot0" and "NIC1 System Slot0 ..." were +// not caught because the old check required "gpu " / "nic " (with space), while +// Supermicro places a digit immediately after the type prefix. (2026-03-12) +func TestIsDeviceBoundFirmwareName(t *testing.T) { + cases := []struct { + name string + want bool + }{ + // Supermicro Redfish — device-bound, must be excluded + {"GPU1 System Slot0", true}, + {"GPU8 System Slot0", true}, + {"NIC1 System Slot0 AOM-DP805-IO", true}, + {"NIC9 System Slot8 MCX75310AAS-NEAT", true}, + {"NVMeController1", true}, + {"Power supply 1", true}, + {"Power supply 6", true}, + {"Software Inventory", true}, + {"software inventory", true}, // case-insensitive + // Generic / legacy names already covered before this fix + {"GPU SomeDevice", true}, + {"NIC OnboardLAN", true}, + {"PSU1", true}, + {"NVMe Drive", true}, + // HGX FW ID patterns (in case Id is used as name) + {"HGX_FW_GPU_SXM_1", true}, + {"HGX_InfoROM_GPU_SXM_2", true}, + // System-level firmware — must NOT be excluded + {"BIOS", false}, + {"BMC", false}, + {"BMC Backup", false}, + {"Capsule BIOS", false}, + {"Capsule ME", false}, + {"CPLD Motherboard Golden", false}, + {"CPLD AOMboard", false}, + {"FrontFanboard CPLD", false}, + {"Motherboard PCIeSwitch 1", false}, // board-integrated, no device record + {"SecureBoot", false}, + {"BIOS ME", false}, + } + for _, tc := range cases { + got := isDeviceBoundFirmwareName(tc.name) + if got != tc.want { + t.Errorf("isDeviceBoundFirmwareName(%q) = %v, want %v", tc.name, got, tc.want) + } + } +}