Skip to content

host: give a VM's machine, root, view and console one checked value - #1269

Merged
Pedro Henrique Penna (ppenna) merged 2 commits into
feature/nvx-refactorfrom
esaurez/slim-2.1.1-sl2.3a-20261103
Nov 6, 2026
Merged

Pedro Henrique Penna (ppenna) merged 2 commits into
feature/nvx-refactorfrom
esaurez/slim-2.1.1-sl2.3a-20261103

Conversation

@esaurez

@esaurez Enrique Saurez (esaurez) commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1097. Stacked on #1268.

What and why

SL2.3a gives a VM's machine, root, workload view, exports and boot console one
caller-owned value, nvx::host::config::VmConfig, checked without host I/O.

  • VmConfig holds processors, memory in MiB, a blockless or layered root,
    activation::View, an optional ExportPlan, and a listener or disconnected
    console attachment. The console device exists with either attachment.
  • LayeredRoot names its image and RootImage format, an optional GPT
    first-partition bound, overlay mode, and either a scratch upper with its
    journal policy or a RAM upper capped at 1 through 90 percent. The default
    cap is UpperConfig::DEFAULT_MAX_MEMORY_PERCENT, 50.
  • VmConfig::check returns the crate's Result. A refusal has kind
    ErrorKind::Unsupported and names its field; an export refusal retains
    ExportPlan::check's detailed error as its source.
  • View joins WorkloadView without changing activation records. The record
    and the new configuration reuse the same hostname predicate. The existing
    per-execution workload identity behavior is preserved.

No paths are opened, no host support is probed, and no launch arguments are
rendered. Network and cold-boot fields remain for SL2.3b.

Public API and size

Both API snapshots add the same 32 items for View and host::config;
none is removed. The README documents the new module and view.

120 core lines in 3 counted files against #1268 at 98bb4a43: 110 in
host/config/mod.rs, 9 in activation/mod.rs, and 1 in host/mod.rs.

Tests

No existing test is retired. Existing hostname coverage
hostnames_are_admitted_up_to_the_limit_without_a_nul and export coverage
reserved_targets_depend_on_the_root are kept unchanged.

The new configuration module adds four tests and their helpers:
blockless_and_layered_configurations_pass_with_either_console,
a_ram_upper_holds_1_to_90_percent_of_the_memory_and_half_by_default,
each_refusal_names_what_it_refuses, and
an_export_passes_the_check_of_the_targets_that_its_root_reserves.
The test-change inventory against the current stacked base reports 1 modified
helper and 12 added items. MicrovmTests._run_host_loopback_allow_script
reduces polling of immutable fixture inputs from 101 observations to two.
All 13 subcases, failure codes, assertions and the 10-second timeout remain;
the production script's 100 retries and 0.05-second sleep are unchanged.
The tests-modified label is present.

Validation

The exact head 885be7ba, directly on 98bb4a43 and dev 256ebe3d, passes:

  • Windows and Linux: the applicable check-nvx-rs steps, including feature
    isolation, MSRV, warning-denied lint/docs, real artifact-bundling staging,
    OpenVMM vectors/profiles and runtime-adapter configurations.
  • Linux: the macOS cross-check, both public API snapshots, musl guest lint,
    tests, build, static-ELF checks and guest-only adapter configuration.
  • Linux check-quality: Python lint/format and both platform type checks,
    pinned shell lint/format, Markdown links, test layout, kernel inventory,
    PowerShell syntax and all 25 Specula wiring tests. CI applies this action
    only to Linux; it is not counted as a Windows run.
  • Both complete validate-nvx unit commands: 1,810 tests each, with 67
    Windows and 30 Linux platform skips. The shell-dependent canceled-capture
    case executes on both. Both platforms also pass all 84 standalone
    adversarial tests, 4 host-profile tests, compileall and CLI help checks.
    Windows uses native CPython; the Linux unit command runs with a private
    process view.
  • WHP and MSHV: guest-boot, guest-identity, managed-exec-config,
    sandbox-lifecycle, sandbox-proxy-only and sandbox-ram-upper.
    The complete canonical runtime-adapter suite passes all 156 scenarios
    across 11 targets on each backend.
  • Independent read-only review of the final head reports no blocking findings.

All ten guest executables and the affected Alpine and Ubuntu initramfses and
Ubuntu distro layer were rebuilt from this head's guest inputs. Both backends
used those exact outputs and independently built native host/test binaries.
Unchanged native OpenVMM, kernel and scratch inputs were verified against the
release of 256ebe3d, with OpenVMM at 9cec2b89. Runtime provenance and all
18 consumed-file hashes per platform were checked before and after the VM runs.

KVM execution remains with CI. Azure Linux and the complete distribution matrix
are not run at this intermediate PR; they belong to SL2.3c and CI. OpenVMM's own
suites remain with their owning CI for the unchanged pin.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the VM configuration changes.

No open issues 🎉

What changed in this PR

This PR adds host::config::VmConfig, grouping a VM’s machine, root, workload view, exports, and boot console into one value. It advances #1097 by complementing the shared launch configuration introduced in #1268.

