Skip to content

Spec/restart stopped vm - #9

Merged
pminnebach merged 9 commits into
mainfrom
spec/restart-stopped-vm
Oct 14, 2026
Merged

pminnebach merged 9 commits into
mainfrom
spec/restart-stopped-vm

Conversation

@pminnebach

Copy link
Copy Markdown
Owner

No description provided.

root and others added 9 commits October 14, 2026 17:14
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d delete

stop now releases runtime resources but keeps the disk, configuration and
network slot. start <id> boots a stopped or crashed VM from its preserved
disk with its saved configuration; restart and delete are new; list reports
running, stopped, crashed and legacy. Records are split into config.json,
state.json and stopped.json. See docs/adr/0001-stop-preserves-the-vm.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Start fell through to the creation path on any Inspect error, so a corrupt
config.json or state.json made the creation failure path delete the VM
directory and its disk. It now creates only on "does not exist". Index
allocation fails while any VM's records are unreadable instead of freeing
its index, and a failed allocation no longer leaves an empty directory.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…a racing start

Wait for the VM process to be gone after SIGKILL and leave the VM untouched
if it is not. Copy a crashed VM's block images back to the host only when
e2fsck passes, since the copy deletes host files missing from the image.
Take the state lock in stop, delete, cleanup and the stop half of restart so
they cannot release the shared host network under a start in progress.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Firecracker's stdout and stderr defaulted to fcvm's own, so the guest's
serial console printed into the user's shell and, under sudo's pty, was
written to a terminal that goes away when fcvm exits. Point them at
vms/<id>/console.log, opened for append so earlier boots stay readable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The SDK stops the VM, and exec.CommandContext kills it, when the context it
was started with is cancelled. fcvm passed the command's context, which is
cancelled as the command returns, so a VM could be stopped moments after
start depending on a race with process exit. Launch with a context that is
not cancelled, and handle Ctrl+C during boot explicitly: remove a VM being
created, return a VM being restarted to stopped.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A failed restart of a crashed VM now leaves it stopped with a stop time. A
stop interrupted after its record is written is finished by the next stop.
A VM with only a configuration record is incomplete and is never booted.
An unreadable stop record is an error. shapeFrom now treats unlisted
config fields as shape. Use VM, not microVM, in help text, name the
state.json constant and share the record-removal helper.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@pminnebach
pminnebach merged commit b8017aa into main Oct 14, 2026
1 check passed
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