Skip to content

fix(vmm): preserve orphan VM workdir on restart#594

Merged
kvinwang merged 1 commit intomasterfrom
worktree-vmm-no-delete-workdir
Mar 21, 2026
Merged

fix(vmm): preserve orphan VM workdir on restart#594
kvinwang merged 1 commit intomasterfrom
worktree-vmm-no-delete-workdir

Conversation

@kvinwang
Copy link
Collaborator

Summary

  • Only delete VM workdir during cleanup if .removing marker is present (user-initiated remove_vm)
  • Orphaned supervisor processes discovered at startup without the marker now preserve their workdir
  • Prevents accidental data loss when VMM restarts and finds stale supervisor entries

Context

When VMM is killed and restarted, it discovers supervisor processes that don't match any loaded VM as "orphans" and calls finish_remove_vm to clean them up. Previously this unconditionally deleted the workdir, destroying VM data (compose files, disk images, logs) that could be recovered.

Test plan

  • Start a VM, kill VMM process (not the VM), restart VMM — VM workdir should be preserved
  • Use remove_vm API — VM workdir should be deleted (.removing marker present)
  • Restart VMM after remove_vm with .removing marker — cleanup resumes and deletes workdir

@kvinwang kvinwang force-pushed the worktree-vmm-no-delete-workdir branch from 14dcc4e to bf07048 Compare March 21, 2026 04:26
Only delete the VM workdir during cleanup if the .removing marker file
is present (set by user-initiated remove_vm). Orphaned supervisor
processes discovered at startup without the marker now have their
workdir preserved, preventing accidental data loss on VMM restart.
@kvinwang kvinwang force-pushed the worktree-vmm-no-delete-workdir branch from bf07048 to 6cdb79c Compare March 21, 2026 04:39
@kvinwang kvinwang enabled auto-merge March 21, 2026 04:40
@kvinwang kvinwang merged commit f87c977 into master Mar 21, 2026
15 checks 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