Skip to content

Clean up untracked VM disks after controller removal - #541

Merged
yzhuang-oai merged 1 commit into
mainfrom
dev/yzhuang/orchard-reconcile-untracked-vm-disks
Nov 20, 2026
Merged

yzhuang-oai merged 1 commit into
mainfrom
dev/yzhuang/orchard-reconcile-untracked-vm-disks

Conversation

@yzhuang-oai

Copy link
Copy Markdown
Contributor

Problem

After a worker restarts, a VM disk can remain on the host without a local VM handle. If the controller later removes the VM, normal polling has no record of the disk, and the startup-only disk scan never revisits it.

Solution

Run the existing on-disk reconciliation after each normal VM reconciliation. It stops and deletes disks no longer owned by either the controller or the local VM manager, and retries failed cleanup on later polls.

Approach and Implementation Details

Reuse the existing disk scan with a budget of the configured graceful stop timeout plus 30 seconds, so cleanup allows the runtime time to force termination if needed. Periodic cleanup failures are logged without restarting the worker session. Startup checks remain unchanged. VM creation and resume keep their existing behavior, including when periodic cleanup fails.

Testing

  • The lifecycle regression passed for controller-owned disks, legacy names, failed-clone handle release, a 31-second stop, cleanup retries, and preservation of unmanaged disks.
  • A local Tart 2.42.0 guest requiring forced termination was stopped and its disk removed after a 31-second grace period.
  • Worker, controller, client, and resource tests passed with the race detector. Changed-code lint and the Linux worker build passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T02:53:53.547156Z 132bdfd PR opened
🔒 Security Review ✅ Completed 2026-11-20T02:54:21.315207Z 132bdfd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@yzhuang-oai
yzhuang-oai merged commit 8d3af7e into main Nov 20, 2026
3 checks passed
@yzhuang-oai
yzhuang-oai deleted the dev/yzhuang/orchard-reconcile-untracked-vm-disks branch November 20, 2026 05:01
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.

2 participants