Skip to content

[live-migration] Preserve host-side GCS logging across migration#2826

Open
rawahars wants to merge 2 commits into
microsoft:mainfrom
rawahars:vsockexec_relay
Open

[live-migration] Preserve host-side GCS logging across migration#2826
rawahars wants to merge 2 commits into
microsoft:mainfrom
rawahars:vsockexec_relay

Conversation

@rawahars

Copy link
Copy Markdown
Contributor

Today a live-migratable LCOW pod gives up host-side GCS logging entirely, because the guest→host log connection is host-local state that migration doesn't carry: after a move there's no listener to reconnect to, and a guest that depended on the log socket would stall on boot. This PR makes that log path survive migration instead of disabling it.

It does so in two steps:

  • Make the forwarder resilient — vsockexec gets an opt-in reconnect mode (-r) that runs as a relay between the child and the host: it tolerates the host listener being absent at boot, and re-dials and resumes if the connection drops. Default behavior is unchanged.

  • Use it on the migration path — live-migratable pods now run vsockexec -r, and the destination host arms a fresh log listener before resume, so the migrated guest simply reconnects and keeps streaming GCS logs.


Net result: GCS logs keep flowing before, during, and after a live migration, with no change for non-migratable pods.

By default vsockexec dials the host once, hands the socket to the child
as its stdio, and execs into it. If the host listener is absent when the
guest starts, or the connection later drops, the child's writes fail and
it exits. Because the child runs under PID 1 in the UVM, its death makes
PID 1 exit and the guest kernel panics, taking the VM down.

Add a new -r flag that keeps vsockexec running as a relay between the
child and the host instead of exec'ing into it:

  - the child writes to a pipe (which never breaks), not to the socket;
  - vsockexec keeps the host connection itself and forwards the pipe to it;
  - it waits and retries if the host is not listening yet (late connect);
  - it re-dials and resends if the connection drops (reconnect);
  - the child's exit status is propagated, so PID 1 still sees the real
    exit code and shutdown semantics are unchanged.

Without -r the behavior is byte-for-byte identical to before, so no
existing caller is affected. stdout and stderr sharing one port continue
to share a single host connection.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
@rawahars rawahars requested a review from a team as a code owner July 14, 2026 21:49
@rawahars rawahars requested review from helsaawy and marma-dev July 15, 2026 10:05
Wire the reconnect mode (-r) added in the previous commit into the LCOW
live-migration path so live-migratable pods keep host-side GCS logging
instead of forgoing it.

Before, these pods dropped GCS log forwarding entirely: a plain
vsockexec would block on its outbound connect and stall guest init when
the host log listener was absent, so the wrapper and listener were
skipped. Reconnect mode removes that constraint:

  - buildGCSCommand emits /bin/vsockexec -r for live-migratable
    sandboxes, so the guest tolerates a missing listener and re-dials
    LinuxLogVsockPort after the connection drops;
  - StartWithMigrationOptions arms a fresh listener on the destination
    before start, so the resumed guest can reconnect and resume
    streaming;
  - setupLoggingListener no longer early-returns and Resume no longer
    force-closes logOutputDone.

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