Skip to content

[live-migration] adds the paths for enabling save/restore#2709

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

[live-migration] adds the paths for enabling save/restore#2709
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:lm_gcs_methods

Conversation

@rawahars
Copy link
Copy Markdown
Contributor

Summary

Introduces the host-side primitives needed to snapshot in-flight container state on the source and re-attach to it on the destination, without disturbing the existing create paths.

  • cow.Process: add IOPorts() to expose the host-side vsock ports allocated for a process's stdio relay. Implemented on gcs.Process; stubbed (returns zeros) on hcs.Process and jobcontainers.JobProcess.

  • internal/gcs:

    • Process records the stdin/stdout/stderr vsock ports allocated by gc.exec, and Close tolerates nil io channels for streams not opened on restore.
    • Rename CloneContainer -> OpenContainer as the generic "attach to an already-running container" entry point.
    • Add Container.OpenProcessWithIO: restore-side counterpart of CreateProcess that re-listens on the supplied vsock ports and re-subscribes to the process exit notification.
    • Add GuestConnection.NextPort / SetNextPort to snapshot and seed the IO port allocator floor so restored processes don't collide with newly-allocated ones.
  • internal/cmd: add cmd.Attach, the destination-side counterpart of Command/CommandContext that binds a Cmd to a caller-resolved process and wires the IO relays. Relay wiring factored out of Start into startRelay. Tests cover Attach lifetime and IO flow.

  • internal/vm/guestmanager: add Guest.OpenContainer, NextPort and SetNextPort wrappers over the underlying GCS connection.

  • internal/vm/vmmanager: add UtilityVM.PropertiesV3 exposing the V3 HCS property query for the save path.

@rawahars rawahars requested a review from a team as a code owner April 27, 2026 19:17
@rawahars rawahars force-pushed the lm_gcs_methods branch 2 times, most recently from 4b69bce to abe57f8 Compare April 27, 2026 19:27
Introduces the host-side primitives needed to snapshot in-flight
container state on the source and re-attach to it on the destination,
without disturbing the existing create paths.

- cow.Process: add IOPorts() to expose the host-side vsock ports
  allocated for a process's stdio relay. Implemented on gcs.Process;
  stubbed (returns zeros) on hcs.Process and jobcontainers.JobProcess.

- internal/gcs:
  - Process records the stdin/stdout/stderr vsock ports allocated by
    gc.exec, and Close tolerates nil io channels for streams not
    opened on restore.
  - Rename CloneContainer -> OpenContainer as the generic "attach to
    an already-running container" entry point.
  - Add Container.OpenProcessWithIO: restore-side counterpart of
    CreateProcess that re-listens on the supplied vsock ports and
    re-subscribes to the process exit notification.
  - Add GuestConnection.NextPort / SetNextPort to snapshot and seed
    the IO port allocator floor so restored processes don't collide
    with newly-allocated ones.

- internal/cmd: add cmd.Attach, the destination-side counterpart of
  Command/CommandContext that binds a Cmd to a caller-resolved
  process and wires the IO relays. Relay wiring factored out of Start
  into startRelay. Tests cover Attach lifetime and IO flow.

- internal/vm/guestmanager: add Guest.OpenContainer, NextPort and
  SetNextPort wrappers over the underlying GCS connection.

- internal/vm/vmmanager: add UtilityVM.PropertiesV3 exposing the V3
  HCS property query for the save path.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
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