Repository navigation
tests: capture templates in VMs through the runtime adapter - #933
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoOct 28, 2026
Merged
Conversation
This was referenced Oct 27, 2026
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-platform VM capture and recovery need final human review and confirmation of the backend validation listed as pending.
No open issues 🎉
What changed in this PR
This PR connects the runtime adapter to NVX’s template capture and publication APIs, completing the adapter integration portion of #841.
Changes:
- Adds a host
createcommand and capture requests for serving existing templates or capturing new generations. - Adds VM capture scenarios, command-validation tests, and harness support for capture recovery and diagnostics.
- Reuses OpenVMM’s platform-token allowlist and strengthens command-line compatibility checks.
| File | Description |
|---|---|
| tests/runtime-adapter/tests/vm_template.rs | Adds VM capture, generation reuse, and network-policy scenarios. |
| tests/runtime-adapter/tests/template_capture.rs | Tests capture inputs and early command failures without a hypervisor. |
| tests/runtime-adapter/tests/layered_launch.rs | Tests rejected create options and arguments. |
| tests/runtime-adapter/tests/common/mod.rs | Adds template creation, capture diagnostics, and recovery cleanup. |
| tests/runtime-adapter/src/template.rs | Uses OpenVMM’s allowlist excerpts and tests UTF-8 handling. |
| tests/runtime-adapter/src/lib.rs | Exposes and documents the host-only capture module. |
| tests/runtime-adapter/src/capture.rs | Builds capture plans, classes, artifacts, and disk geometries. |
| tests/runtime-adapter/src/bin/runtime-adapter-host.rs | Implements create, its options, and temporary initramfs handling. |
| tests/runtime-adapter/README.md | Documents template creation, outputs, and test scenarios. |
| nvx-rs/tests/vectors/README.md | Documents the adapter’s use of OpenVMM excerpts. |
| nvx-rs/src/host/template/plan/tests.rs | Checks that template tokens contain only ASCII and no kernel whitespace. |
Review effort: Balanced
This was referenced Oct 27, 2026
Base automatically changed from
esaurez/841-pr2-capture-publication-20261024
to
dev
October 28, 2026 01:04
The runtime adapter's host program gets a create command. It stages the placeholder distro, makes a capture class of the adapter plan that the request names, and creates the template in an NVX template store, which serves a compatible generation of the class, or captures one through the supervisor in the adapter's template mode and publishes it. New VM tests capture templates on each backend, without a NIC and with one NIC per tested network policy, and check the published generation's key, payload, and slot. Policies that no template takes are refused before any VM starts. The guest agent's template mode checks its kernel command line with OpenVMM's platform allowlist, compiled from the excerpts that the template plan tests of nvx compile, in place of a mirror of it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 32eea669-a52c-4a53-87fa-521c498537e5
Enrique Saurez (esaurez)
force-pushed
the
esaurez/841-pr3-captures-in-vms-20261024
branch
from
October 28, 2026 01:20
8c127e4 to
e021475
Compare
Pedro Henrique Penna (ppenna)
deleted the
esaurez/841-pr3-captures-in-vms-20261024
branch
October 28, 2026 02:03
This was referenced Oct 28, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Chain: this PR → #880 → #936 → #937 → #939 → #940 → #941, on
dev; #879, #881, #885, #886, #877, #932, #884, and #887 have merged.The runtime adapter's host program gets a
createcommand, which serves a template of the guest agent from an NVX template store: a compatible generation that the store holds, or a new one that the store captures, in a VM of the adapter's template mode, through NVX's supervisor, and publishes. New VM tests capture templates on each backend, without a NIC and with one NIC per tested network policy, and check the generation that the store publishes.Part of #841: the third of its three pull requests.
What changed
runtime-adapter-host create STORE --guest-agent PATH --distro FORMAT:PATH --distro-identity UUID, intests/runtime-adapter/src/bin/runtime-adapter-host.rs, serves the template withnvx::host::template::Store::create_template(nvx-rs: capture templates into their store, and publish them #887), from a template store that it creates if needed. It stages the placeholderdistroasstagestages an image, and takes--hypervisor,--cpu-profile(autoby default),--processors(1),--memory(256 MiB),--memory-capacity(the RAM by default),--scratch-length(64 MiB), and--network, whichlaunchtakes too. It reads the network before anything else, checks the capture class before it creates the store, and printscreated(capturedorexisting),generation,key, andclass.runtime_adapter::capture(host-only):Request, what the options choose of a template, andRequest::capture, NVX'sCaptureof it:SandboxPlan::adapter), with the network, and the placeholder'sDistroBinding;CaptureClass: the runtime identity of the adapter's VMs with the guest agent's build, the backend and the CPU profile, the processors, all online at boot, the RAM and its capacity, the geometries of the placeholder and of the dormant scratch (capture::geometry), and the network.tests/runtime-adapter/src/template.rs:is_platform_tokenis now OpenVMM's own check,platform_command_line_token_is_invariant, compiled withinclude!from the excerpts of OpenVMM's sources that nvx-rs: lower adapter plans into the plans of template captures #884 keeps innvx-rs/tests/vectors/openvmm/, whichnvx-rs/tests/openvmm_vectors.rscompares with the OpenVMM submodule. It replaces tests: capture a template's VM in the runtime adapter's guest #932's hand-written copy of the allowlist (PLATFORM_TOKENSandPLATFORM_PREFIXES). The excerpt admitsmaxcpus=, as OpenVMM does at the pinned d2338ea2, whose excerpts are unchanged since e68871cc, and tests: capture a template's VM in the runtime adapter's guest #932's tests ofmaxcpus=stay. As in OpenVMM, a token that is not UTF-8 text is not on the allowlist.nvx-rs: the template plan's tests also check that no token of a template's kernel command line holds a byte outside ASCII or the kernel's whitespace, so that OpenVMM, which splits at ASCII whitespace, and the kernel find the same tokens.nvx-rs/tests/vectors/README.mdnotes that the adapter compiles the excerpts too.tests/vm_template.rs, ignored, since they boot VMs or need NVX's artifacts:tests/template_capture.rs, without a hypervisor: the capture's class and inputs from a request, and the creations that the host program refuses before it creates anything.tests/layered_launch.rs: the options thatcreaterefuses.tests/common: the harness creates templates, and the store's recovery ends the captures that a failed test interrupted.tests/runtime-adapter/README.md: the Templates section, thecreatecommand and the values that it prints, and the allowlist as OpenVMM's own check.Design notes
Store::create_templatelowers the adapter's plan into nvx-rs: lower adapter plans into the plans of template captures #884'sTemplatePlan, and launches the capture through the supervisor, as nvx-rs: capture templates into their store, and publish them #887 does for any caller.captures/C/transaction/control.sockin the store, beside the snapshot's destination, as OpenVMM requires, so NVX refuses a store whose path leaves no room for that socket's path.Validation
At this head, with the OpenVMM submodule at d2338ea2, which
devnow pins. The vectors and the template mode's allowlist tests pass with it, so the excerpts are OpenVMM's at d2338ea2 too.Rebase: this head moves the one commit from #887's head 0b23113 onto
dev's b855c4d, which holds #887, and resolves one conflict, intests/runtime-adapter/README.md, whose paragraph on running the VM tests keepstests/vm_template.rsand downloads the artifacts withnvx-rs download(#934). The previous head moved from a local integration of #887's 491de89 with #840 PR 2's 953eb0b onto #887's head 0b23113, which carries #932 beneath it. It keeps the base's sharing options inruntime-adapter-hostbesidecreate's--network, addscaptureto the base's host-only modules, takesStagedfrom the base'sstagedmodule, drops a visibility change tolayered::planthat the base already made, and replaces #932's hand-written allowlist with the excerpt, whosemaxcpus=its doc now lists.nvx-rs, withNVX_BUNDLE=skip:cargo fmt --all --check;cargo clippy --locked --all-targets --all-features -- -D warnings;cargo clippy --locked --lib -- -D warnings, also with--no-default-features;cargo clippy --locked --all-targets --no-default-features --features <feature> -- -D warningsforhost,cli,testing,serde, andbundled;cargo test --locked --all-features;cargo test --locked;cargo build --locked --lib --no-default-featuresandcargo test --locked --lib --no-default-features, also with--features host;RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps --all-features;cargo +1.89 check --locked --all-targets --all-features; andcargo test --locked --test host_modules. From the root, the ignoredcargo test --locked --manifest-path nvx-rs/Cargo.toml --no-default-features --test openvmm_vectors -- --ignored. Then the commands ofcheck-nvx-rsfortests/runtime-adapter, protocol-only and host-only, andpython scripts/check_markdown_links.py.--features guest,cargo check --locked --all-targets --all-features --target aarch64-apple-darwin,python3 scripts/nvx.py check-guest-binaries, and the runtime adapter's static musl guest configuration.cargo fmt --all --checkand Clippy with-D warningsofnvx-rs(--all-targets, and--libwith and without default features) and of the runtime adapter's configurations,cargo test --locked --test host_modules, and on Linux the macOS check.v0.1.0-dev.6464eb005bf6, whichnvx-rs downloadinstalled, whose OpenVMM is d2338ea2 and whose guest artifacts' inputs are this head's, and with the guest agent built from this head, all 58 ignored tests oftests/runtime-adapterpassed:vm_layered(43),vm_restart(3),vm_steps(3), andvm_template(9), on Windows/WHP and on Linux/MSHV. The Linux development host no longer needs an override of the CPU profile: OpenVMM's--cpu-profile autopresentsamd.genoa.v2there.vm_template's 9 among them. It skipped OpenVMM's unit and VMM tests, whose inputs this pull request leaves unchanged, the debug kernel's tests on MSHV and WHP, which pull requests run on KVM alone, and the jobs that package, publish, and persist ondev.