Skip to content

(DRAFT) fix: add support to bmc-explorer for Delta powershelves#3235

Closed
spydaNVIDIA wants to merge 1 commit into
NVIDIA:mainfrom
spydaNVIDIA:delta_powershelf
Closed

(DRAFT) fix: add support to bmc-explorer for Delta powershelves#3235
spydaNVIDIA wants to merge 1 commit into
NVIDIA:mainfrom
spydaNVIDIA:delta_powershelf

Conversation

@spydaNVIDIA

Copy link
Copy Markdown
Contributor

fix: add support to bmc-explorer for Delta powershelves

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

@spydaNVIDIA spydaNVIDIA requested review from krish-nvidia and poroh July 7, 2026 23:37
@spydaNVIDIA spydaNVIDIA requested a review from a team as a code owner July 7, 2026 23:37
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR adds support for Delta power shelves in bmc-explorer: chassis classification detects Delta manufacturers, aggregates per-PSU commanded power state from OEM data, introduces a DeltaPowerShelf hardware type, and routes exploration to a dedicated report-building path bypassing the standard Systems exploration flow. serde_json dependency scope was also adjusted.

Changes

Delta Power Shelf Support

Layer / File(s) Summary
Delta chassis classification and PSU aggregation
crates/bmc-explorer/src/chassis.rs
Adds is_delta_powershelf, delta_power_state, synthesized_powershelf_system methods, the DeltaPowerSupply struct, OEM extraction/aggregation helpers, and unit tests for these behaviors.
HwType::DeltaPowerShelf classification
crates/bmc-explorer/src/hw/mod.rs
Adds the DeltaPowerShelf variant and extends bmc_vendor()/infinite_boot_enabled_attr() match arms.
Delta power shelf exploration report flow
crates/bmc-explorer/src/lib.rs
Adds early-return detection of Delta chassis, build_delta_powershelf_report, hw_type fallback detection, PCIe applicability handling, and a no-op machine_setup_status arm for the new type.
serde_json dependency scope change
crates/bmc-explorer/Cargo.toml
Moves serde_json from dev-dependencies to main dependencies as a workspace dependency.

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

Sequence Diagram(s)

sequenceDiagram
  participant Caller as nv_generate_exploration_report
  participant Chassis as ExploredChassis
  participant BMC as Chassis BMC
  participant Builder as build_delta_powershelf_report
  participant Manager as Manager Explorer

  Caller->>Chassis: explore()
  Chassis->>BMC: power_supplies() (if manufacturer contains "delta")
  BMC-->>Chassis: NvPowerSupply list
  Chassis->>Chassis: aggregate PSU OEM flags into ModelPowerState
  Caller->>Chassis: is_delta_powershelf()
  Chassis-->>Caller: true
  Caller->>Builder: build_delta_powershelf_report(chassis, inventories)
  Builder->>Manager: explore first manager
  Manager-->>Builder: manager info
  Builder->>Chassis: synthesized_powershelf_system()
  Chassis-->>Builder: ModelComputerSystem
  Builder-->>Caller: EndpointExplorationReport (machine_setup_status done)
Loading

Related issues: None specified.

Related PRs: None specified.

Suggested labels: enhancement, rust, bmc-explorer

Suggested reviewers: Team members familiar with bmc-explorer chassis exploration and Redfish OEM data handling.

Poem

A rabbit hopped through chassis wires so fine,
Found Delta shelves lit up in a row nine,
"Are you on? Are you off?" it asked each PSU,
Aggregated the answers, made the state true,
Then skipped the long path — a shelf-shaped design!

🚥 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 states the main change: Delta powershelf support in bmc-explorer.
Description check ✅ Passed The description matches the changeset and correctly frames the PR as support for Delta powershelves.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

🧹 Nitpick comments (2)
crates/bmc-explorer/src/chassis.rs (1)

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

Emit the diagnostic as a structured field rather than an interpolated string.

The warning embeds detail via string interpolation, which defeats key/value log searchability. Per the project's logging conventions, pass it as an attribute.

♻️ Proposed structured-logging fix
-            tracing::warn!("Delta power shelf power state is unknown: {detail}");
+            tracing::warn!(%detail, "Delta power shelf power state is unknown");

As per coding guidelines: "prefer placing common fields as attributes passed to tracing functions instead of using string interpolation" and services should "emit logs in 'logfmt' syntax".

