Conversation
…gine A deploy whose image is snapshot://<name> runs `vm clone --output json --name <id> [--network] [--data-disk] <name>` instead of `vm create`; the snapshot fixes cpu, memory, storage and guest os, the meta record is written from the clone's JSON as after a create, and a failed record removes the VM. A windows deploy of a snapshot is refused. The start path is unchanged: cocoon's PrepareStart returns without launching when the VMM already runs, so `vm start` on the running clone succeeds and the record refresh still runs. ImagePull only looks the snapshot up, and a present snapshot is its own local and remote digest, so such a deploy never reaches a registry and a missing snapshot fails the pull. RawEngine serves snapshot.save (save then inspect, one round trip), snapshot.list (the prose empty banner reads as []), snapshot.inspect and snapshot.remove; names are checked against cocoon's snapshot-name grammar before any round trip, and any other op stays ErrEngineNotImplemented.
A clone resumes with the source VM's systemd-networkd files keyed on the old MAC and its hostname, so the new NIC comes up without an address. After the record the engine rewrites them through vm exec from the clone's own network_configs (the same content cocoon prints as post-clone hints, which --output json omits), retrying until cocoon-agent answers; a clone that will not take its address is removed.
A clone keeps the source's /etc/hosts, so sudo in the guest warns that it cannot resolve the new hostname.
This branch has not been deployed
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.
Lets the cocoon engine start a workload from a cocoon snapshot instead of an OCI image, and exposes snapshot operations through
RawEngine.What changes
snapshot://<name>makesVirtualizationCreateruncocoon vm clone --output json --name <id> [--network ...] [--data-disk ...] <name>instead of create/run. Any other ref keeps the existing path. Windows clones are refused.snapshot://ref is resolved withcocoon snapshot inspectonly; the ref is its own digest, so no pull happens.snapshot.save,snapshot.list,snapshot.inspectandsnapshot.remove, with names validated against^[a-zA-Z0-9][a-zA-Z0-9._:/-]{0,62}$./etc/hosts. After the record is written, the engine runs a reseed throughcocoon vm exec. It rewrites the systemd-networkd files by MAC from the clone'snetwork_configs, sets the hostname, maps it in/etc/hosts, and restarts networkd. The reseed retries for up to 30 s while the guest agent comes up. If it fails, the VM is discarded rather than handed out with a stale network.Validation
make lintreports 0 issues;aslis clean on darwin and linux;go test ./engine/cocoon/...passes.snapshot.save;snapshot://...images with a published IP;sudoin the guest no longer warned about the hostname.Open points
RawEngineis routed by workload ID and locks that workload, so node-level ops (snapshot.list/inspect/remove) currently have to target some workload on the node.