Skip to content

feat: export and push cloud images to OCI - #198

Closed
czmDeRepository wants to merge 5 commits into
cocoonstack:masterfrom
czmDeRepository:feat/oci-image-export
Closed

feat: export and push cloud images to OCI#198
czmDeRepository wants to merge 5 commits into
cocoonstack:masterfrom
czmDeRepository:feat/oci-image-export

Conversation

@czmDeRepository

@czmDeRepository czmDeRepository commented Aug 22, 2026

Copy link
Copy Markdown

Summary

  • push snapshots to OCI without changing clone/restore snapshot semantics
  • export Cloud Hypervisor cloud-image VMs as standalone qcow2 OCI artifacts
  • import and export local cloud images for host-to-host transfer
  • skip blobs that already exist in the registry

VM export behavior

A running VM is stopped under its lifecycle lock, its root qcow2 backing chain is flattened, and the VM is restarted before the registry upload begins. A VM that was already stopped remains stopped. Direct-boot filesystems and additional data disks are intentionally outside this export format.

Local file export uses a synchronized temporary file and atomic rename, so a failed copy does not truncate an existing image. If OCI publication succeeds but optional local retention fails, the command reports the published manifest digest instead of presenting the operation as a total failure.

Artifact semantics

Snapshot push preserves memory, device, disk, CPU, and guest topology state for compatible clone/restore consumers. VM export produces a portable system-disk artifact for a fresh vm run; it does not carry runtime memory state.

Validation

  • make lint
  • go test ./cmd/vm ./cmd/images ./cmd/snapshot ./images/cloudimg ./hypervisor/cloudhypervisor
  • go test ./...

chenzhongming.czm and others added 3 commits August 22, 2026 16:01
Change-Id: I5af4c00ff44126853cb4d67c71fe0ce6b904ab24
Change-Id: Ie4aa820df2f1ab1d6d760bff423a038d77e10e62
Change-Id: Icc50f1e7a30f312c9034d78c9dcf382a3b9ac203
Change-Id: I8b2b168cb6a4f072e54bb3d36e1136f926adcf86
Change-Id: I574397ec1ff22efe2966fa1c8d146c6db29b4e0b
@CMGS

CMGS commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

thanks for the work here, but we're not taking this direction. two reasons.

layer boundaries: registry push is the orchestrator's job in our stack. whoever consumes a snapshot pushes it, cocoon stays digest self contained and only pulls. pulling belongs here because clone has to materialize images on the node, pushing doesn't serve any cocoon operation.

don't duplicate existing mechanisms: vm export is a strict subset of what snapshot save/export/import/clone already covers (no memory state, no data disks, cloudimg only), and building goldens goes through snapshots too. images export has no consumer, images enter the store via pull or import so the source always exists on the producing side already.

if you hit a concrete workflow the snapshot family doesn't cover, please open an issue describing it first so we can discuss where the mechanism belongs.

@CMGS

CMGS commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

btw for the transfer use case you don't need new code at all. cocoon snapshot export gives you a portable archive, and oras can push that to any registry as an artifact (oras push reg/repo:tag snap.tar), crane does the same for plain qcow2 blobs and images. that plus snapshot import / images import on the other side covers host to host today, and keeps the registry side in standard tools instead of cocoon.

@CMGS CMGS closed this Aug 22, 2026
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.

2 participants