🤖 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/bmc-explorer/src/chassis.rs` at line 150, The warning in the chassis
power-state handling uses string interpolation for detail, which breaks
structured logging/searchability. Update the tracing::warn call in the Delta
power shelf branch to pass detail as a structured attribute instead of embedding
it in the message, following the existing tracing/logfmt conventions used in
chassis.rs.

Source: Coding guidelines

crates/bmc-explorer/src/lib.rs (1)

292-347: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the duplicated "fetch first manager" plumbing.

Lines 305-315 reproduce the manager-acquisition and error-mapping block from nv_generate_exploration_report (lines 143-153) verbatim. Two identical copies of this fallible BMC I/O sequence are liable to drift independently. Extracting a small helper keeps the error-mapping contract in one place.

♻️ Illustrative helper extraction (confirm the concrete manager type)
async fn first_manager<B: Bmc>(root: &ServiceRoot<B>) -> Result<Manager<B>, Error<B>> {
    root.managers()
        .await
        .map_err(Error::nv_redfish("managers"))?
        .ok_or_else(Error::bmc_not_provided("managers"))?
        .members()
        .await
        .map_err(Error::nv_redfish("managers members"))?
        .into_iter()
        .next()
        .ok_or_else(Error::bmc_not_provided("at least one manager"))
}

Both call sites then reduce to let manager = first_manager(&root).await?;. Please verify the exact returned manager type/generics before applying.

🤖 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/bmc-explorer/src/lib.rs` around lines 292 - 347, The manager-fetching
and error-mapping logic in build_delta_powershelf_report is duplicated from
nv_generate_exploration_report, so extract it into a shared helper such as
first_manager that performs the root.managers() / members() / next() flow and
preserves the same Error::nv_redfish and Error::bmc_not_provided behavior.
Update both build_delta_powershelf_report and nv_generate_exploration_report to
call the helper, and verify the helper’s return type matches the concrete
manager type used by ExploredManager::explore.
🤖 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/bmc-explorer/src/chassis.rs`:
- Line 150: The warning in the chassis power-state handling uses string
interpolation for detail, which breaks structured logging/searchability. Update
the tracing::warn call in the Delta power shelf branch to pass detail as a
structured attribute instead of embedding it in the message, following the
existing tracing/logfmt conventions used in chassis.rs.

In `@crates/bmc-explorer/src/lib.rs`:
- Around line 292-347: The manager-fetching and error-mapping logic in
build_delta_powershelf_report is duplicated from nv_generate_exploration_report,
so extract it into a shared helper such as first_manager that performs the
root.managers() / members() / next() flow and preserves the same
Error::nv_redfish and Error::bmc_not_provided behavior. Update both
build_delta_powershelf_report and nv_generate_exploration_report to call the
helper, and verify the helper’s return type matches the concrete manager type
used by ExploredManager::explore.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 29f2158b-6218-4f6a-80bf-732429fdd488

📥 Commits

Reviewing files that changed from the base of the PR and between e9d0469 and a017052.

📒 Files selected for processing (4)
  • crates/bmc-explorer/Cargo.toml
  • crates/bmc-explorer/src/chassis.rs
  • crates/bmc-explorer/src/hw/mod.rs
  • crates/bmc-explorer/src/lib.rs

@github-actions

github-actions Bot commented Jul 8, 2026

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 270 13 33 91 7 126
machine-validation-runner 771 37 219 281 40 194
machine_validation 771 37 219 281 40 194
machine_validation-aarch64 771 37 219 281 40 194
nvmetal-carbide 771 37 219 281 40 194
TOTAL 3360 161 909 1221 167 902

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

@poroh poroh 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.

I would prefer more clean way of implementing it with:

  1. Adding OEM support for Delta powershelf in nv-redfish
  2. Adding bmc-mock simulation of Delta powershelf
  3. Adding unit tests for bmc-explorer that verifies important features of this hardware support.

Please let me know if you need any help with it.

@spydaNVIDIA

Copy link
Copy Markdown
Contributor Author
  1. Adding OEM support for Delta powershelf in nv-redfish

NVIDIA/nv-redfish#134

@spydaNVIDIA spydaNVIDIA changed the title fix: add support to bmc-explorer for Delta powershelves (DRAFT) fix: add support to bmc-explorer for Delta powershelves Jul 13, 2026
@spydaNVIDIA

Copy link
Copy Markdown
Contributor Author

Closing in favor of #3455

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