Repository navigation
tests: put a launch's network policy on the runtime adapter's plan - #866
Open
Enrique Saurez (esaurez) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped integration reuses existing NVX contracts, includes targeted host-only coverage, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
Adds optional network policies to layered launches in the test runtime adapter, advancing #822 by reusing NVX’s existing plan validation, rendering, and persistence.
Changes:
- Adds
launch --network FILE, validating the network before accessing artifacts or creating the store. - Attaches the network to the adapter’s plan and preserves it in launch records.
- Adds host-only coverage for policy rendering, rejected inputs, and command-line constraints, with corresponding documentation.
| File | Description |
|---|---|
| tests/runtime-adapter/tests/layered_launch.rs | Tests network rendering, records, validation, and CLI restrictions. |
| tests/runtime-adapter/src/lib.rs | Documents network support in layered plans. |
| tests/runtime-adapter/src/layered.rs | Adds the network reader and documents plan integration. |
| tests/runtime-adapter/src/bin/runtime-adapter-host.rs | Parses, validates, and attaches launch networks. |
| tests/runtime-adapter/README.md | Documents network configuration, commands, and tests. |
Review effort: Balanced
The runtime adapter's layered launches had no network. `launch --network FILE` now reads a network in the serde form of a plan's network, which the plan checks as it reads it, and puts it on the adapter's plan, which renders it through NVX's lowering of a policy, after its block devices. The launch's record keeps it in the plan. A launch reads its network before anything else, so it refuses one that the plan refuses before it needs NVX's artifacts or creates the store. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a7c15634-094a-4a66-af59-25a58e732f4b
Enrique Saurez (esaurez)
changed the base branch from
esaurez/822-pr01-staging-adapter-plan-20261023
to
esaurez/805-pr3-host-exec-vms-20261023
October 24, 2026 20:29
Enrique Saurez (esaurez)
force-pushed
the
esaurez/822-pr09-network-policy-plan-20261023
branch
from
October 24, 2026 20:29
fc18bd5 to
da7de80
Compare
This was referenced Oct 24, 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.
Stacked on #870; this PR retargets when its parent merges.
Chain: #863 → #867 → #869 → #865 → #864 → #872 → #875 → #878 → #862 → #868 → #870 → #866 (this PR) → #882 → #883.
Part of #822: PR 9 of 11, the policy on the plan.
What changed
runtime-adapter-host launch --network FILEgives a layered launch a network. FILE holds annvx::host::sandbox::SandboxNetworkin the serde form of a plan's network, which the newruntime_adapter::layered::read_networkreads. Reading the form checks the network as the plan does (SandboxNetwork::new): the guest's address must leave a gateway, and the policy must lower to OpenVMM's arguments.SandboxPlan::with_network), which renders it after the block devices through NVX's one lowering of a policy,nvx::host::network::openvmm_arguments. A policy that lets nothing through attaches no network device. The network adds no boot token of the plan's: OpenVMM appends the guest's network settings to the kernel command line, and NVX's/initconfigures the network device from them before it hands the VM to the guest agent.--networkneeds--distro, and onlylaunchtakes it.Tests
In
tests/layered_launch.rs, host-only, with no hypervisor:a_launch_renders_each_element_of_its_network_through_the_plan: an open network, then each element of a policy changed in turn (the guest's address, egress, allow and deny rules, ingress, the three host-loopback accesses, forwards, and a proxy with each scheme), with the OpenVMM arguments that the plan renders between the block devices, which name the checked files of a launch prepared for each case, and the launch's own options, the proxy's URL, the unchanged kernel command line, and the record, which keeps the network as the file gave it and reads back as the same plan.a_launch_reads_only_the_networks_that_the_plan_takes: an unreadable file, forms that the plan does not read, and networks that it refuses, each with the plan's reason.the_host_program_refuses_a_network_before_it_launches: a refused and an unreadable network fail the launch with status 1, before it needs NVX's artifacts or creates the store, and a network that the plan takes passes.the_host_program_refuses_options_that_do_not_make_a_command:--networkwithout--distro, twice, without a value, and onstageandstop.Validation
tests/runtime-adapter:cargo fmt --all --check; the protocol-only and host-only configurations'cargo clippy --locked --all-targets [--features host] -- -D warnings,cargo build --locked,cargo test --locked, andcargo +1.89 check --locked --all-targets.tests/runtime-adapter: the same, plus the guest-only configuration (--features guest --target x86_64-unknown-linux-musl): clippy, build, tests, and the MSRV check; the guest-only library andguest_sessiontests as root; and a stress run ofguest_session, 10 times as root and 10 times as a user, and of the library's tests, 3 times as root.python scripts/check_markdown_links.py.dev; a stacked PR runs no NVX CI. This PR changes no VM scenario: the network's enforcement in VMs is runtime adapter: run cold sandboxes end to end on KVM, MSHV and WHP #822's PR 11, tests: enforce the runtime adapter's networks in VMs #883.