Skip to content

feat: per-machine BMC vendor override#2912

Open
s3rj1k wants to merge 1 commit into
NVIDIA:mainfrom
s3rj1k:feat/machine-bmc-vendor-override
Open

feat: per-machine BMC vendor override#2912
s3rj1k wants to merge 1 commit into
NVIDIA:mainfrom
s3rj1k:feat/machine-bmc-vendor-override

Conversation

@s3rj1k

@s3rj1k s3rj1k commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Pin a Redfish BMC vendor per machine, forced into libredfish instead of auto-detection. The value is a plain string matched against libredfish's RedfishVendor enum at client creation (an unknown name warns and falls back), so NICo keeps no vendor list. It rides on BmcAccessInfo so every client_by_info caller honors it, plus the direct instance-power and force-delete paths.

  • db: machines.bmc_vendor_override column + migration
  • api: UpdateMachineBmcVendorOverride RPC, field on Machine
  • redfish: client_by_info forces the override
  • cli: machine vendor-override set/clear/show

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

@s3rj1k s3rj1k requested a review from a team as a code owner June 26, 2026 10:49
@copy-pr-bot

copy-pr-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@s3rj1k s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from d38e985 to 04c592a Compare June 26, 2026 10:49
@coderabbitai

coderabbitai Bot commented Jun 26, 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: b57c02bd-f32d-481b-a1f4-8242db1d87c0

📥 Commits

Reviewing files that changed from the base of the PR and between 304b943 and fd86083.

📒 Files selected for processing (23)
  • crates/admin-cli/src/machine/mod.rs
  • crates/admin-cli/src/machine/vendor_override/args.rs
  • crates/admin-cli/src/machine/vendor_override/cmd.rs
  • crates/admin-cli/src/machine/vendor_override/mod.rs
  • crates/admin-cli/src/rpc.rs
  • crates/api-core/src/api.rs
  • crates/api-core/src/handlers/instance.rs
  • crates/api-core/src/handlers/machine.rs
  • crates/api-db/migrations/20260625120000_machine_bmc_vendor_override.sql
  • crates/api-db/src/machine.rs
  • crates/api-db/src/machine_interface.rs
  • crates/api-model/src/machine/json.rs
  • crates/api-model/src/machine/mod.rs
  • crates/redfish/src/libredfish/conv.rs
  • crates/redfish/src/libredfish/mod.rs
  • crates/rpc/proto/forge.proto
  • crates/rpc/src/model/machine/mod.rs
  • crates/utils/src/redfish.rs
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-clear.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-set.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-show.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override.md
  • docs/manuals/nico-admin-cli/commands/machine/machine.md
✅ Files skipped from review due to trivial changes (5)
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-clear.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-set.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-show.md
  • docs/manuals/nico-admin-cli/commands/machine/machine.md
🚧 Files skipped from review as they are similar to previous changes (18)
  • crates/api-core/src/api.rs
  • crates/api-core/src/handlers/instance.rs
  • crates/redfish/src/libredfish/mod.rs
  • crates/api-model/src/machine/mod.rs
  • crates/utils/src/redfish.rs
  • crates/admin-cli/src/machine/vendor_override/mod.rs
  • crates/api-db/src/machine.rs
  • crates/api-model/src/machine/json.rs
  • crates/admin-cli/src/machine/vendor_override/cmd.rs
  • crates/rpc/src/model/machine/mod.rs
  • crates/admin-cli/src/machine/mod.rs
  • crates/api-db/src/machine_interface.rs
  • crates/rpc/proto/forge.proto
  • crates/api-db/migrations/20260625120000_machine_bmc_vendor_override.sql
  • crates/admin-cli/src/machine/vendor_override/args.rs
  • crates/redfish/src/libredfish/conv.rs
  • crates/admin-cli/src/rpc.rs
  • crates/api-core/src/handlers/machine.rs

Summary by CodeRabbit

  • New Features
    • Added machine vendor-override commands to set, clear, and show the Redfish BMC vendor override for a machine.
    • Machines can now store an optional pinned Redfish BMC vendor used for consistent vendor selection.
  • Bug Fixes
    • Redfish client/vendor selection now honors the stored vendor override across machine operations (including reboots and BIOS unlock flow).
  • Documentation
    • Added manual pages for machine vendor-override plus set, clear, and show, and updated the machine command index.
  • Tests
    • Added coverage for vendor override parsing and override behavior.

Walkthrough

Adds a machine-level Redfish BMC vendor override through the RPC, database, Redfish client, and admin CLI paths. The override can now be set, cleared, shown, and propagated into Redfish client creation.

Changes

Vendor override flow

