Skip to content

feat: add GetPowerMetrics/SetPowerCap support - #474

Open
nuxster wants to merge 6 commits into
bmc-toolbox:mainfrom
nuxster:feat/power-cap
Open

nuxster wants to merge 6 commits into
bmc-toolbox:mainfrom
nuxster:feat/power-cap

Conversation

@nuxster

@nuxster nuxster commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR implement/change/remove?

First slice of the #442 split, per the request there to start small and only add core interfaces that every Redfish-backed provider can implement through redfishwrapper/gofish.

Adds the standard three-layer bmclib capability, following the shape of bmc/secure_boot.go (#457):

  • internal/redfishwrapper: GetPowerMetrics/SetPowerCap over gofish Chassis.Power(). Reads PowerControl[0] (consumed watts, capacity watts, PowerLimit.LimitInWatts). The cap is written with a PATCH of PowerControl[0].PowerLimit.LimitInWatts; nil sends null and clears the cap. gofish exposes no Update() on the Power resource, hence the explicit PATCH.
  • bmc: PowerMetricsGetter / PowerCapSetter interfaces, the PowerMetrics struct (consumed, capacity, limit) and the usual FromInterfaces dispatch.
  • Client.GetPowerMetrics / Client.SetPowerCap passthroughs; FeatureGetPowerMetrics / FeatureSetPowerCap.

Wired into every provider that embeds redfishwrapper.Client - redfish, dell, supermicro and lenovo - plus an examples/power-cap example (get / set / clear).

One commit per layer for review.

Checklist

  • Tests added
  • Similar commits squashed

The HW vendor this change applies to (if applicable)

Any BMC reached via the generic Redfish, Dell, Supermicro, or Lenovo XCC provider.

The HW model number, product name this change applies to (if applicable)

Validated on hardware: Lenovo ThinkSystem SR630 V2 (XCC). Dell and Supermicro wiring is covered by fixture tests only (same as the Lenovo wiring in #457).

The BMC firmware and/or BIOS versions that this change applies to (if applicable)

Requires the Redfish Power resource under Chassis with a PowerControl member. Validated against XCC Redfish 1.14.0.

What version of tooling - vendor specific or opensource does this change depend on (if applicable)

gofish (already a direct dependency, github.com/stmcginnis/gofish/schemas).

Description for changelog/release notes

Add GetPowerMetrics/SetPowerCap support for the redfish, dell, supermicro, and lenovo providers.

@nuxster nuxster mentioned this pull request Oct 8, 2026
2 tasks done
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