mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[GH-ISSUE #11] Add support for VM migration #8
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yingdi-shan on GitHub (Jul 27, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/11
Summary
Add the ability to move a sandbox from one AgentENV node to another. The core insight is that we already have fast snapshot and fast resume, so migration is mostly orchestration on top of existing primitives: capture (or reuse) a self-contained snapshot on the source node, make its artifacts reachable from the target node (P2P-first), resume on the target preserving sandbox identity, then tear down the source and hand off the scheduler binding so the gateway routes traffic to the new node.
Two cases, with different cost profiles:
capture_snapshotplus create-from-snapshot.Motivation
Migration unlocks node draining for maintenance, load rebalancing, and bin packing. Paused sandboxes in particular are cheap to move because their state is already materialized, so making them mobile is high value for low cost.
Proposed design
Introduce a migration flow (orchestrator + scheduler RPC) parameterized by source node, target node, and sandbox ID. Preserve the
SandboxIdend-to-end so the gateway keeps routing transparently after the binding flips.Scenario A: running VM
capture_snapshotto produce a self-contained committed snapshot (recentfix(sandbox): capture self-contained snapshot during pausealready moves us toward self-contained capture).SandboxId, wait forRunning.RecordAssignment), then delete the source sandbox.Scenario B: paused VM (P2P only, no re-snapshot)
FirecrackerSnapshotConfig(vm_state.bin,mem_image.jsonoverlaybd layers including stacked ancestors, rootfs layers, writable drive layers) andtransport.publishthem. Reuse the content-addressedoverlaybd-layer/v1/sha256:<digest>keys fromsrc/overlaybd/p2p/artifact.rsfor layers, and apaused/v1/...(or reusesnapshot/v1/artifacts/...) namespace for the fixedvm_state.bin+ a reconstructable manifest.FirecrackerSnapshotConfigfrom the published manifest and materializes every layer from P2P, then resumes.Key challenges to resolve
mem_image.jsonand rootfs are stacked overlaybd layers with parent ancestry. All ancestors must be reachable on the target. Content-addressed layer keys help, but the publish step must walk the full layer chain, not just the top layer.drives/<id>/image.jsonlayers must migrate too.Running, and the source must not be deleted before the binding moves, to avoid a routing gap. Define the ordering and a rollback path if target resume fails.cpu_config_json, applied via pre-bootPUT /cpu-config) is a precondition; migration should refuse or warn if the target cannot satisfy it.Suggested phasing
capture_snapshot+ create-from-snapshot.Acceptance criteria
SandboxId.