Skip to content

feat(rack): coordinate power shelf, compute , switch firmware upgrades across rack components - #4089

Open
vinodchitraliNVIDIA wants to merge 1 commit into
NVIDIA:mainfrom
vinodchitraliNVIDIA:vc/ps
Open

feat(rack): coordinate power shelf, compute , switch firmware upgrades across rack components#4089
vinodchitraliNVIDIA wants to merge 1 commit into
NVIDIA:mainfrom
vinodchitraliNVIDIA:vc/ps

Conversation

@vinodchitraliNVIDIA

@vinodchitraliNVIDIA vinodchitraliNVIDIA commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Route state-controller firmware requests for power shelves through rack maintenance, alongside machines and switches. Persist per-device reprovisioning requests and firmware status so rack orchestration can synchronize component progress and terminal outcomes.

Add the power-shelf reprovisioning state machine behind an opt-in configuration flag, including completion, failure, stale-cycle, and rack-error handling. Tighten switch reprovisioning behavior and expand rack maintenance coordination to handle mixed component scopes, retries, and status propagation.

Add the database migration, model and RPC wiring, controller configuration, and integration coverage for rack, switch, and power-shelf firmware workflows.

Related issues

#4088

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

NONE

@vinodchitraliNVIDIA
vinodchitraliNVIDIA requested a review from a team as a code owner July 24, 2026 08:55
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds rack firmware reprovisioning for power shelves, activity-driven switch reprovisioning, persisted firmware status, controller state transitions, rack-scoped progress evaluation, configuration wiring, and database-backed tests.

Changes

Rack firmware reprovisioning

Layer / File(s) Summary
Contracts and persisted reprovisioning state
crates/api-core/src/cfg/..., crates/api-db/..., crates/api-model/src/..., crates/power-shelf-controller/src/context.rs
Adds reprovisioning configuration, persisted power-shelf request and firmware-status fields, controller-state models, SLA handling, persistence helpers, and activity-based switch request data.
Rack maintenance orchestration
crates/rack-controller/src/maintenance.rs, crates/api-core/src/handlers/component_manager.rs, crates/api-core/src/tests/rack_state_controller/handler.rs
Adds power-shelf rack grouping and scoped maintenance, controller-state-based firmware progress evaluation, activity filtering, and updated firmware-wait tests.
Power-shelf controller state flow
crates/power-shelf-controller/src/..., crates/api-core/src/setup.rs, crates/api-core/src/tests/power_shelf_state_controller/...
Wires the feature flag, handles Ready-state reprovisioning requests, adds ReProvisioning transitions, processes firmware status, and adds database-backed tests.
Switch activity-driven reprovisioning
crates/switch-controller/src/..., crates/api-core/src/tests/switch_state_controller/mod.rs
Derives switch reprovisioning states from requested activities, clears requests after terminal phases, and updates activity-specific tests.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: rack lifecycle

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title points to rack-level power shelf and switch firmware coordination, which matches the main change, though the wording is awkward.
Description check ✅ Passed The description aligns with the PR scope: rack firmware routing, reprovisioning state machines, configuration, migrations, and model wiring.
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.

@vinodchitraliNVIDIA vinodchitraliNVIDIA changed the title feat(rack): coordinate firmware upgrades across rack components feat(rack): coordinate power shelf, compute , switch firmware upgrades across rack components Jul 24, 2026

@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: 4

🤖 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/api-core/src/tests/common/api_fixtures/mod.rs`:
- Line 1658: Update the controller service configuration in the fixture to use
the rack firmware reprovisioning value from overrides.config instead of
hard-coding false. Preserve the existing default when no override is provided,
so tests can explicitly enable the feature through their configuration.

In `@crates/power-shelf-controller/src/ready.rs`:
- Around line 85-98: Update the unknown-initiator branch in the Ready state
handler to clear power_shelf_reprovisioning_requested before returning the Error
transition. Match the request-clearing behavior of the flag-disabled and
no-relevant-activities early-return branches, while preserving the existing
warning and Error cause.

In `@crates/switch-controller/src/ready.rs`:
- Around line 60-73: Update the invalid-initiator branch in the ready-state
reprovisioning flow to call clear_switch_reprovisioning_requested before
transitioning to SwitchControllerState::Error. Match the cleanup ordering and
behavior used by the other Error transitions in the reprovisioning flow, while
preserving the existing warning and error cause.

In `@crates/switch-controller/src/reprovisioning.rs`:
- Around line 40-101: Update nvos_update_requested to use the same
empty-activities-as-all-phases behavior as should_run, while preserving its NVOS
activity matching for non-empty lists. Verify next_state_after_firmware enters
WaitingForNVOSUpgrade for an empty request, and add a table-driven regression
case in the switch state controller tests covering this flow.
🪄 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: a8a5100e-d95e-4cc8-a06d-39f7881d9778

📥 Commits

Reviewing files that changed from the base of the PR and between 4f36238 and 748fa1d.

📒 Files selected for processing (28)
  • crates/api-core/src/cfg/README.md
  • crates/api-core/src/cfg/file.rs
  • crates/api-core/src/handlers/component_manager.rs
  • crates/api-core/src/setup.rs
  • crates/api-core/src/test_support/default_config.rs
  • crates/api-core/src/tests/common/api_fixtures/mod.rs
  • crates/api-core/src/tests/power_shelf_state_controller/error_state.rs
  • crates/api-core/src/tests/power_shelf_state_controller/maintenance.rs
  • crates/api-core/src/tests/power_shelf_state_controller/mod.rs
  • crates/api-core/src/tests/power_shelf_state_controller/reprovisioning.rs
  • crates/api-core/src/tests/rack_state_controller/handler.rs
  • crates/api-core/src/tests/switch_state_controller/mod.rs
  • crates/api-db/migrations/20260724120000_power_shelf_reprovisioning_requested.sql
  • crates/api-db/src/power_shelf.rs
  • crates/api-db/src/switch.rs
  • crates/api-model/src/power_shelf/mod.rs
  • crates/api-model/src/power_shelf/slas.rs
  • crates/api-model/src/switch/mod.rs
  • crates/power-shelf-controller/src/context.rs
  • crates/power-shelf-controller/src/handler.rs
  • crates/power-shelf-controller/src/io.rs
  • crates/power-shelf-controller/src/lib.rs
  • crates/power-shelf-controller/src/ready.rs
  • crates/power-shelf-controller/src/reprovisioning.rs
  • crates/rack-controller/src/maintenance.rs
  • crates/rpc/src/model/power_shelf.rs
  • crates/switch-controller/src/ready.rs
  • crates/switch-controller/src/reprovisioning.rs

component_manager: test_component_manager.clone(),
credential_manager: credential_manager.clone(),
per_object_metrics_registry: per_object_metrics_registry.clone(),
rack_firmware_reprovisioning_enabled: false,

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 | 🟡 Minor | ⚡ Quick win

Honor the test configuration override.

This fixture builds config from overrides.config, but the controller service hard-codes false, so callers cannot enable rack firmware reprovisioning through the test environment. Enabled-path integration tests will silently exercise the disabled behavior.

Proposed fix
-                rack_firmware_reprovisioning_enabled: false,
+                rack_firmware_reprovisioning_enabled: config
+                    .power_shelf_state_controller
+                    .rack_firmware_reprovisioning_enabled,
📝 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
rack_firmware_reprovisioning_enabled: false,
rack_firmware_reprovisioning_enabled: config
.power_shelf_state_controller
.rack_firmware_reprovisioning_enabled,
🤖 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/api-core/src/tests/common/api_fixtures/mod.rs` at line 1658, Update
the controller service configuration in the fixture to use the rack firmware
reprovisioning value from overrides.config instead of hard-coding false.
Preserve the existing default when no override is provided, so tests can
explicitly enable the feature through their configuration.

Comment thread crates/power-shelf-controller/src/ready.rs
Comment thread crates/switch-controller/src/ready.rs
Comment thread crates/switch-controller/src/reprovisioning.rs
@vinodchitraliNVIDIA
vinodchitraliNVIDIA force-pushed the vc/ps branch 2 times, most recently from 5d07975 to 7989ad3 Compare July 27, 2026 13:54
@vinodchitraliNVIDIA

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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/api-core/src/tests/switch_state_controller/mod.rs (1)

920-964: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the direct NMXC continuation.

The table omits FirmwareUpgrade + ConfigureNmxCluster. That exercises the separate NMXC fallback after firmware completion; a regression there passes every current case. Add an expectation for WaitingForNMXCConfigure.

Proposed test case
+        Check {
+            scenario: "firmware plus NMXC advances to WaitingForNMXCConfigure",
+            input: CaseInput {
+                activities: vec![
+                    model::rack::MaintenanceActivity::FirmwareUpgrade {
+                        firmware_version: None,
+                        components: vec![],
+                        force_update: false,
+                    },
+                    model::rack::MaintenanceActivity::ConfigureNmxCluster,
+                ],
+            },
+            expect: Expect::ReProvisioning(ReProvisioningState::WaitingForNMXCConfigure),
+        },

As per coding guidelines, table-driven tests should cover input-to-output mappings.

🤖 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/api-core/src/tests/switch_state_controller/mod.rs` around lines 920 -
964, Add a table-driven case to
test_switch_waiting_for_rack_firmware_upgrade_next_state_by_activities covering
FirmwareUpgrade plus ConfigureNmxCluster, and assert that it produces
ReProvisioningState::WaitingForNMXCConfigure. Keep the existing cases unchanged.

Sources: Coding guidelines, Path instructions

🤖 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/api-core/src/tests/switch_state_controller/mod.rs`:
- Around line 920-964: Add a table-driven case to
test_switch_waiting_for_rack_firmware_upgrade_next_state_by_activities covering
FirmwareUpgrade plus ConfigureNmxCluster, and assert that it produces
ReProvisioningState::WaitingForNMXCConfigure. Keep the existing cases unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: af91b540-0a5c-493c-b11f-9da120fc90e7

📥 Commits

Reviewing files that changed from the base of the PR and between 7989ad3 and 189bb51.

📒 Files selected for processing (28)
  • crates/api-core/src/cfg/README.md
  • crates/api-core/src/cfg/file.rs
  • crates/api-core/src/handlers/component_manager.rs
  • crates/api-core/src/setup.rs
  • crates/api-core/src/test_support/default_config.rs
  • crates/api-core/src/tests/common/api_fixtures/mod.rs
  • crates/api-core/src/tests/power_shelf_state_controller/error_state.rs
  • crates/api-core/src/tests/power_shelf_state_controller/maintenance.rs
  • crates/api-core/src/tests/power_shelf_state_controller/mod.rs
  • crates/api-core/src/tests/power_shelf_state_controller/reprovisioning.rs
  • crates/api-core/src/tests/rack_state_controller/handler.rs
  • crates/api-core/src/tests/switch_state_controller/mod.rs
  • crates/api-db/migrations/20260724120000_power_shelf_reprovisioning_requested.sql
  • crates/api-db/src/power_shelf.rs
  • crates/api-db/src/switch.rs
  • crates/api-model/src/power_shelf/mod.rs
  • crates/api-model/src/power_shelf/slas.rs
  • crates/api-model/src/switch/mod.rs
  • crates/power-shelf-controller/src/context.rs
  • crates/power-shelf-controller/src/handler.rs
  • crates/power-shelf-controller/src/io.rs
  • crates/power-shelf-controller/src/lib.rs
  • crates/power-shelf-controller/src/ready.rs
  • crates/power-shelf-controller/src/reprovisioning.rs
  • crates/rack-controller/src/maintenance.rs
  • crates/rpc/src/model/power_shelf.rs
  • crates/switch-controller/src/ready.rs
  • crates/switch-controller/src/reprovisioning.rs
🚧 Files skipped from review as they are similar to previous changes (27)
  • crates/api-core/src/cfg/README.md
  • crates/api-db/migrations/20260724120000_power_shelf_reprovisioning_requested.sql
  • crates/rpc/src/model/power_shelf.rs
  • crates/api-core/src/cfg/file.rs
  • crates/api-core/src/tests/power_shelf_state_controller/maintenance.rs
  • crates/power-shelf-controller/src/io.rs
  • crates/api-core/src/tests/power_shelf_state_controller/error_state.rs
  • crates/power-shelf-controller/src/lib.rs
  • crates/api-core/src/tests/common/api_fixtures/mod.rs
  • crates/power-shelf-controller/src/handler.rs
  • crates/api-db/src/switch.rs
  • crates/api-model/src/power_shelf/slas.rs
  • crates/api-core/src/setup.rs
  • crates/power-shelf-controller/src/ready.rs
  • crates/api-model/src/switch/mod.rs
  • crates/power-shelf-controller/src/context.rs
  • crates/api-core/src/test_support/default_config.rs
  • crates/switch-controller/src/reprovisioning.rs
  • crates/api-core/src/tests/power_shelf_state_controller/reprovisioning.rs
  • crates/api-core/src/tests/power_shelf_state_controller/mod.rs
  • crates/power-shelf-controller/src/reprovisioning.rs
  • crates/api-core/src/handlers/component_manager.rs
  • crates/switch-controller/src/ready.rs
  • crates/api-db/src/power_shelf.rs
  • crates/api-model/src/power_shelf/mod.rs
  • crates/api-core/src/tests/rack_state_controller/handler.rs
  • crates/rack-controller/src/maintenance.rs

Route state-controller firmware requests for power shelves through rack maintenance, alongside machines and switches. Persist per-device reprovisioning requests and firmware status so rack orchestration can synchronize component progress and terminal outcomes.

Add the power-shelf reprovisioning state machine behind an opt-in configuration flag, including completion, failure, stale-cycle, and rack-error handling. Tighten switch reprovisioning behavior and expand rack maintenance coordination to handle mixed component scopes, retries, and status propagation.

Add the database migration, model and RPC wiring, controller configuration, and integration coverage for rack, switch, and power-shelf firmware workflows.

Signed-off-by: Vinod Chitrali <vchitrali@nvidia.com>
@zhaozhongn
zhaozhongn requested a review from spydaNVIDIA July 27, 2026 18:23
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