Skip to content

Commit dde22da

Browse files
committed
[live-migration] adds the snapshot proto for the shim state
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 <harshrawat@microsoft.com>
1 parent 562d6ce commit dde22da

5 files changed

Lines changed: 3229 additions & 0 deletions

File tree

Protobuild.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ prefixes = [
1919
"github.com/Microsoft/hcsshim/internal/shimdiag",
2020
"github.com/Microsoft/hcsshim/internal/extendedtask",
2121
"github.com/Microsoft/hcsshim/internal/computeagent",
22+
"github.com/Microsoft/hcsshim/internal/controller/migration/snapshot",
2223
"github.com/Microsoft/hcsshim/internal/ncproxyttrpc",
2324
"github.com/Microsoft/hcsshim/internal/vmservice",
2425
"github.com/Microsoft/hcsshim/pkg/migration",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//go:build windows
2+
3+
package snapshot
4+
5+
// SchemaVersion is the on-the-wire compatibility version for
6+
// [SandboxSnapshot]. Bump on any breaking change to snapshot.proto.
7+
const SchemaVersion uint32 = 1
8+
9+
// TypeURL is the type URL used when wrapping the migration snapshot
10+
// payload in an [google.golang.org/protobuf/types/known/anypb.Any]. It is
11+
// opaque to clients and only meaningful between two shims that agree on
12+
// [SchemaVersion].
13+
const TypeURL = "type.microsoft.com/hcsshim.migration.snapshot.v1.SandboxSnapshot"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Package snapshot defines the wire format used to hand off a running LCOW
2+
// sandbox from one shim to another during live migration.
3+
//
4+
// A snapshot is a self-contained, point-in-time description of everything the
5+
// destination shim needs in order to resume ownership of an existing utility
6+
// VM and the workloads running inside it: the VM itself, the device
7+
// sub-controllers attached to it (storage, PCI passthrough, file shares),
8+
// the per-pod network configuration, and the containers and processes
9+
// currently executing in the guest.
10+
//
11+
// The format is intentionally controller-oriented rather than API-oriented:
12+
// each controller on the source serializes its own bookkeeping into the
13+
// snapshot, and the corresponding controller on the destination rebuilds its
14+
// in-memory state from that section. This keeps the migration boundary
15+
// aligned with the existing ownership boundaries in the shim, so adding new
16+
// migratable state is a localized change to the controller that owns it.
17+
//
18+
// Callers on the source side produce a snapshot once the sandbox has been
19+
// quiesced and transmit it to the destination over the migration channel.
20+
// Callers on the destination side validate the snapshot, reconstruct the
21+
// controller tree, and then resume the workload. Snapshots are versioned so
22+
// that incompatible producers and consumers fail fast instead of silently
23+
// corrupting sandbox state.
24+
//
25+
// The Go bindings in this package are generated from the accompanying .proto
26+
// file; see Protobuild.toml for the generation pipeline.
27+
package snapshot

0 commit comments

Comments
 (0)