Skip to content

chore: Select DPF deployment type of Bf4Generic or Bf4Astra based on … - #4871

Open
srinivasadmurthy wants to merge 1 commit into
NVIDIA:mainfrom
srinivasadmurthy:sdmdpf
Open

chore: Select DPF deployment type of Bf4Generic or Bf4Astra based on …#4871
srinivasadmurthy wants to merge 1 commit into
NVIDIA:mainfrom
srinivasadmurthy:sdmdpf

Conversation

@srinivasadmurthy

Copy link
Copy Markdown
Contributor

…whether

host machine has Astra NICs or not.

When determining DPF deployment type, if the host machine
has Astra NICs, choose Bf4Astra instead of Bf4Generic.

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

…whether

host machine has Astra NICs or not.

Signed-off-by: Srinivasa Murthy <srmurthy@nvidia.com>
@srinivasadmurthy
srinivasadmurthy requested a review from a team as a code owner August 12, 2026 06:08
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • New Features

    • Added support for detecting Astra NICs during DPU provisioning and state handling.
    • BF4 DPUs are now classified as Astra or generic deployments based on NIC configuration.
    • Existing BF3 deployment classification and error handling remain unchanged.
  • Tests

    • Updated deployment-type test scenarios to reflect the enhanced classification checks.

Walkthrough

The DPF deployment-type API now accepts Astra NIC presence. DPF handlers query DPA interfaces and pass this state through provisioning and state handling. BF4 DPUs resolve to Bf4Astra or Bf4Generic. Tests update their mock callbacks.

Changes

DPF Astra classification

Layer / File(s) Summary
Deployment-type contract and classification
crates/machine-controller/src/dpf.rs
deployment_type_for_dpu now accepts astra_nics. BF4 DPUs resolve to Bf4Astra when enabled and Bf4Generic otherwise.
Astra detection and handler wiring
crates/machine-controller/src/handler/dpf.rs
The handlers query DPA interfaces for Astra NICs and pass the result through registration, provisioning, reprovisioning, and state handling.
Updated DPF test mocks
crates/api-core/src/tests/dpf/*.rs, crates/api-core/src/tests/machine_admin_force_delete.rs
Mock callbacks now accept both method arguments. Existing return values remain unchanged.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DPFStateHandler
  participant DPAInterfaceDatabase
  participant DpfOperations
  participant DpfSdkOps
  DPFStateHandler->>DPAInterfaceDatabase: Query host DPA interfaces
  DPAInterfaceDatabase-->>DPFStateHandler: Return Astra NIC presence
  DPFStateHandler->>DpfOperations: deployment_type_for_dpu(dpu, astra_nics)
  DpfOperations->>DpfSdkOps: Forward classification input
  DpfSdkOps-->>DPFStateHandler: Return deployment type
Loading

Possibly related PRs

Suggested labels: feature

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: selecting Bf4Generic or Bf4Astra based on Astra NIC availability.
Description check ✅ Passed The description directly explains Astra NIC-based DPF deployment type selection and identifies the integration test updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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

🧹 Nitpick comments (1)
crates/machine-controller/src/dpf.rs (1)

93-97: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the new BF4 classification input.

The trait documentation still describes only BF3 versus BF4. astra_nics is now part of the classification result: true selects Bf4Astra, and false selects Bf4Generic. Update the contract documentation so callers and implementors cannot miss this rule.

Suggested documentation update
-    /// Resolve the deployment type of a DPU based on its hardware (BF3 vs BF4).
+    /// Resolve the deployment type of a DPU based on its hardware and host Astra NICs.
+    ///
+    /// For BF4 DPUs, `astra_nics = true` selects `DpuDeploymentType::Bf4Astra`;
+    /// `false` selects `DpuDeploymentType::Bf4Generic`.
🤖 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/machine-controller/src/dpf.rs` around lines 93 - 97, Update the trait
documentation for deployment_type_for_dpu to document the astra_nics parameter:
when true, BF4 classification returns Bf4Astra, and when false, it returns
Bf4Generic. Preserve the existing BF3 classification description.
🤖 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/machine-controller/src/handler/dpf.rs`:
- Around line 181-182: Update handle_dpf_state to resolve host_has_astra_nics
once and pass the resulting astra_nics value through
create_and_register_dpudevices_and_dpunode and the reprovisioning helpers before
any DPUDevice or DPUNODE resources are registered; remove repeated lookups and
reuse the passed value throughout provisioning.

---

Nitpick comments:
In `@crates/machine-controller/src/dpf.rs`:
- Around line 93-97: Update the trait documentation for deployment_type_for_dpu
to document the astra_nics parameter: when true, BF4 classification returns
Bf4Astra, and when false, it returns Bf4Generic. Preserve the existing BF3
classification description.
🪄 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: 51f9b736-f78f-4372-8ab1-7957bc404161

📥 Commits

Reviewing files that changed from the base of the PR and between 469fb8f and c694edd.

📒 Files selected for processing (7)
  • crates/api-core/src/tests/dpf/happy_path.rs
  • crates/api-core/src/tests/dpf/reprovisioning.rs
  • crates/api-core/src/tests/dpf/stale_labels.rs
  • crates/api-core/src/tests/dpf/waiting_for_ready.rs
  • crates/api-core/src/tests/machine_admin_force_delete.rs
  • crates/machine-controller/src/dpf.rs
  • crates/machine-controller/src/handler/dpf.rs

Comment on lines +181 to 182
ctx: &mut StateHandlerContext<'_, MachineStateHandlerContextObjects>,
) -> Result<(), StateHandlerError> {

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 12 \
  'dpf_cr_creation_failed|register_dpu_device|register_dpu_node|create_and_register_dpudevices_and_dpunode' \
  crates --glob '*.rs'

Repository: NVIDIA/infra-controller

Length of output: 50379


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

file="crates/machine-controller/src/handler/dpf.rs"
wc -l "$file"
ast-grep outline "$file" | sed -n '1,220p'
printf '\n--- provisioning and failure paths ---\n'
rg -n -C 20 \
  'create_and_register_dpudevices_and_dpunode|dpf_cr_creation_failed|register_dpu_device|register_dpu_node|host_has_astra_nics|handle_dpf_state' \
  "$file"
printf '\n--- cleanup and idempotency implementations ---\n'
rg -n -C 18 \
  'dpf_cr_creation_failed|delete_dpu_node|delete_dpu_device|register_dpu_device|register_dpu_node' \
  crates/dpf/src/sdk.rs crates/machine-controller/src --glob '*.rs' | sed -n '1,260p'

Repository: NVIDIA/infra-controller

Length of output: 28812


Resolve Astra NIC state before DPF writes and reuse it.

create_and_register_dpudevices_and_dpunode registers DPUDevice resources before host_has_astra_nics. If the lookup fails, the handler transitions to a failed state without automatic cleanup and can leave partial DPF resources. Pass the already computed astra_nics value from handle_dpf_state through the provisioning and reprovisioning helpers.

🤖 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/machine-controller/src/handler/dpf.rs` around lines 181 - 182, Update
handle_dpf_state to resolve host_has_astra_nics once and pass the resulting
astra_nics value through create_and_register_dpudevices_and_dpunode and the
reprovisioning helpers before any DPUDevice or DPUNODE resources are registered;
remove repeated lookups and reuse the passed value throughout provisioning.

Source: Path instructions

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.

1 participant