Skip to content

feat(site): Run power operations at the site - #190

Merged
scotwells merged 7 commits into
feat/manual-inventory-recordsfrom
feat/device-power-worker
Nov 29, 2026
Merged

scotwells merged 7 commits into
feat/manual-inventory-recordsfrom
feat/device-power-worker

Conversation

@scotwells

@scotwells scotwells commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Related to #173. Stacked on #179.

Redfish sites now run admitted power operations beside installs, wipes and commissioning. The worker sends at most one reset, never resends after a crash or lost response, and reports success only for what it then observes. When discovery did not observe the server's reset actions, its live read of the BMC decides whether the action is offered. The lab BMC gains a reset time from its first read, and faults for a withheld request, a hidden reset time and a swapped identity.

Test plan

  • Each action sends one reset and proves its result, an action already in effect sends nothing, and each refusal sends nothing
  • With no reset actions recorded, an offered action runs and one the BMC lacks ends Failed with nothing sent
  • A lost response, a resumed worker and two workers for one assignment send exactly one reset
  • Every success the worker reports passes the coordinator's evidence and proof checks

Decisions for a person

  • The lab BMC reports when the last reset happened on every System read, and its withheld-response fault follows any applied reset rather than only a power-on. The acceptance run arms that fault only for a power-on.
  • No end-to-end run creates a power operation yet, and the multi-plane Metal provider has no grant to create one.

🤖 Generated with Claude Code

@scotwells
scotwells requested review from ecv and kevwilliams November 25, 2026 15:59
@scotwells
scotwells force-pushed the feat/device-power-kind branch from c036142 to f93a539 Compare November 25, 2026 17:44
@scotwells
scotwells force-pushed the feat/device-power-worker branch from f18100d to a8501b6 Compare November 25, 2026 17:46
@scotwells
scotwells force-pushed the feat/device-power-kind branch from f93a539 to c6dcaa8 Compare November 26, 2026 00:55
@scotwells
scotwells force-pushed the feat/device-power-worker branch 3 times, most recently from 38d73b3 to acdab22 Compare November 26, 2026 02:00
@scotwells
scotwells force-pushed the feat/device-power-kind branch from c6dcaa8 to b403325 Compare November 28, 2026 17:41
@scotwells
scotwells force-pushed the feat/device-power-worker branch from acdab22 to 7bd9f3f Compare November 28, 2026 17:41
@scotwells
scotwells force-pushed the feat/device-power-kind branch from b403325 to 6762ac0 Compare November 28, 2026 18:08
@scotwells
scotwells force-pushed the feat/device-power-worker branch from 7bd9f3f to 32d8ced Compare November 28, 2026 18:08
@scotwells scotwells added the multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners label Nov 28, 2026
@scotwells
scotwells marked this pull request as ready for review November 28, 2026 19:19
@scotwells
scotwells requested a review from a team as a code owner November 28, 2026 19:19

@ecv ecv 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.

Approve.

The worker only ever runs an admitted assignment, sends at most one reset, and its restart behaviour is tested. Whether a forced power-off can hit a server mid-wipe or mid-commissioning is decided by custody in #179, not here.

  • Admission: the runner works from a custody Assignment and refuses a late start with Stale when nothing was sent (runner.go). Once a command is sent, a failure ends as OutcomeUnknown rather than Failed, so a hold follows.
  • Idempotency: the reset payload (send time, the power read before it, the reset-time baseline) is journaled by work.Step before the send. A resumed worker observes instead of resending. TestAResumedWorkerNeverSendsASecondReset, TestALostResponseIsObservedAndNeverResent and TestTwoWorkersForOneAssignmentSendOneReset cover it. A journal from another fence is not reused (TestAResetJournaledUnderAnotherFenceIsNotReused).
  • Timeouts: 2 minutes to start, 3 minutes of observation after the command, 1 minute of BMC outage tolerance, inside the 8-minute PowerDeadline. If the observation window has already closed when a resumed worker looks, the result is a ReasonStep failure after a send, which becomes a hold. That is the safe outcome.
  • Registration: the kind is registered only in the Redfish site (cmd/fleet-multiplane/site.go). The local VM site has none, so it refuses an unsupported kind with nothing sent.

Follow-ups:

  • The worker has no wipe or commissioning guard of its own. Mutual exclusion is custody's single active operation plus holder rules. Add a worker-level test or note saying so, so a later change to the queue rules cannot silently allow a ForceOff during a wipe.
  • A re-admission under a new fence that finds the server already Off reports success with no command (evidence.RequestSentAt nil). That is correct, but the earlier attempt's unconfirmed send leaves no trace in the result.

@kevwilliams kevwilliams 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.

Power runs through the shared fenced framework, an already-reached state sends nothing, the result is read back from the BMC, and any unproven send ends OutcomeUnknown.

@scotwells
scotwells force-pushed the feat/device-power-kind branch from 6762ac0 to f016150 Compare November 28, 2026 20:21
@scotwells
scotwells force-pushed the feat/device-power-worker branch from 32d8ced to c4fc2ce Compare November 28, 2026 20:22
@scotwells
scotwells force-pushed the feat/device-power-kind branch from f016150 to 4c48d63 Compare November 28, 2026 21:00
@scotwells
scotwells force-pushed the feat/device-power-worker branch from c4fc2ce to 9f489d5 Compare November 28, 2026 21:00
@scotwells scotwells added multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners and removed multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners labels Nov 28, 2026
@scotwells
scotwells requested review from ecv and kevwilliams November 28, 2026 21:09

