Skip to content

refactor(site-explorer): clarify BlueField part-number checks#2909

Merged
poroh merged 1 commit into
NVIDIA:mainfrom
poroh:bluefield-part-number-checks
Jun 26, 2026
Merged

refactor(site-explorer): clarify BlueField part-number checks#2909
poroh merged 1 commit into
NVIDIA:mainfrom
poroh:bluefield-part-number-checks

Conversation

@poroh

@poroh poroh commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Rename BlueField detection helpers and call sites to reflect that they operate on Redfish part numbers rather than model strings.

Use the discovered DPU Card1 part number for fallback-serial mode heuristics, and keep explicit operator DPU mode handling independent of part-number availability. Tighten Lenovo BF3 DPU part-number matching and add coverage for Card1 part-number extraction.

Related issues

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

Rename BlueField detection helpers and call sites to reflect that they
operate on Redfish part numbers rather than model strings.

Use the discovered DPU Card1 part number for fallback-serial mode
heuristics, and keep explicit operator DPU mode handling independent of
part-number availability. Tighten Lenovo BF3 DPU part-number matching
and add coverage for Card1 part-number extraction.

Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
@poroh
poroh requested a review from a team as a code owner June 26, 2026 04:06
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • New Features

    • BlueField and BF3 device detection now uses part numbers for more accurate host/DPU classification.
    • DPU exploration can now surface a discovered DPU part number.
  • Bug Fixes

    • Improved handling of Lenovo-branded and other BlueField part numbers, including trimmed or whitespace-padded values.
    • Better fallback behavior when matching DPU mode and provisioning eligibility.
  • Tests

    • Added coverage for new part-number-based detection and classification scenarios.

Walkthrough

The PR replaces model-based BlueField detection with part-number-based checks across endpoint exploration, DPU mode selection, and downstream machine classification. It also adds a DPU part-number accessor and updates supporting tests.

Changes

BlueField part-number refactor

Layer / File(s) Summary
API model helpers and endpoint accessors
crates/api-model/src/site_explorer/mod.rs
EndpointExplorationReport::dpu_part_number() returns Card1 part numbers for DPU endpoints, and BlueField checks use part-number predicates across endpoint and PCIe device paths.
BF3 kind splitting and tests
crates/api-model/src/site_explorer/mod.rs
MlxDeviceKind::from_part_number() distinguishes BF3 NIC, DPU, and SuperNIC values by part-number prefix, with updated tests for Lenovo values and trimming.
Site-explorer wiring and mode checks
crates/site-explorer/src/lib.rs
Host matching, fallback DPU mode selection, and mode-check logging pass DPU part numbers through the new helper signatures and predicates.
Downstream BlueField consumers
crates/api-core/src/ipxe.rs, crates/api-model/src/machine/mod.rs
ARM machine typing and DPF provisioning feasibility now consult the part-number-based BlueField checks.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • NVIDIA/infra-controller#2809: This also adjusts crates/site-explorer/src/lib.rs BlueField identification logic, overlapping with the same host/DPU classification path.
  • NVIDIA/infra-controller#2833: This adds EndpointExplorationReport::has_bluefield_devices() and depends on PCIeDevice::is_bluefield(), which this PR changes to part-number-based matching.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main refactor toward BlueField part-number checks.
Description check ✅ Passed The description is clearly aligned with the refactor, matching the part-number-based detection and fallback changes.
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.
✨ 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/site-explorer/src/lib.rs (1)

2947-2963: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Preserve explicit DPU-mode requests separately from heuristics.

DpuMode::DpuMode currently depends on dpu_part_number to choose NicMode::Dpu. If an operator explicitly requests DPU mode and the part number is missing, this returns Ok(true) without issuing set_nic_mode(Dpu). Keep the mode source explicit-vs-default so only the implicit default uses the BF3 part-number heuristic.

🤖 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/site-explorer/src/lib.rs` around lines 2947 - 2963, The Nic mode
selection in the target_nic_mode logic is mixing explicit operator intent with
the BF3 part-number fallback, so an explicit DPU request can be dropped when
dpu_part_number is missing. Update the logic around host_dpu_mode and
target_nic_mode so explicit DpuMode::DpuMode requests resolve directly to
NicMode::Dpu, while only the implicit/default path uses
is_bf3_supernic_part_number and is_bf3_dpu_part_number heuristics. Keep the
existing mode-setting flow in this branch so set_nic_mode still runs whenever
the operator explicitly asked for DPU mode.
🤖 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/site-explorer/src/lib.rs`:
- Around line 1605-1608: The normal-mode check in check_and_configure_dpu_mode
is using the host-reported part_number instead of the DPU endpoint’s value,
which can skip the BF3 heuristic when the host field is missing. Update the call
site that builds mode_check to prefer dpu_ep’s reported Card1.part_number, and
only fall back to the host device part number if the DPU value is unavailable.
Keep the fix localized around the check_and_configure_dpu_mode invocation and
the related DPU endpoint parsing logic.

---

Outside diff comments:
In `@crates/site-explorer/src/lib.rs`:
- Around line 2947-2963: The Nic mode selection in the target_nic_mode logic is
mixing explicit operator intent with the BF3 part-number fallback, so an
explicit DPU request can be dropped when dpu_part_number is missing. Update the
logic around host_dpu_mode and target_nic_mode so explicit DpuMode::DpuMode
requests resolve directly to NicMode::Dpu, while only the implicit/default path
uses is_bf3_supernic_part_number and is_bf3_dpu_part_number heuristics. Keep the
existing mode-setting flow in this branch so set_nic_mode still runs whenever
the operator explicitly asked for DPU mode.
🪄 Autofix (Beta)

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: 29ee87eb-3b81-40da-98c9-686c559fb284

📥 Commits

Reviewing files that changed from the base of the PR and between 9e904ee and 507816b.

📒 Files selected for processing (4)
  • crates/api-core/src/ipxe.rs
  • crates/api-model/src/machine/mod.rs
  • crates/api-model/src/site_explorer/mod.rs
  • crates/site-explorer/src/lib.rs

Comment on lines +1605 to +1608
let mode_check = Some(
self.check_and_configure_dpu_mode(dpu_ep, part_number, host_dpu_mode, metrics)
.await,
),
None => None,
};
);

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use the DPU endpoint part number for normal mode checks.

Line 1606 still passes the host-reported device part number. If that PCIe/chassis field is absent while the discovered DPU BMC has Card1.part_number, the BF3 heuristic is skipped and the DPU can remain in the wrong mode. Prefer the DPU report value, falling back to the host device value only when needed.

Proposed fix
-        let mode_check = Some(
-            self.check_and_configure_dpu_mode(dpu_ep, part_number, host_dpu_mode, metrics)
-                .await,
-        );
+        let dpu_part_number = dpu_ep.report.dpu_part_number().or(part_number);
+        let mode_check = Some(
+            self.check_and_configure_dpu_mode(dpu_ep, dpu_part_number, host_dpu_mode, metrics)
+                .await,
+        );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let mode_check = Some(
self.check_and_configure_dpu_mode(dpu_ep, part_number, host_dpu_mode, metrics)
.await,
),
None => None,
};
);
let dpu_part_number = dpu_ep.report.dpu_part_number().or(part_number);
let mode_check = Some(
self.check_and_configure_dpu_mode(dpu_ep, dpu_part_number, host_dpu_mode, metrics)
.await,
);
🤖 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/site-explorer/src/lib.rs` around lines 1605 - 1608, The normal-mode
check in check_and_configure_dpu_mode is using the host-reported part_number
instead of the DPU endpoint’s value, which can skip the BF3 heuristic when the
host field is missing. Update the call site that builds mode_check to prefer
dpu_ep’s reported Card1.part_number, and only fall back to the host device part
number if the DPU value is unavailable. Keep the fix localized around the
check_and_configure_dpu_mode invocation and the related DPU endpoint parsing
logic.

@github-actions

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
boot-artifacts-aarch64 3 0 0 3 0 0
boot-artifacts-x86_64 3 0 0 3 0 0
forge-admin-cli-x86_64 283 6 24 98 7 148
machine-validation-runner 744 32 188 267 36 221
machine_validation 744 32 188 267 36 221
machine_validation-aarch64 744 32 188 267 36 221
nvmetal-carbide 744 32 188 267 36 221
TOTAL 3265 134 776 1172 151 1032

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

// FORGE-7330: If site-explorer can't get the interface info from the bmc, then it won't associate the interface with a machine.
// if the pxe request included the product and its a DPU, the machine record is not needed and we can just use the DPU type.
if let Some(product) = target.product
&& product.to_ascii_lowercase().contains("bluefield")

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.

is this something you care about?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure that I understand question. Goal of this PR is to just use right names for the function (function name that checks part numbers called is_..._model). I came across it when reviewed code for BF4 where I saw mismatch between what value I check and how function was named. To prevent this confusion in future I just decided that it is better to rename them.

@poroh
poroh merged commit 19ec843 into NVIDIA:main Jun 26, 2026
58 checks passed
@poroh
poroh deleted the bluefield-part-number-checks branch July 2, 2026 00:07
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