Repository navigation
meta: a pod annotation requests a live snapshot push, and its status answers it - #38
Merged
Merged
Conversation
tonicmuroq
force-pushed
the
tonic/snapshot-request
branch
2 times, most recently
from
October 11, 2026 14:54
8fa691d to
4ca2b76
Compare
tonicmuroq
added a commit
to cocoonstack/vk-cocoon
that referenced
this pull request
Oct 11, 2026
…e running VM vm.cocoonstack.io/snapshot names a registry-relative repo[:tag]. UpdatePod saves the running VM as snap-<vm> (never the VM-named warm-wake cache), pushes it there, drops the local copy, and answers in vm.cocoonstack.io/snapshot-status with the ref echoed and pushed or failed. The save pauses the VM only for its duration and keeps the NICs, so the result is a clone source. A VM that is not running or is hibernating fails the request instead of serving it later; a pending hibernate still runs afterwards. Each ref is answered once per pod incarnation: the answer is kept in memory, so a stale informer copy or a failed status patch re-patches the status without a second save. The request is read before the pod is tracked, since tracked pods' annotations are written under p.mu. The delete-time latest push and the requested push share saveAndPush. cocoon-common is pinned to cocoonstack/cocoon-common#38 until it merges.
tonicmuroq
force-pushed
the
tonic/snapshot-request
branch
from
October 11, 2026 15:00
4ca2b76 to
9d4a96c
Compare
tonicmuroq
added a commit
to cocoonstack/vk-cocoon
that referenced
this pull request
Oct 11, 2026
…e running VM vm.cocoonstack.io/snapshot names a registry-relative repo[:tag]. While the VM runs and no hibernate is asked for, UpdatePod saves it as snap-<vm> (never the VM-named warm-wake cache), pushes it there, drops the local copy, and answers in vm.cocoonstack.io/snapshot-status with the ref echoed and pushed or failed. The save pauses the VM only for its duration and keeps the NICs, so the result is a clone source. The pending ref is read before the pod is tracked, like the hibernate intent. The delete-time latest push and the requested push share saveAndPush. cocoon-common is pinned to cocoonstack/cocoon-common#38 until it merges.
…answers it vm.cocoonstack.io/snapshot names a registry-relative repo[:tag]; vk-cocoon saves the pod's running VM, which pauses only for the save and keeps its NICs so the result can serve as a clone source, and pushes it there. vm.cocoonstack.io/snapshot-status answers it with a JSON SnapshotStatus whose ref echoes the request, so a caller can tell its answer from an older one; a missing or malformed status reads as unanswered. snapshot.PushOptions.LocalName names the local snapshot to export when it differs from the registry repo; it defaults to Name, so existing pushes are unchanged.
tonicmuroq
force-pushed
the
tonic/snapshot-request
branch
from
October 11, 2026 15:10
9d4a96c to
40b0dbf
Compare
tonicmuroq
added a commit
to cocoonstack/vk-cocoon
that referenced
this pull request
Oct 11, 2026
…e running VM vm.cocoonstack.io/snapshot names a registry-relative repo[:tag]. While the VM runs and no hibernate is asked for, UpdatePod saves it as snap-<vm> (never the VM-named warm-wake cache), pushes it there, drops the local copy, and answers in vm.cocoonstack.io/snapshot-status with the ref echoed and pushed or failed. The save pauses the VM only for its duration and keeps the NICs, so the result is a clone source. The pending ref is read before the pod is tracked, like the hibernate intent. PushSnapshot now exports its vmName argument as the local snapshot (PushOptions.LocalName) instead of the repo; the hibernate and latest pushes pass the same name for both, so they are unchanged. The delete-time latest push and the requested push share saveAndPush. cocoon-common is pinned to cocoonstack/cocoon-common#38 until it merges.
tonicmuroq
added a commit
to cocoonstack/vk-cocoon
that referenced
this pull request
Oct 12, 2026
…e running VM vm.cocoonstack.io/snapshot names a registry-relative repo[:tag]. While the VM runs and no hibernate is asked for, UpdatePod saves it as snap-<vm> (never the VM-named warm-wake cache), pushes it there, drops the local copy, and answers in vm.cocoonstack.io/snapshot-status with the ref echoed and pushed or failed. The save pauses the VM only for its duration and keeps the NICs, so the result is a clone source. The pending ref is read before the pod is tracked, like the hibernate intent. PushSnapshot now exports its vmName argument as the local snapshot (PushOptions.LocalName) instead of the repo; the hibernate and latest pushes pass the same name for both, so they are unchanged. The delete-time latest push and the requested push share saveAndPush. cocoon-common is pinned to cocoonstack/cocoon-common#38 until it merges.
tonicmuroq
added a commit
to cocoonstack/vk-cocoon
that referenced
this pull request
Oct 12, 2026
…e running VM vm.cocoonstack.io/snapshot names a registry-relative repo[:tag]. While the VM runs and no hibernate is asked for, UpdatePod saves it as snap-<vm> (never the VM-named warm-wake cache), pushes it there, drops the local copy, and answers in vm.cocoonstack.io/snapshot-status with the ref echoed and pushed or failed. The save pauses the VM only for its duration and keeps the NICs, so the result is a clone source. The pending ref is read before the pod is tracked, like the hibernate intent. PushSnapshot now exports its vmName argument as the local snapshot (PushOptions.LocalName) instead of the repo; the hibernate and latest pushes pass the same name for both, so they are unchanged. The delete-time latest push and the requested push share saveAndPush. cocoon-common is pinned to cocoonstack/cocoon-common#38 until it merges.
tonicmuroq
added a commit
to cocoonstack/vk-cocoon
that referenced
this pull request
Oct 12, 2026
…e running VM vm.cocoonstack.io/snapshot names a registry-relative repo[:tag]. While the VM runs and no hibernate is asked for, UpdatePod saves it as snap-<vm> (never the VM-named warm-wake cache), pushes it there, drops the local copy, and answers in vm.cocoonstack.io/snapshot-status with the ref echoed and pushed or failed. The save pauses the VM only for its duration and keeps the NICs, so the result is a clone source. The pending ref is read before the pod is tracked, like the hibernate intent. PushSnapshot now exports its vmName argument as the local snapshot (PushOptions.LocalName) instead of the repo; the hibernate and latest pushes pass the same name for both, so they are unchanged. The delete-time latest push and the requested push share saveAndPush. cocoon-common is pinned to cocoonstack/cocoon-common#38 until it merges.
… tag per push A ref is answered once, pushed or failed, so a repeated or retried push under the same ref would read the old answer. The docs now say every push uses a new tag. The reader drops its ok result: the only consumer compares the ref, and a zero status already reads as unanswered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
meta.AnnotationSnapshotRequest=vm.cocoonstack.io/snapshot: a registry-relativerepo[:tag](tag defaults tolatest) that asks vk-cocoon to push a live snapshot of the pod's running VM there.meta.AnnotationSnapshotStatus=vm.cocoonstack.io/snapshot-status: vk-cocoon's answer, a JSONmeta.SnapshotStatus{ref, state, message}withstatepushedorfailed.refechoes the request, so a caller waits for a status carrying its own ref and can tell it from an older answer.meta.ReadSnapshotStatus(pod),SnapshotStatus.Annotations(): the typed reader and the merge-patch map; a missing or malformed status reads as the zero status, which no ref matches.snapshot.PushOptions.LocalName: the local snapshot to export when it differs from the registry repo (Name); empty falls back toName, so existing callers are unchanged. vk-cocoon saves a requested snapshot assnap-<vm>and pushes it to the caller's repo.docs/meta.md: both keys in thevm.cocoonstack.io/row and one paragraph in the snapshot contract.Why
The developer API lets a user snapshot their machine and later create or reset a machine from it. Today vk-cocoon pushes only on its own schedule: the
hibernatepush (CH+Windows drops the NIC first, so it cannot serve as a clone source) and the delete-timelatestpush (the VM is gone afterwards). There is no way to ask for a push of a VM that keeps running.cocoon snapshot savealready pauses only for the save and resumes, and keeps the NICs, which clone hot-swaps for fresh ones, so the result is a clone source like the base snapshots. The request goes straight on the pod rather than through the CocoonSet: it touches one VM and creates or deletes no pods, so the operator has nothing to coordinate.Consumer
vk-cocoon PR to follow, pinned to this branch's commit until this merges.
Gates
make fmt-checkclean,go test -race ./...green (GOWORK=off).make lintcould not run locally (golangci-lint v2.13.2 cannot read Go 1.27.2 export data); leaving it to CI.