Skip to content

feat: Let staff power unallocated servers on, off or restart them - #175

Closed
scotwells wants to merge 3 commits into
feat/manual-inventory-recordsfrom
feat/device-power-operations
Closed

scotwells wants to merge 3 commits into
feat/manual-inventory-recordsfrom
feat/device-power-operations

Conversation

@scotwells

@scotwells scotwells commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Staff power servers on and off by hand through each BMC today, with no record and nothing to stop a reset of a server that backs customer capacity.

This is a working prototype of the device power proposal: staff create a power operation, a site dispatcher checks it, and one short-lived worker sends at most one reset to the exact server named. Anything the worker cannot prove ends as Unknown, and nothing retries.

It ran end to end against a Milo project API and two TLS lab BMCs with simulated power. The power API and dispatcher are in no deployment root, but the Milo root picks up one new Device status field, the reset types discovery records.

Decisions for a person

Important

Milo v0.32.5 does not enforce the admission policy that ties the requester to the creating user, so a staff user can name someone else as requester. Building a root webhook, or taking the requester from Milo's audit record, is a choice for you.

  • Where the proposal left a question open, the prototype took the option it proposed: no capacity override, success when the requested state appears after a lost response, credentials named after the Device, and no expiry for operations no site serves.
  • Enabling the API in a Milo control plane, and deploying a dispatcher, are both left to you.

End-to-end run

One command builds a kind cluster with the Milo API, discovery, the dispatcher and the lab BMCs, then drives every operation as a staff user. It exited 0 on a fresh cluster in 541 seconds.

task device-power:acceptance

scenario                                                result     reason                  resets  jobs
On, dispatcher restarted after the request              Succeeded  RequestedStateObserved  1       1
ForceRestart                                            Succeeded  ResetObserved           1       1
ForceOff                                                Succeeded  RequestedStateObserved  1       1
PowerCycle, not offered by the BMC                      Failed     ResetTypeNotOffered     0       0
On with the wrong expected system UUID                  Failed     SystemUUIDMismatch      0       0
ForceRestart of a capacity-backed Device                Failed     CapacityBacked          0       0
On after the BMC reports another server                 Failed     SystemUUIDMismatch      0       1
On, response lost after the effect                      Succeeded  RequestedStateObserved  1       1
ForceOff, request lost, cloned worker started           Unknown    OutcomeNotObserved      1       1
On while another operation on the Device runs           Failed     OperationInProgress     0       0
ForceOff, worker deleted after its command              Unknown    WorkerLost              1       1
ForceRestart with two dispatchers running               Succeeded  ResetObserved           1       1
ForceRestart on a BMC without a reset time              Unknown    OutcomeNotObserved      1       1

Resets are counted from each lab BMC's own audit log. The run also found a site policy binding that denied every leader-election update in the cluster, which is fixed and covered by a test.

Test plan

  • The end-to-end run above passes on a fresh cluster
  • Unit and API-server tests for the dispatcher, worker, Redfish client and discovery pass with the race detector
  • The existing Redfish lab self-test and harness checks still pass

Related to #173

🤖 Generated with Claude Code

Power operations must refuse an action the server does not offer
before anything is sent. Discovery now records the
ComputerSystem.Reset types each System advertises, inline or from its
own ActionInfo, in status.discovery.inventory.systems[].resetTypes.
It reads them with GETs and never invokes the action.

The Redfish client also gains the read side a power worker needs:
find the one System carrying a UUID across every collection page,
re-read its power state and LastResetTime with an identity check, and
send one reset. Discover now shares the reset-type reader, so the
executor and discovery parse ActionInfo the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells
scotwells force-pushed the feat/device-power-operations branch from 4745cc9 to 294c5c8 Compare November 24, 2026 22:42
scotwells and others added 2 commits November 24, 2026 16:43
Staff power servers on and off by hand through each BMC today, with no
record, none of discovery's credential and TLS checks, and nothing to
stop a reset of a server that backs customer capacity.

DevicePowerOperation asks for one action on one Device. A dispatcher
in the site accepts or refuses it, starts one worker Job, and is the
only writer of its status. It holds no BMC credential. The worker
mounts one credential, re-checks the TLS key, the server's UUID and
the offered actions, sends at most one ComputerSystem.Reset, and
reports Succeeded only when it observes the result. Anything it
cannot prove is Unknown, and nothing retries.

The worker cannot reach Milo. It records its progress in a site stage
record. Claiming the record and writing it before the command are
optimistic updates, so a second worker, a second dispatcher or a
fenced lost worker sends nothing. A site Lease admits one running
operation per Device.

Site admission policies pin every dispatcher write to the worker
shape: one approved image, one credential named after the Device,
no privilege, and a Role limited to the worker's own record. The
bindings select a labelled namespace, because the policy parameter
is looked up before match conditions and an unscoped binding would
deny writes cluster-wide.

The Milo component ships the CRD, roles and a requester policy, and
is in no root. Milo v0.32.5 does not enforce that policy in a
project; see docs/operations/device-power.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The design needs proof against emulated BMCs and the real control
plane, not unit tests alone. task device-power:acceptance builds a
kind cluster with a Milo project API, BMC discovery, the dispatcher
and two lab BMCs serving TLS, and drives every operation as a staff
identity through Milo.

Each scenario records the result staff see and the number of resets
in the BMC's own audit log: success, refusals, a lost response with
and without effect, a cloned worker, a deleted worker, two
dispatchers, and a restart that cannot be proven.

The lab adapter gains what these scenarios need: TLS from a mounted
certificate, LastResetTime, and drop-request, swap-identity and
hide-reset-time faults. The docs record what is implemented and
verified, the choices made where the proposal left a question open,
and where the prototype differs from it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells
scotwells force-pushed the feat/device-power-operations branch from 294c5c8 to 1b402b3 Compare November 24, 2026 22:44
@scotwells
scotwells requested review from ecv and kevwilliams November 24, 2026 22:54
scotwells added a commit that referenced this pull request Nov 25, 2026
Power admission must refuse an action the server does not offer before
anything is sent. Discovery now records the ComputerSystem.Reset types
each System advertises, inline or from the System's own ActionInfo, in
status.discovery.inventory.systems[].resetTypes.

It reads them with GETs and never invokes the action. A reset target
or ActionInfo off the System records none. Discover and Inventory share
one reset-type reader, so both parse ActionInfo the same way.

An ActionInfo that cannot be read records no reset types and keeps the
rest of the inventory, so one broken link never costs a Device its
discovery. Ported from the power prototype in #175, without its worker
client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells

Copy link
Copy Markdown
Contributor Author

Superseded by #179 (the power operation kind) and the device custody foundation in #178 and #180. This prototype used its own lock, capacity rule and site dispatcher; those are replaced by the shared custody design in #174.

@scotwells scotwells closed this Nov 25, 2026
scotwells added a commit that referenced this pull request Nov 25, 2026
Power admission must refuse an action the server does not offer before
anything is sent. Discovery now records the ComputerSystem.Reset types
each System advertises, inline or from the System's own ActionInfo, in
status.discovery.inventory.systems[].resetTypes.

It reads them with GETs and never invokes the action. A reset target
or ActionInfo off the System records none. Discover and Inventory share
one reset-type reader, so both parse ActionInfo the same way.

An ActionInfo that cannot be read records no reset types and keeps the
rest of the inventory, so one broken link never costs a Device its
discovery. Ported from the power prototype in #175, without its worker
client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scotwells added a commit that referenced this pull request Nov 28, 2026
Power admission must refuse an action the server does not offer before
anything is sent. Discovery now records the ComputerSystem.Reset types
each System advertises, inline or from the System's own ActionInfo, in
status.discovery.inventory.systems[].resetTypes.

It reads them with GETs and never invokes the action. A reset target
or ActionInfo off the System records none. Discover and Inventory share
one reset-type reader, so both parse ActionInfo the same way.

An ActionInfo that cannot be read records no reset types and keeps the
rest of the inventory, so one broken link never costs a Device its
discovery. Ported from the power prototype in #175, without its worker
client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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