Skip to content

fix(cloudhypervisor): a Windows clone or restore resumes from the snapshot's clock - #341

Draft
zili-simular wants to merge 1 commit into
cocoonstack:masterfrom
zili-simular:windows-restore-keep-clock
Draft

zili-simular wants to merge 1 commit into
cocoonstack:masterfrom
zili-simular:windows-restore-keep-clock

Conversation

@zili-simular

@zili-simular zili-simular commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary

A Windows guest restored from a snapshot that is 24.9 to 49.7 days old can resume with its TCP retransmission timers stopped, because the restore moves its uptime forward by the snapshot's age (cocoonstack/cloud-hypervisor#9). This sends clock_catchup=false for Windows guests, the option added in cocoonstack/cloud-hypervisor#10.

 cocoon vm clone / cocoon vm restore
   launch CH
-  vm.restore {source_url, memory_restore_mode}
+  vm.restore {source_url, memory_restore_mode, clock_catchup: false}   # Windows guest
+  vm.restore {source_url, memory_restore_mode}                         # Linux guest, and any migration receive
   hot-swap NICs, add disks
   vm.resume
  • A Cloud Hypervisor without the option ignores the field and catches up as today, so the two changes can land in either order.
  • vm migrate receive keeps the catch-up: the gap is the seconds of the handoff, and catching up keeps the guest's date right.

Evidence

One Windows 10 base snapshot, 28 days old, cloned with --restore-mode copy on an AMD EPYC 7443P host. The probe counts the SYNs the guest sends to a blackholed address in 5.5 s; a healthy Windows guest sends three.

  • Before (cocoon v0.7.1, Cloud Hypervisor from cloud-hypervisor#10): guest uptime 28.02 days, 1 SYN.
    After (this change, same Cloud Hypervisor): guest uptime 162 s, the date is the snapshot's, 3 SYNs at 0 s, 1 s and 3 s. 4 of 4 clones, two on each of two builds of that branch. After Set-Date in the guest the date is correct and the probe still sees 3 SYNs.
  • This change with Cloud Hypervisor 2ca4cb08, which does not know the field: the clone succeeds, uptime 28.02 days, 1 SYN. The field is ignored.
  • TestRestoreAndResumeCloneKeepsAWindowsGuestClock checks the vm.restore body for a Linux clone, a Windows clone and a Windows migration receive. make fmt-check lint and go vet for linux and darwin are clean, and go test -race ./hypervisor/... passes.

The clones above ran this change applied to v0.7.1, the version on our hosts, not to master. Not run: cocoon vm restore on a real guest, and the full test suite.

Merge Danger

Door: two-way

Blast Radius: Windows guests

Every Windows clone and restore then resumes with the snapshot's date, until something in the guest sets it. Our control plane sets the date over SSH after every clone and wake, so this is what we want. A deployment that relies on the restore for the date gets a guest that is days behind, and TLS fails there.

Open question for review: should this be opt-in (a flag on vm clone and vm restore), or should cocoon set the date through cocoon-agent before it re-attaches the NICs?

…pshot's clock

Cloud Hypervisor advances the guest clock by the snapshot's age on
restore, which moves a Windows guest's uptime forward by the same
amount. When that jump is 2^31 to 2^32 ms (24.9 to 49.7 days), the
guest can resume with its TCP retransmission timers stopped
(cocoonstack/cloud-hypervisor#9).

Send clock_catchup=false with vm.restore for a Windows clone and
restore. The guest's date is then behind by the snapshot's age until
something sets it in the guest. A migration receive still catches up,
and a Cloud Hypervisor without the option ignores the field.

This branch has not been deployed

No deployments
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