Skip to content

feat: Record whether discovery read each server's reset options - #251

Merged
scotwells merged 4 commits into
feat/manual-inventory-recordsfrom
feat/bmc-discovery-reset-types-status
Nov 29, 2026
Merged

scotwells merged 4 commits into
feat/manual-inventory-recordsfrom
feat/bmc-discovery-reset-types-status

Conversation

@scotwells

@scotwells scotwells commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #181. A server with no recorded reset options looked the same whether its BMC offers none or discovery failed to read them, so power operations could not tell when to refuse and when to check the live BMC.

Each discovered system now carries a flag that is true only when discovery read its advertised reset options, even an empty set.

A new Device condition tells operators why a read failed, without changing discovery's own result or failing the inventory read.

Test plan

  • Inline and ActionInfo option lists, including empty ones, set the flag, and a system that advertises no list or more than 16 options leaves it unset
  • A missing, failing, timed-out or malformed ActionInfo leaves the flag unset with the matching condition reason, and discovery still succeeds
  • A rejected credential on the ActionInfo still fails the whole read
  • A disposable API server stores and clears the flag through status patches

Decisions for a person

Related to #181

🤖 Generated with Claude Code

An omitted resetTypes meant both "the BMC offers none" and "the read
failed". The field now uses omitzero, so an empty advertised list,
inline or from the ActionInfo, is stored as []. The previous omitempty
tag dropped it on every marshal, including the Device's JSON deep copy.
An omitted list now always means unknown.

A new ResetTypesRead condition reports why the list is unknown:
ResetActionMalformed, ActionInfoNotFound, ActionInfoUnreadable,
ActionInfoMalformed or TooManyResetTypes. More than 16 distinct types
is now unknown instead of a truncated list, which would refuse a type
the BMC offers. Discovered and the rest of the inventory are unchanged,
and a rejected credential still fails the whole read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells
scotwells requested review from ecv and kevwilliams November 28, 2026 20:46
@scotwells scotwells added the multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners label Nov 28, 2026
scotwells and others added 2 commits November 28, 2026 14:49
A reset type list of only blank or null values was stored as an empty
list, which reads as "offers none" and would refuse every action. It is
now unknown with ResetActionMalformed. A truncated ActionInfo body is
ActionInfoMalformed rather than unreadable. The True ResetTypesRead
message and the docs now say it means no read failed, not that a list
was recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An empty resetTypes list cannot be told from an omitted one: the field
is omitempty, and pruning, apply and other clients do not keep an
empty list reliably. resetTypes goes back to #181's tag unchanged.

A per-System resetTypesObserved boolean is now true only when this read
got an advertised list, inline or from the ActionInfo, even an empty
one. A failed read, a System that advertises no list, a list of only
blanks or more than 16 types leaves it absent, so the types are
unknown. ResetTypesRead keeps explaining failures for operators.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells scotwells changed the title feat: Tell a failed reset type read from a BMC that offers none feat: Record whether discovery read each server's reset options Nov 28, 2026
@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
An empty inline reset list next to an ActionInfo without ResetType
values was observed as an empty list, which power reads as offers none
and would refuse every action. With an ActionInfo, only its values now
count, so that case is unknown and the live BMC check decides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 marked this pull request as ready for review November 28, 2026 21:31
@scotwells
scotwells requested a review from a team as a code owner November 28, 2026 21:31

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

resetTypesObserved is set only for a fully read list, and over-cap, blank or failed reads leave it unknown with a reason instead of a truncated list.

@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 flag is true only for a successfully read list (inline or ActionInfo, including empty), and every failure path I traced leaves it unset with the right reason while discovery still succeeds. Types, CRD and doc agree, and go-test, checks and all four acceptance runs at 11e0423 are green.

  • Checked in internal/redfish/reset.go and internal/bmcdiscovery/status.go: 404, other status or timeout, malformed ActionInfo, malformed or off-System action, blank-only list and more than 16 distinct values each map to their own reason with the flag unset. 401, 403, pin mismatch and identity still fail the whole read (systemResetTypes returns them as fatal).
  • No stale true: ResetTypesObserved is rebuilt per System in observedInventory, and the systems array is atomic in the CRD, so the merge patch in reconciler.go replaces it and an omitempty false drops the key. A later successful read with a failed ActionInfo clears it (test at reset_types_test.go:197). A read that fails outright keeps the whole retained inventory, flag and ResetTypesRead together, so the condition never contradicts the inventory it describes, and it does not touch Discovered.
  • Guard mutation: dropping p.AllowableValues != nil fails TestResetTypesStatus; switching the inline check to len(Allowed) != 0 fails TestInventoryRecordsResetTypes and TestResetTypesStatus; moving the 16 cap fails TestResetTypesStayWithinTheSchema. The tests guard what the PR claims.
  • Consumer fit with fleet#179 (4c48d63) and #190 (9f489d5): #179's resetTypesObserved is a len(ResetTypes) > 0 stub marked "Replaced by system.ResetTypesObserved once discovery records it", so the swap is one line, but its test "an empty list is not observed and admits" must flip to refuse once the flag is real. Any stale true is bounded there by the DiscoveryNotCurrent window (twice the interval, same endpoint), and #190's worker checks the live BMC regardless, so a wrong true cannot send an action the BMC does not offer.

Follow-ups:

  • The ResetTypesRead=True message "no System's reset type read failed" is easy to misread as "types were observed", which the doc has to caveat. Consider a message that distinguishes "none failed" from "some Systems advertise no list", or leave the condition False-only.
  • #179's snapshot does not carry the observed flag, only the offered list, so a later audit cannot tell "BMC offers none" from "unknown" for an admitted operation. Add it when the stub is replaced.
  • Identify now returns the bare ErrMalformed for a bad ActionInfo where it used to return the generic unreadable-response error. Both callers (Discover, site access.go) treat any non-pin, non-identity error alike, so nothing changes today. Keep it in mind if either starts matching on error text.
  • Agree with the PR body that #171 touches the same inventory read and status code: whichever lands second rebases, and the flag round trip test should be re-run after it.

@scotwells
scotwells merged commit cd656ad into feat/manual-inventory-records Nov 29, 2026
20 checks passed
@scotwells
scotwells deleted the feat/bmc-discovery-reset-types-status branch November 29, 2026 01:37
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