Skip to content

feat: Phase 2 — suspend-on-idle for ImpVM - #24

Merged
syscod3 merged 2 commits into
mainfrom
feat/phase2-suspend-on-idle
Jul 5, 2026
Merged

feat: Phase 2 — suspend-on-idle for ImpVM#24
syscod3 merged 2 commits into
mainfrom
feat/phase2-suspend-on-idle

Conversation

@syscod3

@syscod3 syscod3 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Implements the density multiplier from the substrate comparison: idle ImpVMs snapshot to node-local storage and free their RAM, resuming on demand. Driven declaratively by spec.desiredState (Running|Suspended); Phase 3 (wake-on-traffic) will add the auto-trigger.

What's here

  • API (Task 1): VMPhaseSuspending/Suspended/Resuming, spec.desiredState (enum, default Running), status suspendSnapshotPath/suspendedAt; CRD + deepcopy regenerated.
  • Agent state machine (Task 2, reconciler.go): handleRunning transitions to Suspending when suspend is requested; handleSuspending snapshots node-local then stops the runtime to free memory (snapshot must succeed first); handleSuspended waits; handleResuming restores via Start and re-establishes VTEP/FDB.
  • Driver (Task 3, firecracker_driver.go): Start prefers status.suspendSnapshotPath (resume) over spec.snapshotRef, via a shared configureSnapshotBoot helper.
  • Operator guard: clears suspendSnapshotPath when rescheduling a VM off a lost node, so it cold-boots instead of failing to resume from a vanished node-local snapshot.
  • Tests: suspend, resume, and the no-free-without-snapshot guarantee (envtest + StubDriver).

Design (node-local "Pause" tier)

Node-local snapshot only (no ImpVMSnapshot object / object storage); eager restore (userfaultfd is Phase 4, gated on an SDK spike); suspended VM keeps its NodeName. Deferred: overcommit scheduler accounting (#4) folds in next now that Suspended exists.

Full design: syscode-ai-internal-plans/projects/imp/docs/plans/2026-07-04-phase2-suspend-on-idle-plan.md.

syscod3 added 2 commits July 5, 2026 22:50
Additive API for suspend-on-idle: VMPhaseSuspending/Suspended/Resuming,
spec.desiredState (Running|Suspended, default Running), and status fields
suspendSnapshotPath + suspendedAt. No behavior change; agent state machine
and driver restore path land in follow-up tasks.
Agent drives ImpVM through Suspending -> Suspended -> Resuming when
spec.desiredState flips. handleSuspending snapshots to node-local storage
then stops the runtime to free memory (snapshot MUST succeed before stop);
handleResuming restores via Start and re-establishes VTEP/FDB. Driver Start
now prefers status.suspendSnapshotPath (resume) over spec.snapshotRef, via a
shared configureSnapshotBoot helper.

Operator clears status.suspendSnapshotPath when rescheduling a VM off a lost
node so it cold-boots instead of failing to resume from a vanished snapshot.

Tests cover suspend, resume, and the no-free-without-snapshot guarantee.
@syscod3
syscod3 merged commit b9fc5c5 into main Jul 5, 2026
17 checks passed
@syscod3
syscod3 deleted the feat/phase2-suspend-on-idle branch July 5, 2026 22:33
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