Skip to content

feat(expected-machine): per host BMC vendor override - #2912

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

feat(expected-machine): per host 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 on the expected machine record. Resolved inside
create_client so every BMC client honors it, and recorded by Site Explorer so
it also drives the firmware config key, the restart path and the console
transport. Probe and factory-bootstrap clients stay unpinnable, since forcing a
vendor there deadlocks credential rotation. Unpinned hosts are unchanged.

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

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
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 reflects the new per-machine BMC vendor override feature, even if it says host instead of machine.
Description check ✅ Passed The description is aligned with the changeset and describes the vendor override behavior and its use in client creation.
✨ 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 Outdated
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

@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

-- Add bmc_vendor_override to machines so an operator can pin the Redfish BMC
-- vendor for a machine. NULL means automatic detection. The value is a
-- RedfishVendor variant name passed down into libredfish as the forced vendor.
ALTER TABLE machines ADD COLUMN bmc_vendor_override text;

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.

wouldn't this feature be better off as part of expected machines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, for taking so long, was vacationing, yes, expected machines are better, thanks!

I've updated PR and did rebase on latest HEAD.

@s3rj1k
s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from c6614cf to e83d7d4 Compare July 27, 2026 23:41
@s3rj1k s3rj1k changed the title feat: per-machine BMC vendor override feat(expected-machine): per host BMC vendor override Jul 27, 2026
@s3rj1k
s3rj1k force-pushed the feat/machine-bmc-vendor-override branch 3 times, most recently from 6546633 to 909e561 Compare July 28, 2026 22:40
@thossain-nv thossain-nv added the rest-api Add this label when an issue or PR concerns NICo REST API label Jul 29, 2026 — with ChatGPT Codex Connector
@thossain-nv thossain-nv removed the rest-api Add this label when an issue or PR concerns NICo REST API label Jul 29, 2026
@s3rj1k
s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from 909e561 to 0f88c5a Compare July 29, 2026 10:47
@s3rj1k

s3rj1k commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Kindly asking to enable testing on this PR, it touches RPC and has a tendency to get in conflict quite fast.

@s3rj1k
s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from 0f88c5a to 0a39d62 Compare July 31, 2026 00:07
#[serde(default)]
pub host_lifecycle_profile: Option<HostLifecycleProfile>,
/// Operator pinned Redfish BMC vendor, a `RedfishVendor` variant name such as
/// `Dell`. Absent or empty means automatic detection.

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.

empty should be rejected. empty != optional in rust (in theory)

.data
.bmc_vendor_override
.as_deref()
.filter(|name| !name.is_empty())

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.

as I mentioned earlier, empty should be rejected

/// sweep, so without negative caching the common path would query Postgres
/// on every client construction.
cache: moka::future::Cache<IpAddr, Option<RedfishVendor>>,
}

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.

@kensimon do we need a cache for this?

@wminckler

Copy link
Copy Markdown
Contributor

/ok to test 0a39d62

@wminckler

Copy link
Copy Markdown
Contributor

I think you need to sign your commits too

@s3rj1k

s3rj1k commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

I think you need to sign your commits too

hmm, forgot after rebase, will do after test finishes

@s3rj1k
s3rj1k force-pushed the feat/machine-bmc-vendor-override branch 2 times, most recently from 47f08af to d2e1995 Compare August 13, 2026 22:35
Pin a Redfish BMC vendor on the expected machine record. Resolved inside
`create_client` so every BMC client honors it, and recorded by Site Explorer so
it also drives the firmware config key, the restart path and the console
transport. Probe and factory-bootstrap clients stay unpinnable, since forcing a
vendor there deadlocks credential rotation. Unpinned hosts are unchanged.

Signed-off-by: s3rj1k <evasive.gyron@gmail.com>
@s3rj1k
s3rj1k force-pushed the feat/machine-bmc-vendor-override branch from d2e1995 to 7cc4239 Compare August 18, 2026 10:45
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.

5 participants