Repository navigation
host: make the network and the cold boot part of a VM's configuration - #1270
Conversation
This pull request changes existing testsIt modifies or removes 1 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests. Test code
Relocated unchanged: 0; added: 3. Compared the merge base |
There was a problem hiding this comment.
🟢 Approval recommended
The network and cold-boot configuration changes have no active review issues.
No open issues 🎉
What changed in this PR
Extends the unified VM configuration introduced in #1269 with network and cold-boot settings, completing SL2.3b of #1097.
Changes:
- Adds
Ipv4Cidr, a validated guest IPv4 address with parsing, display, and optional serde support. - Adds network and boot configuration types and fields, while preserving the existing launch path for
DEFAULT_GUEST_NETWORK. - Adds tests and updates documentation and both platform API snapshots.
| File | Description |
|---|---|
nvx-rs/src/net/tests.rs |
Tests guest address validation, round trips, and serialization. |
nvx-rs/src/net/mod.rs |
Adds Ipv4Cidr and uses it in guest network helpers. |
nvx-rs/src/host/mod.rs |
Documents network and cold-boot configuration. |
nvx-rs/src/host/launch.rs |
Re-exports the relocated default guest address. |
nvx-rs/src/host/config/tests.rs |
Covers optional network addresses and boot settings. |
nvx-rs/src/host/config/mod.rs |
Adds network, NIC, and boot types to VM configuration. |
nvx-rs/README.md |
Describes the new types and validation boundaries. |
nvx-rs/public-api/windows.txt |
Records the new public API for Windows. |
nvx-rs/public-api/linux.txt |
Records the new public API for Linux. |
nvx-rs/Cargo.toml |
Updates the serde feature comment to include Ipv4Cidr. |
Review effort: Balanced
|
Scope update following the revised #1076/#1097 contract: the stack must no longer include the retired per-domain-error PR #1267. Keep SL2.3b's checked IPv4 address, optional guest address, network configuration and cold-only boot settings. Rebase this logical slice with the adapted #1268/#1269 stack, using the crate's existing error surface rather than adding domain-error families. No new validation framework, lowering algorithm or contract-version change is requested. Preserve the original tests and evidence; changed inputs and error expectations require affected qualification before current-design readiness. No Ready transition or manual CI dispatch is included. |
348d276 to
a625878
Compare
a625878 to
885be7b
Compare
9bc10d2 to
b6cd20c
Compare
|
Updated in b6cd20c on the revised The original assertions are preserved, and the changed fixture is |
885be7b to
49d74dd
Compare
b6cd20c to
cf70f88
Compare
49d74dd to
3bd7e0d
Compare
cf70f88 to
12717eb
Compare
Add net::Ipv4Cidr, a static guest address checked when it is built: an IPv4 address with a /1 to /30 prefix that is not its network's own, broadcast, or gateway address, as OpenVMM accepts it. It displays and parses as ADDRESS/PREFIX, and with the serde feature it serializes as that text. is_valid_guest_network and guest_gateway read addresses through it, with the same rules. VmConfig gains its network, a NetworkConfig of the policy that OpenVMM enforces and the NIC's address, which a cold boot without one takes from DEFAULT_GUEST_NETWORK, and a restore from the snapshot; and its boot, a Boot of the caller's own kernel command-line tokens, which only a cold boot takes. NicConfig names the NIC that a VM settled on. DEFAULT_GUEST_NETWORK moves here from host::launch, which re-exports it. VmConfig::check adds no refusal: the policy and the tokens are checked where they are lowered. The configuration tests' fixture gains the two fields. The public API snapshots list the new items. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ab593c71-7f27-4207-8ff3-829d9a283b4c
12717eb to
d9cf939
Compare
8ed1f53
into
feature/nvx-refactor
Part of #1097. Stacked on #1269.
What and why
SL2.3b adds the network and cold-boot settings to the caller-owned VM
configuration:
net::Ipv4Cidrchecks a static IPv4 guest address, with a/1through/30prefix, excluding the network, broadcast and gateway addresses.Construction, parsing, display and string serde share the existing
address rules;
is_valid_guest_networkandguest_gatewaykeep theirbehavior.
VmConfiggains optionalnetworkandbootfields.NetworkConfigholds the existing policy and an optional checkedaddress;
NicConfigrecords the settled address. An omitted addressremains unset: a cold boot uses the default and a restore the snapshot.
Bootholds the caller's cold-only command line.DEFAULT_GUEST_NETWORKmoves intohost::config, with the existinghost::launchpath preserved by a re-export.VmConfig::checkadds no refusals. Boot-versus-restore presence,command-line rendering and network-policy lowering remain with their
consuming APIs.
The stack uses the crate's existing
Error/Result/ErrorKindsurface;the retired per-domain-error commit is not an ancestor. This change adds
no error family, crate, protocol version, builder or validation framework.
The existing network primitives retain their string errors.
Both public-API snapshots add the same 15 named items and remove none:
Ipv4Cidrand its four methods;Boot,NetworkConfig,NicConfigandtheir fields; the configuration's default-address constant; and
VmConfig::networkandVmConfig::boot. README and crate/module featuredocumentation describe the new values and their validation boundaries.
Tests and size
tests-modified: the existinghost::config::tests::blocklessfixtureadds
network: Noneandboot: Nonefor the new fields. No existing testassertion is removed or relaxed. The existing guest-network, gateway,
hostname and VM-configuration tests are kept.
Three tests are added:
guest_addresses_keep_their_address_and_prefix_through_every_form,guest_addresses_refuse_what_openvmm_refuses, andconfigurations_pass_with_or_without_a_nic_address_and_a_boot. They coverconstruction/parsing/string-serde round trips and refusals, omitted and
explicit addresses, both root forms, and configurations with or without
boot settings.
Measured against the immediate parent: 90 core lines in 3 counted
files, within the estimate of 220 lines in 3 files.
Validation
All commands below passed in complete runs at source
b6cd20c3aa1848ecc9b4db59d1494907ae100d69, on parent885be7ba1896f5dacb5f2fc7fbf53ecb15f7a847, which contains the pinnedqualification baseline
256ebe3d.check-nvx-rson Windows and Linux: formatting, all warning-deniedfeature builds, full tests and documentation, the real bundling fixture,
MSRV, both public-API snapshots, macOS cross-check, static musl guest
tooling and all runtime-adapter configurations. OpenVMM vector and CPU
profile comparisons passed too.
check-quality, including native ShellCheck/shfmt, both Pythonplatform type checks, links, test layout, kernel configuration, Specula
and the PowerShell syntax command.
validate-nvxunittest command: 1,810 cases on each OS,with 67 expected skips on Windows and 35 on Linux. Windows used native
CPython 3.14.9 and Git's POSIX shell; the canceled-capture shell check ran.
Linux ran the whole unittest command under its original UID in private
PID/mount namespaces, with Bash as PID1. The complete adversarial module
ran 84 cases on each OS and passed (11 expected Windows skips), the host
resolver passed four, and every help check passed.
sandbox scenarios; six Ubuntu scenarios; and all 156 canonical adapter
scenarios across 11 targets. Alpine/Ubuntu initramfses and the Ubuntu
layer were rebuilt natively from this source's validated guest binaries.
Reused kernel/OpenVMM/scratch inputs were hash-verified before and after;
no released guest image or CLI stood in for the changed source.
An initial Windows adversarial run missed a fixture PID file within its
unchanged one-second startup deadline. The complete 84-case native-Python
replay passed; no test, assertion or timeout was changed. That full replay,
not a focused diagnostic, supplies the command's result.
KVM execution and native macOS execution were unavailable locally. This
mid-group qualification does not claim the group-final Azure Linux matrix.