stack/packages/stack-cli/src
Bilal Godil d94aa661d8 capture emulator snapshot locally during pull instead of shipping from CI
QEMU migration state isn't portable across accelerators — a KVM-captured
snapshot won't resume under HVF, and `-cpu max` feature sets differ across
hosts. Instead of trying to match every (KVM/HVF/TCG, amd64/arm64)
combination in CI, capture the snapshot on the user's own machine during
`stack emulator pull`: download the qcow2, cold-boot once, wait for all
services, QMP migrate via mapped-ram + multifd, compress. Subsequent
`stack emulator start`s fast-resume in ~3-8s as before.

- Factor qmp_session + capture_vm_state out of build-image.sh into
  common.sh so run-emulator.sh can call them.
- Add cmd_capture to run-emulator.sh. build_qemu_cmd emits the
  resume-compatible device layout (phantom ISOs, no virtfs, fsdev +
  pcie-root-port, pinned 4096MB/4CPU) with -incoming defer gated on an
  actual snapshot being present, so capture mode reuses the same path.
- Capture regenerates runtime-config.iso with STACK_EMULATOR_VM_DIR_HOST
  empty — virtfs is detached for migration compat so /host isn't mounted;
  the `install internal-pck → /host/$VM_DIR_HOST` path would otherwise
  fail and restart-loop stack.service. Mirrors build-image.sh's CI
  runtime.env shape.
- stack-cli `pull` downloads only the qcow2 then invokes run-emulator.sh
  capture. Add --skip-snapshot for CI/debug. startEmulator auto-captures
  on the auto-pull fallback.
- Revert the arm64 CI split: delete qemu-emulator-build-arm64.yaml,
  restore arm64 to the unified matrix on ubicloud-standard-8 under
  cross-arch TCG (macOS HVF runner existed only to produce a portable
  snapshot; no longer needed). Drop savevm.zst from package/upload/publish
  steps; update release notes.

Verified end-to-end on an arm64 Mac under HVF: capture 50s, fast-resume
6.5s, all services green.
2026-04-16 11:12:42 -07:00
..
commands capture emulator snapshot locally during pull instead of shipping from CI 2026-04-16 11:12:42 -07:00
lib simplify emulator fast-start: tighter polls, drop dead wrappers 2026-04-15 14:42:20 -07:00
index.ts emu with a q stuff (#1266) 2026-04-04 00:33:52 +00:00