Changes:

  • Adds configuration types and validation that performs no host I/O.
  • Introduces activation::View and shares hostname validation with activation records.
  • Adds validation tests, documentation, and matching Linux and Windows public API entries.
File Description
nvx-rs/​src/​host/​mod.rs Exposes and documents the configuration module.
nvx-rs/​src/​host/​config/​tests.rs Tests valid configurations, refusals, RAM limits, and reserved export targets.
nvx-rs/​src/​host/​config/​mod.rs Defines VM configuration types and host-independent validation.
nvx-rs/​src/​activation/​mod.rs Adds View and extracts shared hostname validation.
nvx-rs/​README.md Documents the configuration module and workload view.
nvx-rs/​public-api/​windows.txt Records the new public API for Windows.
nvx-rs/​public-api/​linux.txt Records the same public API additions for Linux.

Review effort: Balanced

@esaurez

Copy link
Copy Markdown
Contributor Author

Scope update following the revised #1076/#1097 contract: remove the dependency on the retired error-type PR #1267.

VmConfig::check uses the crate's Result; a refused value is ErrorKind::Unsupported and names its field. Do not retain a ConfigError/ConfigErrorKind facade. Keep the existing SL2.3a boundary, pure checks and configuration fields unchanged.

Adapt this PR on the updated runtime PR #1268, without the obsolete ancestor. Earlier validation remains evidence for its recorded head, not a pass for the revised branch. Current-design readiness is held until the affected checks and reviews are qualified; no Ready transition or manual CI dispatch is included.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the VM configuration API changes.

No open issues 🎉

Review effort: Balanced

Base automatically changed from esaurez/slim-2.1.1-sl2.2-20261103 to feature/nvx-refactor November 6, 2026 04:32
@github-actions github-actions Bot added the tests-modified Changes existing tests, test data, or test wiring label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

This pull request changes existing tests

It 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

Change What Before After
modified helper def MicrovmTests._run_host_loopback_allow_script in scripts/test_microvm_tests.py scripts/test_microvm_tests.py:5145 scripts/test_microvm_tests.py:5145

Relocated unchanged: 0; added: 12. Compared the merge base aaa6bfd24907 with 3bd7e0d77a88.

@esaurez
Enrique Saurez (esaurez) force-pushed the esaurez/slim-2.1.1-sl2.3a-20261103 branch from 885be7b to 49d74dd Compare November 6, 2026 20:34
@esaurez

Copy link
Copy Markdown
Contributor Author

Existing test update in 49d74dd3:

  • Adjusted helper: MicrovmTests._run_host_loopback_allow_script makes two observations instead of 101 when polling its immutable fixture inputs. The socket tables are already fixed, and the existing wait completes stubbed server output before it is checked.
  • Kept: test_host_loopback_allow_script_checks_publication_and_traffic, all 13 subcases, failure codes and assertions, and the 10-second subprocess timeout.

The production host-loopback-policy.sh.in is unchanged, including its 100-retry bound and 0.05-second sleep.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the caller-owned VM configuration changes.

No open issues 🎉

Review effort: Balanced

Enrique Saurez and others added 2 commits November 6, 2026 12:59
Add VmConfig in the new host::config: a VM's processors, its memory in
MiB, its root, blockless or layered, the View that its workload has of
it, the export plan of the host paths that it exports, and where its
boot console's output goes, to a listener or nowhere; the console's
device exists either way. A layered root names its image and format, an
optional bound of a GPT disk's first partition, its overlay mode, and a
scratch upper with its journal policy or a RAM upper whose cap is 1 to
90 percent of the VM's memory, 50 by default.

VmConfig::check checks the whole value without reading the host, and
returns the first refusal as an Error of kind Unsupported, whose message
names what it refuses; an export's refusal keeps the error of
ExportPlan::check as its source. It reuses activation's journal, overlay
and machine-ID vocabulary, the record's hostname rule, which becomes
activation::is_hostname for both, and ExportPlan::check with the guest
targets that the root reserves.

Add activation::View, the hostname and machine ID that a VM's workload
sees, beside WorkloadView, which the record keeps for now.

The public API snapshots list the new items.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 869204bf-28f8-408e-bcab-e4353944ef69
Copilot-Session: 2d81c32c-865b-42d0-8f3e-6881809e0157
The fixture already freezes socket tables and waits for stubbed server output.
Observe a failed condition twice instead of spawning 101 awk or grep processes
over immutable input. Keep all 13 cases, the 10-second subprocess timeout and
production polling unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2d81c32c-865b-42d0-8f3e-6881809e0157

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The PR’s test-change inventory omits the modified _run_host_loopback_allow_script helper; it needs refreshing against the stacked base, documentation of the polling change, and the tests-modified label.

1 open issue

Review effort: Balanced

Comment thread scripts/test_microvm_tests.py Resolved
@esaurez
Enrique Saurez (esaurez) marked this pull request as ready for review November 6, 2026 21:58
@ppenna
Pedro Henrique Penna (ppenna) merged commit b7f56ab into feature/nvx-refactor Nov 6, 2026
107 of 108 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the esaurez/slim-2.1.1-sl2.3a-20261103 branch November 6, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat-nvx-refactor tests-modified Changes existing tests, test data, or test wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants