Repository navigation
tests: check the runtime adapter's staged images and hand OpenVMM the checked files - #867
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-platform file inheritance and teardown lifetimes warrant human review while KVM and full NVX CI validation remain pending.
No open issues 🎉
What changed in this PR
Implements the checked image handoff for the runtime adapter, building on staging in #863 toward the end-to-end sandbox work in #822.
Changes:
- Checks staged image and scratch bindings before launch, rejecting missing or stale bindings before spawning OpenVMM.
- Passes checked files through
PreparedLaunch, retaining them until root readiness or failed-launch teardown. - Updates host-only and VM tests for staging, checked arguments, scratch claims, and pre-spawn refusals.
| File | Description |
|---|---|
| tests/runtime-adapter/tests/vm_restart.rs | Stages layered image fixtures before restart scenarios. |
| tests/runtime-adapter/tests/vm_layered.rs | Stages each scenario and tests pre-spawn refusals and recovery. |
| tests/runtime-adapter/tests/layered_launch.rs | Tests checked arguments, inherited handles, binding refusals, and scratch claims. |
| tests/runtime-adapter/tests/common/mod.rs | Shares fixtures and adds diagnostic and unlaunched-state helpers. |
| tests/runtime-adapter/src/lib.rs | Updates module documentation for checked image handoff. |
| tests/runtime-adapter/src/layered.rs | Adds binding checks and renders arguments from PreparedLaunch. |
| tests/runtime-adapter/src/bin/runtime-adapter-host.rs | Integrates preparation, handle inheritance, resource lifetimes, and staging diagnostics. |
| tests/runtime-adapter/README.md | Documents the handoff contract and expanded test scenarios. |
Review effort: Balanced
3ab87dd to
2d3497a
Compare
2d3497a to
2168525
Compare
… checked files A layered launch of runtime-adapter-host now checks the bindings that the sandbox's store stages for its image and scratch image before it spawns anything, with DistroBinding::check and ScratchBinding::check, which read no content and claim the scratch image for the sandbox. A binding that the store does not stage, or that no longer holds, fails the launch before it begins. LayeredLaunch::prepare returns NVX's PreparedLaunch of the checked files. OpenVMM's arguments name those files rather than their paths, and the VmmCommand inherits what PreparedLaunch::inherited names. The launch holds the checked files until the guest has assembled the root, or until it has torn down a launch that failed. Every scenario of vm_layered.rs and vm_restart.rs now stages its images, then launches them, and three scenarios check that unstaged images, an image changed in place, and a replaced scratch image are refused before spawn. The restart scenarios boot NVX's Ubuntu EROFS image over a copy of the scratch template, whose fixtures move to tests/common. Part of #822. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 95934b67-b8c3-419d-ab53-05fe1b79af13
5476878 to
eb02d28
Compare
|
Rebased and force-pushed as Validation for the review's cross-platform handoff/teardown concern is now complete: exact-head CI is green, with 25 layered and 2 restart VM tests passing on each of KVM, MSHV, and WHP. Host tests also pass for the exact inherited-file allowlist, binding refusals, and scratch claim lifetime. There are no unresolved review threads. The remaining merge requirement is the repository's team approval, not a failing or pending CI check. The PR description now records the current validation instead of the old stacked-PR pending status. |
Rebased onto
devafter #863 merged. This PR now contains only the checked-handoff commit and preserves the separatestagedmodule and launch record format 1.Part of #822: PR 2 of 11, the checked handoff.
What changed
runtime-adapter-host launchchecks the bindings that the sandbox's store stages for its image and scratch image before it spawns anything.LayeredLaunch::preparerunsDistroBinding::check, underDISTRO_POLICY_REVISION, andScratchBinding::check, which claims the scratch image for the sandbox and waitsCLAIM_RELEASE_WAITfor a claim that should be free. Neither reads the images.Unavailableerrors. A claimed scratch image (TimedOut,ScratchClaimed) and host failures keep NVX's message.preparereturns NVX'sPreparedLaunchof the checked files.LayeredLaunch::openvmm_argumentstakes it, and renders its arguments and kernel command line, which name the checked files:/proc/self/fd/Non Linux, and their final paths on Windows. TheVmmCommandinheritsPreparedLaunch::inherited()and nothing else. As in NVX's own sandbox start, the checks run beforesupervisor::launch.RootReady, or until a failed launch is torn down: the prepared launch is declared before theStarting, which drops first.nullover RAM.vm_layered.rsandvm_restart.rsnow stages, then launches. The restart scenarios boot NVX's Ubuntu EROFS image over a copy of the scratch template, and the fixtures move totests/common.vm_layered.rscheck that unstaged images, a GPT disk changed in place after staging, and a replaced scratch image are each refused before spawn, with nothing of a launch left in the store. They also check that the same sandbox launches once its images are staged again.layered_launch.rschecks:API changes for stacked work
LayeredLaunch::prepare(&self) -> nvx::Result<PreparedLaunch>is new.LayeredLaunch::openvmm_arguments(&self, prepared: &PreparedLaunch, hypervisor, kernel, initramfs, endpoint, report) -> Vec<OsString>now takes the prepared launch, and no longer fails.tests/commongainsFixtures(moved fromvm_layered.rs),SCRATCH_TEMPLATE,Sandbox::stderrandSandbox::assert_unlaunched.Validation
Rebased head:
eb02d28ec4a792c22f0b28109077109fbffd440c, a single checked-handoff commit onorigin/devat56c530e491438becc35124b346f2a070ed580868(the latestdevverified immediately before the force-push). The already-merged #863 parent is no longer in this PR, and all conflict fixes are folded into the checked-handoff commit. The upstreamstagedmodule split and launch record format 1 are preserved.vm_layered25/25 andvm_restart2/2 on each backend. These include the pre-spawn binding refusals and successful restaging, layered launch teardown, and orchestrator restart scenarios.-D warnings, builds and tests of protocol-only and host-only configurations; Rust 1.89 all-target checks of both; Markdown links; and whitespace checks. The focused launch/staging test run passed 11/11 tests.An additional, non-CI strict rustdoc check (
cargo doc --features hostwithRUSTDOCFLAGS=-D warnings) finds three pre-existing links to the guest-onlyRunnerin the untouchedsrc/exec.rs. No unrelated documentation changes were folded into this PR; the authoritative CI gates above are green.