Skip to content

[live-migration] adds the snapshot proto for the shim state#2711

Open
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:lm_shim_state_proto
Open

[live-migration] adds the snapshot proto for the shim state#2711
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:lm_shim_state_proto

Conversation

@rawahars
Copy link
Copy Markdown
Contributor

@rawahars rawahars commented Apr 28, 2026

Summary

Introduces internal/controller/migration/snapshot, a new package that defines the wire format used to hand off a running LCOW sandbox between shims during live migration.

What's in this change

  • snapshot.proto — new protobuf schema describing a self-contained, point-in-time snapshot of an LCOW sandbox: the utility VM, its device sub-controllers (SCSI, VPCI, Plan9), per-pod network state, and the containers and processes running in the guest. The schema is versioned so that incompatible producers and consumers fail fast instead of silently corrupting state.
  • snapshot.pb.go — generated Go bindings (produced via protobuild; see Protobuild.toml).
  • doc.go — package overview describing the migration use case, the controller-oriented layout, and the source/destination caller flow.

Design notes

  • Controller-oriented layout: The schema mirrors the shim's existing controller boundaries: each controller on the source serializes its own bookkeeping into a dedicated section, and the corresponding controller on the destination rebuilds its in-memory state from that section. Adding new migratable state in the future is a localized change to the controller that owns it.
  • Functional hierarchy at the top of the .proto. A short ASCII tree summarizes the snapshot rooted at SandboxSnapshot (VM + sub-controllers, and per-pod network/containers/processes), plus a cross-reference table showing which string IDs in ContainerState / LayerReservation index back into the VM-level resource maps. This lets a new reader grasp the shape of a snapshot without scrolling through every message.
  • Schema versioning. SandboxSnapshot.schema_version is bumped whenever field semantics change; destinations must reject unknown versions.
  • Lifecycle enums. Each Stage enum mirrors the corresponding Go State iota in the controller it represents, with matching zero values so default-constructed messages map to the controllers' initial states.

@rawahars rawahars requested a review from a team as a code owner April 28, 2026 06:47
As part of live migration workflow, we need to snapshot the current state of the shim and then restore the same at the destination side. This change adds the proto which is a well-typed structure for the shim state used during Save/Restore.

Signed-off-by: Harsh Rawat <[email protected]>
@rawahars rawahars force-pushed the lm_shim_state_proto branch from 4f6f8b5 to dde22da Compare April 28, 2026 09:26
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