-
Notifications
You must be signed in to change notification settings - Fork 24
Add Windows snapshots and forks #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sjmiller609
wants to merge
23
commits into
hypeship/windows-networking
from
hypeship/windows-snapshots
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e8a1bad
Add Windows snapshots and forks
sjmiller609 716aeb6
Document TPM identity for Windows memory forks
sjmiller609 cb78539
Isolate the Windows snapshots CI gates
sjmiller609 9fe5fdc
Consolidate Windows snapshot coverage
sjmiller609 7df3857
Protect Windows fork identity invariants
sjmiller609 4aa7063
Keep Windows copy coverage at lifecycle end
sjmiller609 87db7de
Use default Windows memory for lifecycle coverage
sjmiller609 a17d4f8
Run guest-control checks after snapshot lifecycle
sjmiller609 6120167
Keep Windows snapshot scenarios within gate budget
sjmiller609 22363a2
Preserve Windows memory-fork network identity
sjmiller609 511faae
Focus Windows lifecycle gate on snapshot invariants
sjmiller609 3dda4c8
Bound Windows memory-fork integration coverage
sjmiller609 967b06d
Compare inherited TPM state before memory restore
sjmiller609 838b70a
Inspect stopped-fork TPM reset before boot
sjmiller609 6d92d23
Rotate stopped-fork network identity
sjmiller609 f7ace34
Keep snapshot lifecycle gate off host networking
sjmiller609 0a1be72
Skip network leases in Windows snapshot gates
sjmiller609 3fc9a65
Clean Windows gate processes between attempts
sjmiller609 09ce3d1
Keep Windows test socket paths short
sjmiller609 97e8bad
Keep test bridge identity tied to subnet
sjmiller609 8080100
Preserve live test bridges during stale cleanup
sjmiller609 519bb45
Warm QEMU before the primitive gate
sjmiller609 5d22773
Track Windows scratch directories for job cleanup
sjmiller609 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if (( $# != 3 )); then | ||
| echo "usage: $0 <gate-env> <test-name> <package>" >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| gate_env=$1 | ||
| test_name=$2 | ||
| package=$3 | ||
| run_prefix="ci-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" | ||
| tmpdir=$(sudo mktemp -d /ci/wXXXXXX) | ||
| echo "WINDOWS_TEST_TMPDIR=$tmpdir" >> "$GITHUB_ENV" | ||
| test_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH" | ||
|
|
||
| cleanup() { | ||
| local pids=() | ||
| local pid | ||
| while read -r pid; do | ||
| if sudo grep -zFqx "HYPEMAN_UFFD_SYSTEMD_INSTANCE_PREFIX=$run_prefix" "/proc/$pid/environ" 2>/dev/null; then | ||
| pids+=("$pid") | ||
| fi | ||
| done < <(pgrep -x 'qemu-system-.*|swtpm' || true) | ||
|
|
||
| if (( ${#pids[@]} > 0 )); then | ||
| sudo kill -TERM "${pids[@]}" 2>/dev/null || true | ||
| sleep 2 | ||
| for pid in "${pids[@]}"; do | ||
| if sudo kill -0 "$pid" 2>/dev/null; then | ||
| sudo kill -KILL "$pid" 2>/dev/null || true | ||
| fi | ||
| done | ||
| fi | ||
| sudo rm -rf "$tmpdir" | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| for attempt in 1 2 3; do | ||
| cleanup | ||
| sudo install -d -m 1777 "$tmpdir" | ||
| if sudo env \ | ||
| "PATH=$test_path" \ | ||
| "TMPDIR=$tmpdir" \ | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| "CI=true" \ | ||
| "HYPEMAN_UFFD_SYSTEMD_INSTANCE_PREFIX=$run_prefix" \ | ||
| "$gate_env=1" \ | ||
| "HYPEMAN_WINDOWS_OVMF_CODE=$HYPEMAN_WINDOWS_OVMF_CODE" \ | ||
| "HYPEMAN_WINDOWS_OVMF_VARS=$HYPEMAN_WINDOWS_OVMF_VARS" \ | ||
| go test -count=1 -run "^${test_name}$" -timeout 2m "$package"; then | ||
| exit 0 | ||
| fi | ||
| cleanup | ||
| test "$attempt" = 3 || sleep 5 | ||
| done | ||
| exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Windows snapshots and forks | ||
|
|
||
| Windows 11 QEMU instances support standby, restore, stopped snapshots, and forks. Snapshot payloads treat the writable qcow2 disk, Secure Boot NVRAM, software TPM state, saved QEMU configuration, and memory image as one machine. | ||
|
|
||
| ## Same-instance standby and restore | ||
|
|
||
| Standby pauses QEMU, captures memory and device state, stops QEMU and swtpm, and retains the instance disk, NVRAM, and TPM directory. Restore starts swtpm from that same state before loading QEMU memory. The Windows machine identity and TPM remain unchanged. | ||
|
|
||
| ## Fork identity | ||
|
|
||
| A fork receives independent disk and NVRAM files. A stopped fork removes the copied TPM state before cold boot, so swtpm initializes a new endorsement key and TPM identity. A memory fork retains the parent's TPM identity because QEMU includes the TPM's permanent and volatile state in its migration stream. Workloads that depend on unique TPM attestation must use stopped forks. | ||
|
|
||
| The Windows guest agent writes a new `MachineGuid` and records the child instance ID before the child is returned. Memory forks retain the source SID and hostname, and services that cached `MachineGuid` before standby may observe the previous value until the next cold boot. | ||
|
|
||
| Fork admission requires the image OCI label: | ||
|
|
||
| ```text | ||
| io.hypeman.machine-image.bitlocker=disabled | ||
| ``` | ||
|
|
||
| Images marked `reseal-required`, unlabeled images, and unknown policies can still use same-instance snapshots, but cannot be forked. Hypeman does not expose a child whose encrypted disk was cloned without resealing it to the child's TPM. | ||
|
|
||
| Stopped forks cold-boot with a unique vsock CID and can run concurrently. A standby snapshot contains the Windows VioSock CID and NIC identity in guest memory, so a memory-restored child initially retains both. The source and child must not be restored concurrently until the child has been stopped and cold-started; Hypeman reports a state error instead of allowing a host-device collision. Creating a running fork directly from a running Windows source therefore requires `target_state=Stopped`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.