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

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

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: b5a3c432-0c99-4d5d-85cf-2b4680d9652e

📥 Commits

Reviewing files that changed from the base of the PR and between 148ab9c and c6614cf.

⛔ Files ignored due to path filters (2)
  • rest-api/proto/core/gen/v1/nico_nico.pb.go is excluded by !**/*.pb.go, !**/gen/**, !rest-api/**/*.pb.go
  • rest-api/proto/core/gen/v1/nico_nico_grpc.pb.go is excluded by !**/*.pb.go, !**/gen/**, !rest-api/**/*.pb.go, !rest-api/**/*_grpc.pb.go
📒 Files selected for processing (25)
  • 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/auth/internal_rbac_rules.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
  • rest-api/proto/core/src/v1/nico_nico.proto
✅ Files skipped from review due to trivial changes (7)
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-set.md
  • docs/manuals/nico-admin-cli/commands/machine/machine.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override.md
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-show.md
  • crates/api-model/src/machine/mod.rs
  • crates/admin-cli/src/machine/vendor_override/args.rs
  • docs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-clear.md
🚧 Files skipped from review as they are similar to previous changes (16)
  • crates/rpc/src/model/machine/mod.rs
  • crates/admin-cli/src/rpc.rs
  • crates/utils/src/redfish.rs
  • crates/admin-cli/src/machine/vendor_override/mod.rs
  • crates/admin-cli/src/machine/vendor_override/cmd.rs
  • crates/api-db/migrations/20260625120000_machine_bmc_vendor_override.sql
  • crates/admin-cli/src/machine/mod.rs
  • crates/api-core/src/handlers/instance.rs
  • crates/api-core/src/api.rs
  • crates/api-db/src/machine.rs
  • crates/redfish/src/libredfish/mod.rs
  • crates/api-model/src/machine/json.rs
  • crates/redfish/src/libredfish/conv.rs
  • crates/api-core/src/handlers/machine.rs
  • crates/rpc/proto/forge.proto
  • crates/api-db/src/machine_interface.rs

Summary by CodeRabbit

  • New Features
    • Added machine vendor-override commands to set, clear, show a machine’s Redfish BMC vendor override.
    • Machines now support an optional persisted pinned vendor override (automatic detection when unset/cleared).
  • Bug Fixes
    • Redfish client/vendor selection now honors the stored vendor override for direct reboots and the BIOS unlock flow.
  • Documentation
    • Added manual pages for machine vendor-override and its set, clear, show subcommands, and updated the machine command index.
  • Tests
    • Added tests for vendor override parsing/behavior.

Walkthrough

Adds a machine-level Redfish BMC vendor override through the RPC, storage, 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, rest-api/proto/core/src/v1/nico_nico.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 and REST API machine RPCs, 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/auth/internal_rbac_rules.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, RBAC permission, 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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.25% 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 is concise and accurately summarizes the main change: adding a per-machine BMC vendor override.
Description check ✅ Passed The description is clearly related to the changeset and matches the implemented CLI, API, DB, and Redfish override support.
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
@s3rj1k s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from 304b943 to fd86083 Compare July 1, 2026 08:49
@mxh-0xbb

mxh-0xbb commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

/ok to test fd86083

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🔐 TruffleHog Secret Scan

No secrets or credentials found!

Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉

🔗 View scan details

🕐 Last updated: 2026-07-08 07:51:52 UTC | Commit: fd86083

@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 271 13 34 91 7 126
machine-validation-runner 800 37 234 291 43 195
machine_validation 800 37 234 291 43 195
machine_validation-aarch64 800 37 234 291 43 195
nvmetal-carbide 800 37 234 291 43 195
TOTAL 3477 161 970 1261 179 906

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

@s3rj1k s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from fd86083 to a026f88 Compare July 8, 2026 09:47
@s3rj1k

s3rj1k commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test fd86083

rebased and regenerated protos

@ajf

ajf commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

conflicts

@s3rj1k s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from a026f88 to 148ab9c Compare July 9, 2026 20:17
@s3rj1k

s3rj1k commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

conflicts

rebased

@ajf

ajf commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

/ok to test 148ab9c

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 148ab9c to c6614cf Compare July 9, 2026 21:05
@s3rj1k

s3rj1k commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 148ab9c

RBAC tests have failed, fixed (hopefully) and rebased, sorry about that

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.

3 participants