feat: per-machine BMC vendor override#2912
Open
s3rj1k wants to merge 1 commit into
Open
Conversation
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 Signed-off-by: s3rj1k <evasive.gyron@gmail.com>
d38e985 to
04c592a
Compare
Contributor
Summary by CodeRabbit
WalkthroughAdds 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 passed into Redfish client creation during power and BIOS-unlock flows. ChangesVendor override flow
Sequence Diagram(s)sequenceDiagram
participant CLI as Cmd::vendor_override
participant Client as ApiClient::update_machine_bmc_vendor_override
participant Api as Api::update_machine_bmc_vendor_override
participant Handler as machine::update_machine_bmc_vendor_override
participant DB as db::machine::update_bmc_vendor_override
participant Tables as machines
CLI->>Client: machine_id, bmc_vendor_override
Client->>Api: UpdateMachineBmcVendorOverride request
Api->>Handler: Request<MachineBmcVendorOverrideUpdateRequest>
Handler->>DB: normalized override, machine_id
DB->>Tables: UPDATE bmc_vendor_override
Tables-->>DB: ok
DB-->>Handler: ok
Handler-->>Api: Response<()>
Api-->>Client: success
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contributor
There was a problem hiding this comment.
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
📒 Files selected for processing (23)
crates/admin-cli/src/machine/mod.rscrates/admin-cli/src/machine/vendor_override/args.rscrates/admin-cli/src/machine/vendor_override/cmd.rscrates/admin-cli/src/machine/vendor_override/mod.rscrates/admin-cli/src/rpc.rscrates/api-core/src/api.rscrates/api-core/src/handlers/instance.rscrates/api-core/src/handlers/machine.rscrates/api-db/migrations/20260625120000_machine_bmc_vendor_override.sqlcrates/api-db/src/machine.rscrates/api-db/src/machine_interface.rscrates/api-model/src/machine/json.rscrates/api-model/src/machine/mod.rscrates/redfish/src/libredfish/conv.rscrates/redfish/src/libredfish/mod.rscrates/rpc/proto/forge.protocrates/rpc/src/model/machine/mod.rscrates/utils/src/redfish.rsdocs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-clear.mddocs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-set.mddocs/manuals/nico-admin-cli/commands/machine/machine-vendor-override-show.mddocs/manuals/nico-admin-cli/commands/machine/machine-vendor-override.mddocs/manuals/nico-admin-cli/commands/machine/machine.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Related issues
Type of Change
Breaking Changes
Testing
Additional Notes