feat(restore): restore VM from :hibernate on cross-node create#24
Conversation
42af387 to
506d0bb
Compare
|
Rebased onto The One metric-consistency call for you (non-blocking):
Two nits while you're in there: Otherwise #24 is merge-ready. |
CreatePod restores a hibernated VM on a new node instead of cloning a fresh one from the base image. Extracts wake()'s restore core into cloneFromHibernate (resolve source + CH+Windows --nics 1 hot-add + drop import copy) and dispatchHibernateRestore (CH+Windows waits on the fresh NIC's lease, others run runPostCloneSetup). bringUpVM gains a first-priority restore branch gated on the restore-from-hibernate annotation; the create dispatch skips base-image post-clone setup for restores, so a Windows restore hot-adds the NIC without a redundant PnP recycle. Requires cocoon-common with AnnotationRestoreFromHibernate; bump the require before merge.
Cross-node migration deletes the old pod after hibernate has already removed + forgotten the VM. Pins that DeletePod then takes its v==nil early return and removes no snapshot, so the epoch :hibernate checkpoint survives the deletion.
506d0bb to
8c6bf0c
Compare
…on clone failure - dispatchHibernateRestore: drop the op==update gate so a cross-node create restore bumps WakeTotal(ok) like a wake (the CH+Windows dropNIC path already did via finalizeDropNICWake) — a restore is a wake regardless of trigger. - CreatePod: on a restore bring-up failure, bump WakeTotal(failed) too, so the cross-node create path is symmetric with wake()'s failure accounting. - create.go: label a restore's VMBootDuration "clone" like wake, not spec.Mode. - cloneFromHibernate: defer cleanupWakeImport so a failed Clone doesn't leak the cross-node import copy (also fixes the pre-existing wake-path leak).
Drop the cloneFromHibernate inline comment that restated its doc; condense the create-path restore note.
Lets a hibernated VM come back on a different node instead of booting fresh from the base image — the core capability behind cross-node
migrate.What
CreatePod/bringUpVMgains a first-priority restore branch (gated on therestore-from-hibernateannotation): resolves the:hibernatesnapshot (local or pulled from epoch) and clones from it, rather than fromspec.Image.wake()'s restore core into sharedcloneFromHibernate+dispatchHibernateRestore— so the cross-node path reuses the exact same logic, including the CH+Windows 0-NIC--nics 1hot-add and the "wait for the fresh NIC's DHCP lease, no PnP recycle" post-step.wake()refactored to call them (behavior-preserving).Dependency
Depends on cocoonstack/cocoon-common#3 (the
restore-from-hibernateannotation). go.mod currently pins the branch commit via pseudo-version; bump to the cocoon-common release tag after #3 merges.Tests
restore_test.go(Windows hot-adds NIC / Linux inherits); full suite +make lintclean on linux + darwin.