fix(ipmi): use Redfish-discovered port for power operations - #4135
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Summary by CodeRabbit
WalkthroughIPMI addressing now uses ChangesIPMI socket addressing
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant MachineController
participant IPMITool
participant ipmitool
participant BmcMock
MachineController->>IPMITool: pass resolved SocketAddr
IPMITool->>ipmitool: build host and port arguments
IPMITool->>BmcMock: forward SocketAddr for reset
BmcMock->>BmcMock: derive IP for HTTP request headers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
a88552b to
7c109e5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/ipmi/src/tool.rs (1)
190-199: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse table-driven cases for the address-mapping tests.
Both tests map inputs to deterministic outputs; express their cases with the repository’s table-driven test helpers.
crates/ipmi/src/tool.rs#L190-L199: represent address/username and expected argument-tail combinations as table cases.crates/machine-controller/src/handler.rs#L11963-L11975: represent reported-port and fallback-port expectations as table cases.🤖 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/ipmi/src/tool.rs` around lines 190 - 199, The address-mapping tests are separate deterministic cases and should use table-driven test helpers. In crates/ipmi/src/tool.rs lines 190-199, update connection_args_include_non_default_port to iterate over cases containing the address, username, and expected argument tail. In crates/machine-controller/src/handler.rs lines 11963-11975, convert the reported-port and fallback-port assertions into equivalent table cases; preserve each existing input and expected output.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/machine-controller/src/handler.rs`:
- Around line 10716-10718: Update the error message constructed in the map_err
closure to begin with lowercase “ipmi restart failed” while preserving the
machine ID and underlying error details.
---
Nitpick comments:
In `@crates/ipmi/src/tool.rs`:
- Around line 190-199: The address-mapping tests are separate deterministic
cases and should use table-driven test helpers. In crates/ipmi/src/tool.rs lines
190-199, update connection_args_include_non_default_port to iterate over cases
containing the address, username, and expected argument tail. In
crates/machine-controller/src/handler.rs lines 11963-11975, convert the
reported-port and fallback-port assertions into equivalent table cases; preserve
each existing input and expected output.
🪄 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: 0659a52d-9004-4524-b394-e7d5956279e8
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
crates/ipmi/src/bmc_mock.rscrates/ipmi/src/lib.rscrates/ipmi/src/test_support.rscrates/ipmi/src/tool.rscrates/machine-a-tron/Cargo.tomlcrates/machine-a-tron/src/bmc_mock_wrapper.rscrates/machine-controller/src/handler.rscrates/site-explorer/src/bmc_endpoint_explorer.rs
| .map_err(|e| { | ||
| StateHandlerError::GenericError(eyre!("IPMI restart failed for {}: {}", machine.id, e)) | ||
| }) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Lowercase the error message on Line 10717.
Use ipmi restart failed ...; repository error display messages must start with lowercase text.
🤖 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/machine-controller/src/handler.rs` around lines 10716 - 10718, Update
the error message constructed in the map_err closure to begin with lowercase
“ipmi restart failed” while preserving the machine ID and underlying error
details.
Source: Coding guidelines
Redfish discovery records the BMC's advertised IPMI port, but IPMI power operations currently use only the BMC IP address. As a result,
ipmitoolimplicitly connects to port 623 even when discovery reported a different port.This PR carries the complete BMC socket address through the IPMI interface and uses the port stored in the discovered endpoint metadata.
Specifically, it:
IPMITooloperations to accept aSocketAddr;ipmitoolwith-p;Related issues
Related: #3803
Type of Change
Breaking Changes
Testing
Additional Notes
Support for handling IPMI reboot commands in
bmc-mockis intentionally kept in a separate change so the two updates can be reviewed and merged independently.