Layer / File(s) Summary
Contract and shared model
crates/rpc/proto/forge.proto, crates/api-model/src/machine/*, crates/rpc/src/model/machine/mod.rs, crates/utils/src/redfish.rs
Adds bmc_vendor_override to the Forge machine RPC, the API machine model, snapshot JSON conversion, RPC conversion, and BmcAccessInfo.
Update RPC and storage
crates/api-db/migrations/20260625120000_machine_bmc_vendor_override.sql, crates/admin-cli/src/rpc.rs, crates/api-core/src/api.rs, crates/api-core/src/handlers/machine.rs, crates/api-db/src/machine.rs
Adds the machine update RPC handler, database update helper, schema column, and CLI client wrapper for setting or clearing the override.
Redfish vendor resolution
crates/api-db/src/machine_interface.rs, crates/redfish/src/libredfish/conv.rs, crates/redfish/src/libredfish/mod.rs, crates/api-core/src/handlers/instance.rs, crates/api-core/src/handlers/machine.rs
Returns bmc_vendor_override from BMC access lookup, parses override values into RedfishVendor, and passes the computed vendor into Redfish client creation in instance and machine flows.
Admin CLI command and docs
crates/admin-cli/src/machine/mod.rs, crates/admin-cli/src/machine/vendor_override/*, docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override*.md, docs/manuals/nico-admin-cli/commands/machine/machine.md
Adds the machine vendor-override subcommand with set, clear, and show handlers and adds the matching manual pages and command index entry.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested labels: high risk

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 32.26% 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 clearly summarizes the main change: adding per-machine BMC vendor override support.
Description check ✅ Passed The description is directly aligned with the change set and summarizes the new vendor override feature.
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: 2

🤖 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/admin-cli/src/machine/vendor_override/args.rs`:
- Around line 43-47: The `vendor` argument on `VendorOverrideArgs` currently
accepts any string and only fails back to auto-detection later, so invalid
values slip through parse time. Update the `clap` field in `VendorOverrideArgs`
to validate against the exact `RedfishVendor` variant names (case-sensitive) by
using a `ValueEnum` or a custom parser/validator. Ensure `--vendor` is rejected
immediately for typos and only the supported vendor names are accepted.

In `@crates/api-core/src/handlers/machine.rs`:
- Around line 325-333: Validate the incoming bmc_vendor_override in
machine::update before calling db::machine::update_bmc_vendor_override: reject
any non-empty value that redfish_vendor_from_str does not accept and return
NicoError::InvalidArgument instead of persisting it. Keep the existing
empty/absent handling, but only pass through vendor names that map to a known
Redfish vendor so typos cannot be stored and later silently ignored when the
client is built.
🪄 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: 97cbfb50-bbec-4b40-8551-a3ed7fcd7472

📥 Commits

Reviewing files that changed from the base of the PR and between 52a0a54 and 04c592a.

📒 Files selected for processing (23)
  • crates/admin-cli/src/machine/mod.rs
  • crates/admin-cli/src/machine/vendor_override/args.rs
  • crates/admin-cli/src/machine/vendor_override/cmd.rs
  • crates/admin-cli/src/machine/vendor_override/mod.rs
  • crates/admin-cli/src/rpc.rs
  • crates/api-core/src/api.rs
  • crates/api-core/src/handlers/instance.rs
  • crates/api-core/src/handlers/machine.rs
  • crates/api-db/migrations/20260625120000_machine_bmc_vendor_override.sql
  • crates/api-db/src/machine.rs
  • crates/api-db/src/machine_interface.rs
  • crates/api-model/src/machine/json.rs
  • crates/api-model/src/machine/mod.rs
  • crates/redfish/src/libredfish/conv.rs
  • crates/redfish/src/libredfish/mod.rs
  • crates/rpc/proto/forge.proto
  • crates/rpc/src/model/machine/mod.rs
  • crates/utils/src/redfish.rs
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-clear.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-set.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-show.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override.md
  • docs/manuals/nico-admin-cli/commands/machine/machine.md

Comment thread crates/admin-cli/src/machine/vendor_override/args.rs
Comment thread crates/api-core/src/handlers/machine.rs Outdated
@s3rj1k s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from 04c592a to 304b943 Compare July 1, 2026 08:33
@s3rj1k s3rj1k requested a review from polarweasel as a code owner July 1, 2026 08:33
Pin a Redfish BMC vendor per machine, forced into libredfish instead of
automatic detection. The value is a plain string matched against
libredfish's RedfishVendor enum at client creation, and an unknown name
warns and falls back, so NICo keeps no vendor list. It rides on
BmcAccessInfo so every client_by_info caller honors it, and the direct
instance power and force delete paths pass it too.

Adds the machines.bmc_vendor_override column and migration, the
UpdateMachineBmcVendorOverride RPC and a field on Machine, the forced
vendor in client_by_info, and a machine vendor override set, clear, and
show CLI command.

Signed-off-by: s3rj1k <evasive.gyron@gmail.com>
@s3rj1k s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from 304b943 to fd86083 Compare July 1, 2026 08:49
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