Skip to content

snapshots: stamp the pod's caller annotations on hibernate and latest pushes - #117

Merged
CMGS merged 2 commits into
mainfrom
snapshot-annotations
Sep 28, 2026
Merged

CMGS merged 2 commits into
mainfrom
snapshot-annotations

Conversation

@CMGS

@CMGS CMGS commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

What

  • Pusher.PushSnapshot takes the caller's annotations and copies them onto the pushed manifest; the cocoonstack.snapshot.from-node peer-discovery hint is written after them, so a caller cannot override it.
  • The hibernate push (update.go) and the delete-time latest push (snapshot.go) read vm.cocoonstack.io/snapshot-annotations through meta.ReadSnapshotAnnotations and pass the result.
  • A malformed value or a reserved key is logged as a warning and the push proceeds without caller annotations: metadata never blocks a hibernate or a delete.

Why

A business layer that creates the pod (vm-service) needs its own metadata on the snapshots vk-cocoon publishes for it (owner, lineage, manifest hash), and reads it back from the registry. cocoon-common's PushOptions.Annotations already existed; the hibernate and latest paths had no way to feed it. The engine stays a carrier and never interprets the values.

Dependency

Needs cocoonstack/cocoon-common#36. go.mod pins cocoon-common to that branch's commit (v0.3.7-0.20260928164220-c33e27e571b8); re-pin to the merge commit or tag before merging this.

Evidence

  • snapshots/pusher_test.go: a push through a capturing registry carries the caller key, the node hint wins over a spoofed caller value, the baseimage guard is intact, and the caller's map is not mutated.
  • Gates (GOWORK=off): make lint 0 issues on linux and darwin, make fmt-check clean, asl ./... clean on both GOOS, go test -race ./... green.
  • Not yet run on hardware. The kit's two-host E2E is running on main today; this change rides the next round.
  • Hot path: none. One JSON parse per snapshot push, off the claim and create paths.

… pushes

Reads vm.cocoonstack.io/snapshot-annotations through cocoon-common's typed
reader and passes the map to the pusher, which keeps the peer-discovery node
hint last so a caller cannot override it. A malformed value is logged and the
push goes ahead without caller annotations: metadata never blocks a hibernate
or a delete. Pins cocoon-common to the branch commit of cocoon-common#36.
CMGS added a commit that referenced this pull request Sep 28, 2026
The vm tests write a shell script and exec it at once, and most of them run in
parallel. A sibling test's fork that lands while the script is still open for
writing inherits that fd until its own exec, and our exec then fails with
ETXTBSY (golang/go#22315). It failed CI on #117. Holding syscall.ForkLock for
reading around the write keeps any fork out of that window. On Linux, 300
repetitions of the affected tests hit ETXTBSY 12 times before and 0 times in
two rounds after.
@CMGS
CMGS merged commit d083f91 into main Sep 28, 2026
4 checks passed
@CMGS
CMGS deleted the snapshot-annotations branch September 28, 2026 17:40
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