← Back to Pull requests

fix(nic-health-monitor): classify NICs by PCI address so RDMA renames cannot swap roles #2522

Open
unknown opened this pull request with 585 lines diff across 7 files
View on GitHub
unknown unknown commented on Nov 24, 2026 07:47 UTC
Author

Summary

Fixes #2521.

nic_topology in gpu_metadata.json is keyed by RDMA device name, and those names are not stable: on the reporter's nodes a cloud agent renames every RDMA device about 100 seconds after boot, and the rename is a permutation — each old name still exists afterwards, on a different device. When the metadata collector writes the file before the rename, the NIC health monitor resolves each device's current name to another device's topology row, classifies a healthy by-design-down Ethernet card as compute, and emits a fatal REPLACE_VM event.

This change records the topology by physical device, following the approach the issue suggests:

  • metadata-collector resolves each NIC Legend name to its PCI address through /sys/class/infiniband/<name>/device/uevent (PCI_SLOT_NAME, the same source the monitor already reads) and publishes the mapping as a new nic_topology_pci_addresses field next to nic_topology. It snapshots the name-to-address map before and after the nvidia-smi topo -m run and collects again (bounded, 3 attempts) when the pairing moved during the run, closing the window where a rename lands mid-collection.

  • nic-health-monitor builds a PCI-address index from the new field at load and resolves each device's topology row through the device's own PCI address. A rename after collection can no longer hand a device another device's row.

  • The classification rules themselves are unchanged.
  • Backwards compatibility: the new field is additive and optional. Files written by older collectors do not carry it, and the monitor then keeps the exact name-keyed behaviour it has today; older monitors ignore the field. No protobuf, CRD, Helm value, metric, or label changes.

    This change was prepared with AI assistance; I have reviewed and tested the full diff.

    Type of Change


  • 🐛 Bug fix

  • ✨ New feature

  • 💥 Breaking change

  • 📚 Documentation

  • 🔧 Refactoring

  • 🔨 Build/CI
  • Component(s) Affected


  • Health Monitor

  • Core Service

  • Fault Management

  • Janitor

  • Deployment/Config

  • API/Interface

  • Preflight

  • Plugins

  • Documentation/CI

  • New Component

  • Multiple Components

  • Other
  • Testing


  • Tests pass locally

  • Manual testing completed

  • No breaking changes (or documented)
  • New tests:

  • TestClassify_RenamedRDMADevices_UsesPCIAddressRow (nic-health-monitor): reproduces the issue's rename scenario — a file written with boot-time names plus PCI addresses, read in the post-rename world. The device at 0000:9a:00.0 keeps its own NODE row (storage) instead of the stale mlx5_7 PXB row (compute), and 0000:41:00.0 keeps its compute row under its new name. It fails on the pre-fix classifier and passes with this change.

  • TestClassify_NoPCIAddressesInFile_KeepsNameKeyedBehaviour: control proving files without the new field classify exactly as before.

  • Collector tests for publishing the address map (restricted to published rows, absent when not collected) and unit tests for the sysfs snapshot helpers, including the rename-detection cases (swap, appear, disappear).
  • Suites run locally: full nic-health-monitor module (all packages pass, topology also under -race), metadata-collector packages pkg/nic and pkg/collector, and data-models builds. One pre-existing failure is unrelated to this change: pkg/mapper's TestHostMapper_SeparateCredentials_RequiresPodPatchPermission needs envtest control-plane binaries (/usr/local/kubebuilder/bin/etcd), which are not installed on my machine; it fails identically on unmodified main. I could not run make lint-test-all locally for the same tooling reason (golangci-lint is provisioned by make dev-env-setup); go vet and gofmt are clean on the changed packages.

    Checklist


  • Self-review completed

  • Documentation updated (if needed)

  • Ready for review
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    NIC topology metadata now records PCI addresses when available, limited to devices included in the collected topology.
    Health classification can match topology rows by PCI address when RDMA device names change. Older metadata continues to use name-based lookup; when a recorded address no longer matches, classification falls back to NUMA-based behavior.
    Topology collection retries up to three times if device addresses change during a scan. If addresses cannot be read or remain unstable, collection can proceed without PCI-address metadata.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 585 lines (+438 / -147) across 7 files Reviewer: KaivalyaMDabhadkar Review duration: 10211m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 585 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.381
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #2522"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.9% (MEDIUM) · Higher = larger blast radius
    49.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.6% · Safe to merge
    26.6%