Repository navigation
nvx-rs: mount a clone's export and set its network settings - #960
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoOct 29, 2026
Merged
Conversation
This was referenced Oct 28, 2026
Closed
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the clone export-mount and network-setting changes.
No open issues 🎉
What changed in this PR
This PR adds export mounts and network settings to NVX’s clone activation, building on the root and workload-view work in #845. It prepares these settings before Ready while leaving host-side export planning and VM scenarios to #846, and listener publication to #850.
Changes:
- Mounts a clone’s export through the template’s filesystem device and hands its root to the adapter for mappings.
- Writes and binds a read-only DNS resolver file, exposes the proxy endpoint, and extends cleanup and activation failure statuses.
- Adds activation and adapter tests and updates documentation; cold-boot behavior remains unchanged.
| File | Description |
|---|---|
tests/runtime-adapter/tests/guest_session.rs |
Tests export mappings, network failures, and unchanged execution environments. |
tests/runtime-adapter/src/worker/capture.rs |
Includes the filesystem tag in clone root templates. |
tests/runtime-adapter/src/worker/activation.rs |
Maps export and network failures to statuses 56 and 57. |
tests/runtime-adapter/src/worker.rs |
Retains the activated export for host mappings. |
tests/runtime-adapter/README.md |
Documents activation settings, cleanup, statuses, and tests. |
nvx-rs/src/guest/clone/activation/apply/tests.rs |
Tests export mounting, resolver files and binds, failure handling, and cleanup. |
nvx-rs/src/guest/clone/activation/apply.rs |
Implements export and network activation and resource ownership. |
nvx-rs/src/guest/clone/activation.rs |
Re-exports the new API and updates adapter guidance. |
nvx-rs/src/guest/clone.rs |
Exposes and documents the expanded activation API. |
nvx-rs/README.md |
Updates the clone API overview. |
Review effort: Balanced
This was referenced Oct 28, 2026
Enrique Saurez (esaurez)
force-pushed
the
esaurez/845-pr2-workload-view-20261024
branch
from
October 29, 2026 03:37
f3ebadd to
d5c55de
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/845-pr3-export-network-20261025
branch
from
October 29, 2026 03:37
b1cc9a7 to
6987749
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/845-pr2-workload-view-20261024
branch
from
October 29, 2026 05:30
d5c55de to
e6dd0ac
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/845-pr3-export-network-20261025
branch
from
October 29, 2026 05:30
6987749 to
513e569
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/845-pr3-export-network-20261025
branch
from
October 29, 2026 06:22
513e569 to
2674fd2
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/845-pr2-workload-view-20261024
branch
from
October 29, 2026 06:22
e6dd0ac to
ff1efdf
Compare
This was referenced Oct 29, 2026
This was referenced Oct 29, 2026
Pedro Henrique Penna (ppenna)
force-pushed
the
esaurez/845-pr2-workload-view-20261024
branch
from
October 29, 2026 14:11
ff1efdf to
c5abb73
Compare
A clone's activation applied the record's root and workload view, but left its export and its network settings unapplied. It now applies both before Ready, as at a cold boot: - If the record has an export, nvx::guest::clone::apply mounts the host export with Root::mount_export, through the template's host filesystem device, which the new RootTemplate::filesystem_tag names, whatever the export's shape: at hostfs/root of the runtime directory, outside the root, where only the guest's root user reaches it. The record names no mode of the mount, so it is read-write: OpenVMM limits each of the export's children to its own access, and each mapping takes its own. Applied::take_export hands the adapter the export's SourceRoot, from which it maps the host's mapping table once the clone is ready, as after a cold boot. - If the record's network names a DNS server, apply writes a resolver file that names it, as protocol::cmdline::write_resolver writes one, to the new RESOLVER_FILE, resolv.conf, in the runtime directory: a new file of mode 0444, whatever the umask. Entry::resolver binds it read-only over the root's /etc/resolv.conf, in the same Entry::bind_runtime as a generated machine ID, and Applied::resolver returns it. - Applied::proxy returns the network's proxy endpoint. The runtime adapter's host tells its workloads, as after a cold boot: its exec adds the proxy's URL to each execution's environment, so the guest worker leaves each environment exactly its start's. Applied's teardown, and its drop, close the export's root, unless the adapter took it, and remove the binds before they tear the root down, which unmounts the export. A mount that fails is ApplyError::Export, and a resolver file that cannot be written or bound is ApplyError::Network, with the new NetworkError, once the export's root is closed and the root torn down. The runtime adapter maps them to their own statuses, 56, ACTIVATION_EXPORT, and 57, ACTIVATION_NETWORK, so that each class of a clone's activation has its status. Listener publication stays unapplied. The cold path is unchanged: it mounts no export of a record and binds no resolver file. The tests cover, without a VM, the export's mount through the template's device and its hand-off, the resolver file, its mode, its content and its bind with the machine ID's, the proxy's endpoint, each failure, its status and the teardown after it, and a clone that maps its record's table from its export. An ignored test checks the binds of both files against the kernel, as root. The VM scenarios come with the host's export and mapping table. Part of #845 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 80932e09-af82-4b79-b417-70a241303cda
Enrique Saurez (esaurez)
force-pushed
the
esaurez/845-pr3-export-network-20261025
branch
from
October 29, 2026 14:20
2674fd2 to
efe51b4
Compare
Base automatically changed from
esaurez/845-pr2-workload-view-20261024
to
dev
October 29, 2026 14:57
Pedro Henrique Penna (ppenna)
deleted the
esaurez/845-pr3-export-network-20261025
branch
October 29, 2026 18:15
This was referenced Oct 29, 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.
Part of #845 (PR 3 of 3: the export and network settings).
Stacked on #959: this PR targets its branch,
esaurez/845-pr2-workload-view-20261024, and is rebased and retargeted with it.Chain: #951 → #954 → #957 → #959 → this PR, on
dev; #879, #881, #885, #886, #877, #932, #884, #887, #933, #880, #936, #937, #939, #940, #941, #888, #949, and #950 have merged.What and why
A clone's activation applied the record's root and workload view, but left its export and its network settings unapplied. It now applies both before Ready, as at a cold boot:
nvx::guest::clone::applymounts the host export withRoot::mount_export, through the template's host filesystem device, which the newRootTemplate::filesystem_tagnames, whatever the export's shape: athostfs/rootof the runtime directory, outside the root, where only the guest's root user reaches it. The record names no mode of the mount, so it is read-write: OpenVMM limits each of the export's children to its own access, and each mapping takes its own. The documentation of that step states the rule that this relies on: OpenVMM resolves an export's path again at each launch and restore, so the directories above an export's directory must be ones that no guest may change, and whoever names an export must not name one inside a directory that a writable export of another sandbox or clone holds.Applied::take_exporthands the adapter the export'sSourceRoot, from which it maps the host's mapping table once the clone is ready, as after a cold boot.applywrites a resolver file that names it, asprotocol::cmdline::write_resolverwrites one, to the newRESOLVER_FILE,resolv.conf, in the runtime directory: a new file of mode 0444, whatever the umask.Entry::resolverbinds it read-only over the root's/etc/resolv.conf, in the sameEntry::bind_runtimeas a generated machine ID, andApplied::resolverreturns it.Applied::proxyreturns the network's proxy endpoint. The test adapter's host tells its workloads, as after a cold boot: its exec adds the proxy's URL to each execution's environment, so the guest worker leaves each environment exactly its start's.Applied's teardown, and its drop, close the export's root, unless the adapter took it, and remove the binds before they tear the root down, which unmounts the export. A mount that fails isApplyError::Export, and a resolver file that cannot be written or bound isApplyError::Network, with the newNetworkError, once the export's root is closed and the root torn down. The test adapter maps them to their own statuses, 56,ACTIVATION_EXPORT, and 57,ACTIVATION_NETWORK, so that each class of a clone's activation has its status. Listener publication stays unapplied. The cold path is unchanged: it mounts no export of a record and binds no resolver file.Not in this PR
Validation
At this PR's head efe51b4, the same commit as the earlier head 2674fd2, rebased onto #959's head c5abb73: its tree, 67454b3d, is the merge of 2674fd2 into
devat fbeb563, which holds #951, #954 and #957. CI at that head, in run 40890757646: 36 jobs passed, among them the microVM tests and the platform checks on KVM, MSHV and WHP, and OpenVMM's unit and VM tests; the six that run only for a pull request or ondevwere skipped. On Windows, on that tree: the library's fmt, its Clippy with-D warningsin each configuration that check-nvx-rs lints and for the musl target, and its documentation with-D warnings; the test adapter's fmt, and its Clippy and documentation with-D warningsin its protocol-only, host and musl guest configurations, as check-nvx-rs builds them, with itsclone_starttests; and validate-nvx's Windows checks, among them the scripts' unit tests. The rest of this section describes the validation at 2674fd2, on #954's head 21b9983.Each commit of this PR, on #954's head 21b9983, with OpenVMM at 832d5bb4, the pin of its base: fmt, Clippy with
-D warningsin every configuration of the library and of the test adapter, and the check thatnvx-rs/README.mdgives each module a short row and a section. At this PR's head:tests/host_modules.rs; the test adapter's protocol-only tests, and its host tests of the library, the binaries,host_sessionandclone_start.guest::cloneandguest::roottests; the test adapter's musl guest library tests andguest_session; and, as root, the ignored test that checks the partition-table reread against the kernel with a loop device, and, in a process of their own, the privileged tests ofguest::mappings.-D warnings, the MSRV checks of the library and of the test adapter's three configurations, and the Markdown links.At this PR's head, the top of the stack, with OpenVMM at 832d5bb4:
-D warningswith all features and on the library with and without default features; the tests with all features and with the default ones; the library without default features; the documentation with-D warnings; and the MSRV check, with the aarch64-apple-darwin check on Linux.guest::mappings, ofguest::clone::activation::apply, and of the partition-table reread with a loop device, each in a process of its own:guest::mappings' privileged tests can find a mount busy at their teardown when another test of the same process starts a child, as they do at runtime-adapter: start clones of templates #954's head.devwere skipped.vm_clone, 16 scenarios;vm_layered, 43;vm_restart, 3;vm_steps, 3; andvm_template, 9.