@ecv ecv 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.

Approve.

The delta is a test plus the lab seed. The worker's Check reads conn.System.ResetTypes live at the BMC and refuses ResetTypeNotOffered before any step, so the snapshot's empty list never decides anything there. Prior #181 follow-up "consumers should read the live list at action time": resolved.

  • TestALiveReadDecidesWhenDiscoveryRecordedNoResetTypes covers both branches. An offered action runs with exactly one reset and valid evidence; an unoffered one ends Failed ResetTypeNotOffered with zero sent.
  • Sending at most one reset and never re-sending after restart are unchanged and stay covered by the existing journal tests (TestAResumedWorkerNeverSendsASecondReset, TestALostResponseIsObservedAndNeverResent, TestTwoWorkersForOneAssignmentSendOneReset). The new test does not exercise resume.
  • Lab seed: last_reset.setdefault(sid, now()) then atomic_write, so a persisted time wins and a restart of the adapter never moves a baseline forward. test_5a checks every target is seeded and persisted.

Follow-ups:

  • The new test calls Run directly with a hand-built snapshot. It does not show the framework running Check first for a worker started from an admitted operation. One case through site.Runner would close that.

@scotwells
scotwells force-pushed the feat/device-power-kind branch from 4c48d63 to 4b0e723 Compare November 29, 2026 01:56
@scotwells
scotwells force-pushed the feat/device-power-worker branch from 9f489d5 to 4f64ad7 Compare November 29, 2026 01:57
@scotwells
scotwells requested a review from ecv November 29, 2026 02:07

@ecv ecv 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.

Approve. Rebase onto the updated #179 with no change to this PR's own commits since 9f489d5.

scotwells and others added 7 commits November 28, 2026 20:16
A power worker proves a restart only when the BMC reports a reset after
the command, or when it sees the server off. Observe now returns the
System's LastResetTime, and leaves it zero when the BMC reports none or
a time it cannot parse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The power worker reads the server's power before it sends anything and
sends at most one ComputerSystem.Reset. On and ForceOff send nothing
when the server is already in the requested state. A restart or power
cycle of a server that is off refuses with NotPoweredOn, a transition
state with PowerStateNotSettled, and a late start with Stale, each with
nothing sent.

The reset is one journaled step whose payload records when it was
sent, the power before it, and the BMC's reset-time baseline. Success
needs the requested state within three minutes; a restart also needs
the reset time to move past the baseline, or the server seen off, and
then the server on again. After a crash or a lost response the worker
watches for the effect and never sends a second reset. Anything it
cannot prove ends OutcomeUnknown.

The power kind declares NotPoweredOn for the worker and
PowerStateNotSettled for both sides. No site registers the worker
until the cutover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Power operations need a BMC that reports when a reset happened, and
faults that withhold a request, hide the reset time, or report another
server. The lab adapter now persists LastResetTime and moves it forward
each time a reset starts the domain.

New faults: drop-request withholds the response and never applies the
reset; hide-reset-time and swap-identity hold until cleared. A withheld
response now follows any applied reset, such as a ForceOff, not only a
power-on. The adapter self-test covers each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The custody guide's power section records what the worker checks
before the command, how it proves each action, how it resumes after a
crash, and three places where the site framework or the coordinator
still does not fit #173.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cutover runs the site worker framework in each multi-plane cell. A
Redfish cell now registers the power worker beside the install, wipe
and commissioning workers, so an admitted power operation reaches its
BMC. The local VM cell has no BMC and keeps refusing power as an
unsupported kind, with nothing sent.

No end-to-end run creates a power operation yet. The guide records
that gap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The coordinator now counts a power success only with the requested power
state and, for a restart or power cycle, proof of the reset. Each worker
test that checks evidence now also runs that proof on every success the
worker reports, so the worker and the coordinator cannot drift apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When discovery recorded no reset types, the coordinator now admits a
power operation and the worker's live read of the BMC decides. The new
test admits a restart whose snapshot names no offered actions: it runs
when the BMC offers the action, and ends Failed with nothing sent when
it does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells
scotwells force-pushed the feat/device-power-kind branch from 4b0e723 to cf80de8 Compare November 29, 2026 02:26
@scotwells
scotwells force-pushed the feat/device-power-worker branch from 4f64ad7 to 66a9d31 Compare November 29, 2026 02:26
@scotwells scotwells added multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners and removed multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners labels Nov 29, 2026
@scotwells
scotwells requested a review from ecv November 29, 2026 02:40

@ecv ecv 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.

Approve. Rebase onto the base branch after #252 merged; this PR's own commits are unchanged.

Base automatically changed from feat/device-power-kind to feat/manual-inventory-records November 29, 2026 03:16
@scotwells
scotwells merged commit 82d6983 into feat/manual-inventory-records Nov 29, 2026
20 checks passed
@scotwells
scotwells deleted the feat/device-power-worker branch November 29, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants