Skip to content

feat: Reduce machine inventory size by filtering irrelevant network interfaces - #4703

Open
terickson-nvidia wants to merge 3 commits into
NVIDIA:mainfrom
terickson-nvidia:tom/network-interfaces
Open

feat: Reduce machine inventory size by filtering irrelevant network interfaces#4703
terickson-nvidia wants to merge 3 commits into
NVIDIA:mainfrom
terickson-nvidia:tom/network-interfaces

Conversation

@terickson-nvidia

@terickson-nvidia terickson-nvidia commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

For better scaling, this PR reduces the amount of network interface data transmitted and persisted by filtering out interfaces that are not useful to the host inventory model. It reuses the existing filtering approach for InfiniBand interfaces by excluding interfaces that have

  1. the MELLANOX_SF_VF_MAC_ADDRESS_IN sentinel mac_address indicating that the interface has no real MAC address, OR
  2. virtfn PCI path that indicates a virtual function (VF) regardless of mac address

The filter is applied in scout. BMC-facing interfaces are already excluded by the existing filter in enumerate_hardware_inner() before they reach scout's filter.

Related issues

#2936

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

The migration path for existing machines that already have oversized network interface inventory would be to trigger re-discovery.

@terickson-nvidia
terickson-nvidia requested a review from a team as a code owner August 7, 2026 16:09
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • Bug Fixes
    • Improved hardware detection by excluding auxiliary and virtual network interfaces from registration.
    • Preserved valid physical and scalable network interfaces, including when PCI details are unavailable.
    • Added coverage for mixed hardware configurations to ensure correct interface selection.

Walkthrough

The hardware registration flow now filters auxiliary network interfaces. It removes interfaces with the ch:64 MAC or a virtfn PCI path before machine registration. Tests verify classification and retention of valid interfaces.

Changes

Auxiliary Interface Filtering

Layer / File(s) Summary
Classify and filter auxiliary interfaces
crates/scout/src/register.rs
The registration flow identifies auxiliary interfaces by MAC address or PCI path and removes them before machine registration.
Validate interface retention and removal
crates/scout/src/register.rs
Tests cover physical functions, regular NICs, scalable functions, virtual functions, missing PCI properties, and mixed-interface results.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: filtering irrelevant network interfaces to reduce machine inventory size.
Description check ✅ Passed The description directly explains the filtering criteria, implementation location, testing, and migration path for the changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/scout/src/register.rs (1)

249-316: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a table for interface classification cases.

These tests invoke is_auxiliary_interface repeatedly with different inputs and expected results. Replace the separate cases with one value_scenarios! table. Keep the mixed-list retain test standalone because it tests filtering integration.

As per coding guidelines, use a table whenever two or more tests invoke the same operation with different inputs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/scout/src/register.rs` around lines 249 - 316, Replace the individual
classification tests around is_auxiliary_interface with one value_scenarios!
table containing each interface fixture and its expected boolean result.
Preserve coverage for DPU PFs, regular host NICs, sentinel-MAC SFs, virtfn VFs,
combined VF cases, and missing pci_properties; keep the mixed-list retain test
standalone.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/scout/src/register.rs`:
- Around line 34-38: Update the is_vf_path calculation in register.rs to inspect
only the PCI portion of p.path and identify a virtfn* path component rather than
matching arbitrary text. Preserve physical interfaces such as paths ending in
/net/virtfn0, and add a regression case confirming that /net/virtfn0 remains
registered.

---

Nitpick comments:
In `@crates/scout/src/register.rs`:
- Around line 249-316: Replace the individual classification tests around
is_auxiliary_interface with one value_scenarios! table containing each interface
fixture and its expected boolean result. Preserve coverage for DPU PFs, regular
host NICs, sentinel-MAC SFs, virtfn VFs, combined VF cases, and missing
pci_properties; keep the mixed-list retain test standalone.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7dedca36-d711-43dd-90e6-60b506a0e3a4

📥 Commits

Reviewing files that changed from the base of the PR and between 1a34f8d and a0e5f89.

📒 Files selected for processing (1)
  • crates/scout/src/register.rs

Comment thread crates/scout/src/register.rs
Comment thread crates/scout/src/register.rs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
crates/scout/src/register.rs (1)

310-319: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a table-driven classification test.

is_auxiliary_interface is a total operation, and the test module invokes it with several different inputs. Add interface_named_virtfn_with_real_mac_is_kept to the same table as the existing PF, SF, VF, and missing-property cases. Use value_scenarios!, or a direct table when the macro would obscure the cases.

This removes repeated setup and keeps expected classifications together.

As per coding guidelines: “Use a table whenever two or more tests invoke the same operation with different inputs.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/scout/src/register.rs` around lines 310 - 319, Consolidate the
standalone interface_named_virtfn_with_real_mac_is_kept test into the existing
table-driven classification test for is_auxiliary_interface, alongside the PF,
SF, VF, and missing-property scenarios. Reuse the table’s established setup and
add this input with an expected non-auxiliary result, using value_scenarios! or
a direct table without obscuring the cases.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/scout/src/register.rs`:
- Around line 310-319: Consolidate the standalone
interface_named_virtfn_with_real_mac_is_kept test into the existing table-driven
classification test for is_auxiliary_interface, alongside the PF, SF, VF, and
missing-property scenarios. Reuse the table’s established setup and add this
input with an expected non-auxiliary result, using value_scenarios! or a direct
table without obscuring the cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 623008b6-3985-42be-b5d3-257be6869740

📥 Commits

Reviewing files that changed from the base of the PR and between a0e5f89 and 7cb46a4.

📒 Files selected for processing (1)
  • crates/scout/src/register.rs

@terickson-nvidia terickson-nvidia self-assigned this Aug 7, 2026
@thossain-nv thossain-nv changed the title Reduce machine inventory size by filtering irrelevant network interfaces feat: Reduce machine inventory size by filtering irrelevant network interfaces Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants