Skip to content

fix: Validate that both DPF and VMAAS are not enabled at the same time. - #4477

Open
abvarshney-nv wants to merge 3 commits into
NVIDIA:mainfrom
abvarshney-nv:dpf_vmaas_incompatible
Open

fix: Validate that both DPF and VMAAS are not enabled at the same time.#4477
abvarshney-nv wants to merge 3 commits into
NVIDIA:mainfrom
abvarshney-nv:dpf_vmaas_incompatible

Conversation

@abvarshney-nv

Copy link
Copy Markdown
Contributor

Validate that both DPF and VMAAS are not enabled at the same time.

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

@abvarshney-nv
abvarshney-nv requested a review from a team as a code owner August 3, 2026 11:57
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6c1628a9-322a-4cb5-a01c-1c68c12f825e

📥 Commits

Reviewing files that changed from the base of the PR and between 337ca1f and 8a3be05.

📒 Files selected for processing (1)
  • crates/api-core/src/setup.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/api-core/src/setup.rs

Summary by CodeRabbit

  • Bug Fixes
    • Startup now stops with a clear error when DPF and VMaaS configuration are enabled together, preventing an invalid runtime setup.

Walkthrough

start_runtime now rejects startup when DPF is enabled and vmaas_config is configured. It returns an error before runtime initialization continues.

Changes

Startup validation

Layer / File(s) Summary
Reject incompatible startup configuration
crates/api-core/src/setup.rs
start_runtime returns an error when DPF and VMaaS are enabled simultaneously.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states that DPF and VMAAS must not be enabled simultaneously.
Description check ✅ Passed The description directly explains the validation fix for preventing simultaneous DPF and VMAAS configuration.
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.
✨ 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 (2)
crates/api-core/src/setup.rs (2)

212-218: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Run the conflict check before constructing runtime pools.

start_runtime constructs both Redfish pools before this guard. If either constructor performs I/O, allocates a resource, or returns an unrelated error, the invalid configuration can partially initialize runtime state or report the wrong startup error. Move the guard before both constructors, or verify that they are side-effect-free and cannot mask this validation.

As per path instructions, prioritize behavior and resource-lifetime findings over style-only findings.

🤖 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/setup.rs` around lines 212 - 218, Move the VMaaS/DPF
conflict validation using the existing eyre::ensure! check to the beginning of
start_runtime, before either Redfish runtime pool is constructed. Ensure invalid
configurations return the conflict error before any pool initialization, I/O,
allocation, or unrelated constructor failure can occur.

Source: Path instructions


212-218: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add table-driven coverage for the configuration combinations.

Test DPF enabled and disabled with vmaas_config absent and present. Assert that only (dpf.enabled = true, vmaas_config = Some(_)) returns an error. Extract the validation predicate if constructing start_runtime requires external resources.

As per coding guidelines, mappings from inputs to outputs or errors must use table-driven tests.

🤖 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/setup.rs` around lines 212 - 218, Add table-driven tests
for the configuration validation surrounding the DPF/VMaaS ensure, covering both
values of dpf.enabled and both absent and present vmaas_config; assert that only
enabled DPF with Some(vmaas_config) produces an error. If testing start_runtime
requires external resources, extract the validation predicate into a testable
symbol and exercise that predicate instead.

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/api-core/src/setup.rs`:
- Line 217: Update the startup error message in the VMaaS/DPF configuration
validation to use lowercase wording and remove the trailing period, while
preserving the existing meaning.

---

Nitpick comments:
In `@crates/api-core/src/setup.rs`:
- Around line 212-218: Move the VMaaS/DPF conflict validation using the existing
eyre::ensure! check to the beginning of start_runtime, before either Redfish
runtime pool is constructed. Ensure invalid configurations return the conflict
error before any pool initialization, I/O, allocation, or unrelated constructor
failure can occur.
- Around line 212-218: Add table-driven tests for the configuration validation
surrounding the DPF/VMaaS ensure, covering both values of dpf.enabled and both
absent and present vmaas_config; assert that only enabled DPF with
Some(vmaas_config) produces an error. If testing start_runtime requires external
resources, extract the validation predicate into a testable symbol and exercise
that predicate instead.
🪄 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: faef39db-0100-46ee-b637-64b662625563

📥 Commits

Reviewing files that changed from the base of the PR and between de39690 and 9fc662b.

📒 Files selected for processing (1)
  • crates/api-core/src/setup.rs

Comment thread crates/api-core/src/setup.rs Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Abhishek Varshney <abvarshney@nvidia.com>
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