Add the microVM VMM launcher (config + process lifecycle)#278
Merged
Conversation
Follow-up to the microVM scaffolding (#276): add the mechanical layer that boots a guest -- MicroVMLauncher -- so the backend has a real, tested VMM lifecycle beneath it. - MicroVMLauncher.build_command renders the Firecracker argv (--api-sock / --config-file); a ready host running a not-yet-supported VMM is reported as unimplemented rather than mis-launched. - launch() materializes the MicroVMConfig JSON into a per-VM working directory, spawns the VMM process, and returns a LaunchedMicroVM handle; the workdir is cleaned up if startup fails. - terminate() stops the process (SIGTERM, then kill on timeout) and removes the working directory, and is safe to call after the process has already exited. Booting a guest end-to-end still needs KVM and a guest image, so the launcher is tested against a fake VMM (a script that ignores its args and sleeps): config materialization, command construction, launch/alive/terminate, cleanup-on-error. This is only the VMM lifecycle. The in-guest agent and the vsock cell transport remain the next increment, so Supervisor._spawn_microvm still fails closed with a refreshed message; no working microVM sandbox is returned yet. README and the threat model are updated accordingly. Full suite: 498 passed, 6 skipped. black/isort/flake8/mypy clean; pylint 9.50. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PbbJc7Ntj159D9LNGevwC2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the microVM scaffolding (#276): adds the mechanical layer that boots a guest —
MicroVMLauncher— sobackend="microvm"has a real, tested VMM lifecycle beneath it.What's included
build_commandrenders the Firecracker argv (--api-sock/--config-file). A ready host running a not-yet-supported VMM (Cloud Hypervisor, QEMU) is reported asMicroVMUnavailable("not implemented")rather than mis-launched.launch()materializes theMicroVMConfigJSON into a per-VM working directory, spawns the VMM process, and returns aLaunchedMicroVMhandle (pid, workdir, config/socket paths). The workdir is cleaned up if startup fails.terminate()stops the process (SIGTERM, then kill on timeout) and removes the working directory, and is safe to call after the process has already exited.Explicitly still out of scope
Booting a guest end-to-end needs KVM and a guest image, and — more importantly — the in-guest agent and the vsock cell transport that carry
exec/call/post/recvinto the VM. Those remain the next increment. SoSupervisor._spawn_microvmstill fails closed (with a refreshed message noting the launcher now exists); no working microVM sandbox is returned yet.How it's tested without KVM
The launcher is driven against a fake VMM — a tiny script that ignores its arguments and sleeps — so CI exercises the real code paths: config materialization (the written JSON matches
to_firecracker_json()), command construction,launch → alive → terminate, cleanup-after-exit, and cleanup-on-error (workdir isn't leaked whenbuild_commandrejects an unsupported VMM).README and the threat model are updated to reflect that the launcher exists but the guest agent/transport is pending.
Full suite: 498 passed, 6 skipped. black/isort/flake8/mypy clean; pylint 9.50 (gate 8.0).
🤖 Generated with Claude Code
Generated by Claude Code