Repository navigation
host: keep vm and the CLI's sandbox lifecycle off the old store (SL6.0e) - #1519
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoNov 12, 2026
Conversation
Contributor
This pull request changes existing testsIt modifies or removes 5 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: 0. Compared the merge base |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the VM and CLI lifecycle decoupling changes.
No open issues 🎉
What changed in this PR
This PR detaches retained VM and CLI sandbox lifecycle code from legacy modules scheduled for removal in SL6.1. It supports the NVX library-slimming workstream while preserving the existing public API.
Changes:
- Moves capability generation into
host::vm, retaining the public instance helper as a forwarding wrapper. - Gives the CLI its own
StopOutcomeand usesStateDir::createfor sandbox state-directory creation. - Updates lifecycle and restore tests to stop depending on the legacy helpers and types.
| File | Description |
|---|---|
nvx-rs/tests/managed_lifecycle.rs |
Generates the test capability directly with getrandom. |
nvx-rs/src/host/vm.rs |
Owns crate-private capability generation and uses it during VM creation. |
nvx-rs/src/host/restore/tests/live_init.rs |
Generates the restore test capability without the instance helper. |
nvx-rs/src/host/instance/mod.rs |
Preserves the public capability helper by forwarding to host::vm. |
nvx-rs/src/host/cli/sandbox/lifecycle/tests.rs |
Imports the CLI-owned stop outcome type. |
nvx-rs/src/host/cli/sandbox/lifecycle/stop.rs |
Defines the CLI’s stop outcome enum locally. |
nvx-rs/src/host/cli/sandbox/lifecycle/directory.rs |
Creates state directories through the CLI’s StateDir. |
Review effort: Balanced
This was referenced Nov 12, 2026
Code that stays reaches the sandbox store, the instance layer and the store-coupled supervisor, which SL6.1 deletes: host::vm::create draws each launch's capability with host::instance::generate_capability, the CLI's stop of a sandbox reports its outcome as the supervisor's StopOutcome, and the CLI's provision creates the state directory with the sandbox store's SandboxStore::create. generate_capability moves to host::vm, crate-private, where create calls it; host::instance's public generate_capability calls it until SL6.1 deletes the instance. The CLI's stop takes a StopOutcome of its own, with the same three outcomes. create_state_directory creates the directory with the CLI's own StateDir::create, which provision's lock already uses: both create it private to the current user through platform::create_store_dir, refuse one that is not, and fail with the same codes and messages. SandboxStore::create's resolution of a relative path changed nothing there, since provision hands it the state directory that it already resolved. The managed-lifecycle test and the live restore test draw their own random capability, and the stop tests take the CLI's StopOutcome. Nothing else changes. Part of #1120 (SL6.0e). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna)
force-pushed
the
agents/slim-sl6-0e-store-identities
branch
from
November 12, 2026 07:42
f61ee3c to
f319bd0
Compare
Pedro Henrique Penna (ppenna)
marked this pull request as ready for review
November 12, 2026 07:42
Pedro Henrique Penna (ppenna)
merged commit Nov 12, 2026
a732c10
into
feature/nvx-refactor
86 of 87 checks passed
Pedro Henrique Penna (ppenna)
deleted the
agents/slim-sl6-0e-store-identities
branch
November 12, 2026 07:54
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 #1120 (SL6.0e:
host::vmand the CLI's sandbox lifecycle stop using the instance, the sandbox store and the supervisor). Parent #1087, umbrella #1076.What and why
SL6.1 (#1121) deletes
host::instance, the sandbox storehost::store, and the supervisor's store-coupled launch, wait and stop. SL6.1's analysis found three more uses of them by code that stays, beyond the file helpers that SL6.0d (#1518) moves:host::vm::createdraws each launch's capability withhost::instance::generate_capability;StopOutcome;provisioncreates the state directory withSandboxStore::create.This kept-code PR for #1120 moves these uses to owners that stay. Behavior doesn't change. The change is one commit,
host: keep vm and the CLI's sandbox lifecycle off the old store:generate_capabilitymoves tohost::vm, crate-private, afterCapability'sDebug.vm::createcalls it.host::instance's publicgenerate_capabilitycalls it until SL6.1 deletes the instance, so the public API doesn't change. The function is unchanged: it draws until the capability isn't all zero, and fails with the same message.StopOutcomeof its own:pub(super) enum StopOutcome { Graceful, Forced, TimedOut }inhost/cli/sandbox/lifecycle/stop.rs. These are the three outcomes that the CLI matched on, with the same meanings, and its tests import it fromsuper::stop.create_state_directorycreates the directory with the CLI's ownStateDir::create, whichprovision's lock already uses. Both create the directory private to the current user throughplatform::create_store_dir, refuse one that isn't, and fail with the same codes and messages.SandboxStore::createalso resolved a relative path, which changed nothing here:provisionhands it the state directory that it already resolved, an absolute path.StateDir::createreturns the CLI's own error, soerror_with_cause's conversion goes.tests/managed_lifecycle.rs) and the live restore test (host/restore/tests/live_init.rs). Each fills[0; CAPABILITY_LEN]withgetrandom::fill. They usedinstance::generate_capability, which leaves, andvm's is crate-private.As the orchestrator decided for Pedro Henrique Penna (@ppenna),
generate_capabilitybecomes crate-private inhost::vmrather than public, since onlyvm::createand the tests need it, and the tests draw their own.Size
Measured against
a4f04f63:vm.rs, the moved function and its call; 6 instop.rs, the enum; 2 indirectory.rs; and 1 ininstance/mod.rs, which now callsvm's.host/vm.rs,host/cli/sandbox/lifecycle/directory.rs,host/cli/sandbox/lifecycle/stop.rsandhost/instance/mod.rs.BOOT_CONTRACT_VERSIONandCONTROL_CONTRACT_REVISIONdon't change, and the public API doesn't change (python scripts/public_api.pypasses unchanged).Not in this PR
Deleting
host::instance,host::storeor the supervision (SL6.1); the store's file helpers (SL6.0d, #1518); any change to the CLI's lifecycle beyond the type and the call above.Validation
Rebased on
a4f04f63, after #1518 and the PRs of SL6.1's former temporary base, asf319bd0b. The rebase applied without conflicts. Against the head before it, the only difference is a line of context: the live restore test importsSnapshotManifestsince #1513. The commit is identical to SL6.1's stacked copy,f4a29f2ein #1520, which passed the Linux gates and the microVM scenarios in #1520's validation. Onf319bd0b,cargo fmt --all --checkand Clippy-D warningswith--all-targets --all-features,--liband--lib --bins --features cli, and for--target x86_64-unknown-linux-gnuwith--all-targets --all-features, passed on Windows. So did the 114 unit tests ofhost::vm,host::cli::sandboxandhost::restorewith--all-features, and the 15 lifecycle tests oftests/cli.rs.The table and the scenarios below ran on
f61ee3cc, the head before the rebase, with Rust 1.95.0 andNVX_BUNDLE=skip. The checks ran locally on Windows, and in temporary worktrees on nvx-mshv-test (Azure Linux 3, kernel 6.18, linux-mshv, virtual machine) and nvx-kvm-test (Azure Linux 3, kernel 6.6, linux-kvm, virtual machine). The gates are those thatlocal_gates.py --filesselects for the change, run from this branch's actions:cargo fmt --all --check-D warnings:--all-targets --all-features,--lib,--lib --no-default-features,--lib --no-default-features --features serde,--lib --bins --features cli,--lib --bins --no-default-features --features testing-D warningsfor--target x86_64-unknown-linux-gnu:--all-targets --all-features,--lib,--all-targets,--lib --bins --features cli,--lib --no-default-features --features guestcargo check --locked --all-targets --all-features --target aarch64-apple-darwincargo test --locked --all-featurescargo test --lockedcargo build --locked --lib --no-default-features,cargo test --locked --lib --no-default-featuresRUSTDOCFLAGS=-D warnings cargo doc --locked --no-deps --all-featurescargo +1.89 check --locked --all-targets --all-features(MSRV)python scripts/public_api.py(both snapshots)python scripts/check_test_layout.py,python scripts/check_markdown_links.pycheck_matrix.py)MicroVM scenarios, with the static musl
nvx-rsthat CI runs, CI run 43149037772's guest artifacts (5b3fab2c, the same guest inputs) and that run's OpenVMM builds of the pin (14dc4116), with their provenance, on WHP its Windows build,7abd8c8d, on Windows 11. The public set provisions, starts and stops sandboxes, so it runs the CLI's state directory and stop:managed-exec-config,sandbox-lifecycle,sandbox-proxy-only,sandbox-ram-upper,sandbox-gpt-layer,vm-lifecycle,snapshot-coreandsnapshot-tiersmanaged-lifecycle, which runs the changedtests/managed_lifecycle.rsLeft to CI: the bundled-artifact check, the guest binaries and the default suites. The CLI's Windows lifecycle tests, which create state directories with Windows' access control, passed locally in
cargo test --all-features.A code-review agent reviewed the whole diff and found no issues. It checked that the state directory is created as before on each platform, and that the CLI's
StopOutcomekeeps the outcomes and meanings that the CLI matched on.Changes to existing tests (
tests-modified)python scripts/check_test_changes.py --base origin/feature/nvx-refactorreports 5 changes to existing tests. Each replaces what used an item that leaves, and checks the same things as before:managed_lifecycle::a_managed_guest_runs_request_scoped_workloads_until_it_stops, and the imports oftests/managed_lifecycle.rs: the test draws its VM's capability withgetrandom::fillinto[0; CAPABILITY_LEN]instead ofnvx::host::instance::generate_capability, which leaves.host::restore::tests::live_init's helperrun, and its imports: the same, in place ofcrate::host::instance::generate_capability.host::cli::sandbox::lifecycle::tests:StopOutcomecomes fromsuper::stop, the CLI's own, instead ofcrate::host::supervisor.No changed test is named in the case matrix.