reconciler: convergence loops
For Go code, follow the repository Go anti-pattern rules.
Metal specification · overview: Metal overview
Purpose
This package schedules convergence work. It owns no VM, image, snapshot, or traffic state.
Types
| Type | Responsibility |
|---|---|
VirtualMachineReconciler | Runs VM reconciliation passes. |
ImageReconciler | Caches images, prunes unused images, kernels, and staged snapshots. |
MigrationReconciler | Advances each active destination migration. |
GuestChecker | Pings running guests every minute, so a silent guest counts as unavailable. |
passScheduler | Runs a pass at startup, on an interval, and on request. |
Pass model
- Each operation has its own timeout.
- The VM pass limits concurrency, so one slow VM cannot block others.
- Errors are logged. A later pass retries safe operations.
- A failing VM waits twice as long after each failure, up to 1 minute. Wake clears the wait.
- Errors after cancellation are suppressed.
Ownership
- metald owns each goroutine and its context.
- The VM manager owns every state decision and per-VM lock.
Related
- internal/vm/SPEC.md owns VM reconciliation.
- internal/storage/SPEC.md owns image caching and pruning.