nvx-prepare-host
Prepare a local host or a configured SSH host for NVX work: resolve its profile, probe its KVM, MSHV, or WHP backend and checkout, check out the requested revision in a temporary worktree, and stage nvx-rs and the artifacts. Use before running, debugging, or benchmarking NVX on a host, or to diagnose a host's prerequisites.
- License 许可
- MIT
- 所属仓库
- microsoft/nvx
- 最近更新
- 2026-11-15
- Stars
- ★ 841
- Forks
- 59
01 前言 Front Matter
- name
- nvx-prepare-host
- description
- Prepare a local host or a configured SSH host for NVX work: resolve its profile, probe its KVM, MSHV, or WHP backend and checkout, check out the requested revision in a temporary worktree, and stage nvx-rs and the artifacts. Use before running, debugging, or benchmarking NVX on a host, or to diagnose a host's prerequisites.
- argument-hint
- [local|host-profile] [revision]
03 SKILL.md 正文
Prepare An NVX Host
Establish a verified execution context, report it, and stop; then continue
with nvx-run-microvm or
nvx-collect-benchmarks. Run the commands
from the NVX checkout. They use python3; use python on Windows.
1. Choose The Host
Work locally when the user asks for it or the local host provides the backend.
Otherwise, list the profiles of the developer's inventory, the ignored
.nvx-hosts.json that Setup describes,
which the tool reads from the main worktree when you work in a linked one:
python3 scripts/nvx_hosts.py list
- When
remote_enabledisfalse, no remote host is configured: say so and work locally. - Use the profile that the user or the calling skill named, or ask the user to
choose one.
python3 scripts/nvx_hosts.py show PROFILEreturns itsssh_target,backend,platform,host_type, andremote_repo, which are authoritative: never connect to a target outside the inventory, override its backend, or infer bare metal or a virtual machine from probes. Whenremote_repoisnull, ask for the checkout's absolute path, and pass it as--cwd.
2. Safety
- Never ask for or handle passwords, keys, tokens, or passphrases; when SSH asks for one, the user types it in the terminal. Never disable host-key checking, and stop on a changed host key.
- Never reset, clean, switch, pull, overwrite, or update submodules in a dirty checkout. Test another revision in a temporary worktree, and ask before copying uncommitted files to a host.
- Never install packages, enable Windows features, change device permissions,
edit
sudoers, load kernel modules, reboot, or usesudoto get past an access check without the user's approval. - Select one backend explicitly, never
both. - Never terminate an OpenVMM process that this session did not start.
3. Probe
Probe the local host or the profile's checkout:
python3 scripts/host_probe.py --backend BACKEND
python3 scripts/nvx_hosts.py probe PROFILE
Both report the OS, Python, HEAD, the dirty state, the OpenVMM pin and
checkout, nvx.py verify, the backend's access (/dev/kvm, /dev/mshv, or
WHP), nvx-rs and the artifacts, and running OpenVMM processes. On a host,
nvx_hosts.py runs this checkout's copy of the probe, so the host's checkout
may predate it. Report a failed access check as the probe states it. When KVM
and MSHV are both usable and no backend was named, ask which one to use. A
smoke run is the definitive WHP check.
4. Revision
Use the checkout as it is only when it is clean and at the requested revision, or when the user approves. To test another revision, such as a branch that you pushed, without touching the checkout, add a temporary worktree, which checks the remotes, fetches the branch, and checks out the worktree's OpenVMM pin:
python3 scripts/nvx_hosts.py worktree PROFILE -- add FETCH_HEAD --fetch BRANCH
On a host, this runs this checkout's host_worktree.py, as probe does;
locally, run python3 scripts/host_worktree.py add ... directly. Work in the
worktree that it prints, passing it as --cwd on a remote host, and remove it
at the end with the same command, remove PATH taking the place of add ....
5. Artifacts
Build nvx-rs, which runs microVMs and sandboxes and downloads releases, from
the checkout's root, and again after nvx-rs changes; no package contains it:
cargo build --release --locked --features cli --manifest-path nvx-rs/Cargo.toml --target-dir nvx-rs/target
Then stage the artifacts that the task's provenance calls for:
- Packaged:
nvx-rs/target/release/nvx-rs download --hypervisor BACKENDinstalls the release built fromHEAD, or from its nearest released first-parent ancestor; report that release. It replaces every artifact, so never run it over artifacts that the user wants to keep. - Changed inputs: the matching
nvx.py build-guest,build-openvmm, orbuildcommand of Build. - Changes to the coordinator only: the matching release artifacts in place, with their provenance reported.
- The public sandbox scenarios of
test-microvmalso needbuild/ubuntu-smoke-scratch.ext4, whichdownloadinstalls from the releases that ship it. For an older release, format it on a Linux host withpython3 scripts/nvx.py build-scratch-templateand copy it to a Windows host.
A run downloads a release only into a checkout that holds no artifacts;
NVX_AUTO_DOWNLOAD=0 turns that off. Check the generated command and its files
without starting a VM:
nvx-rs/target/release/nvx-rs run --hypervisor BACKEND --dry-run
Handoff
Report the host or local execution, the checkout and any temporary worktree,
the OS, backend, platform, and host type, the commit and dirty state, the
artifact source and the commands that staged it, the dry run's result, any
running OpenVMM process, and every privilege or platform limitation. For
interactive work on a remote host, open ssh -tt <ssh_target> and change to
that directory.
04 同仓库更多 Skills
nvx-triage-ci-run
Triage a failed, cancelled, or hanging microsoft/nvx GitHub Actions run: classify supersession and queueing, find the first causal failure for the exact head, reproduce it on the matching platform, and fix it locally without committing. Use for workflow run URLs or IDs, red pull-request checks, runner, matrix, and artifact-handoff failures, and performance-gate or benchmark-host failures.
nvx-run-microvm
Boot an NVX microVM with nvx-rs on Linux/KVM, Linux/MSHV, or Windows/WHP, exercise the guest, and debug failed boots. Use for boot smoke tests, guest shell sessions, virtio-fs mounts, networking, kernel command lines, missing boot markers, OpenVMM errors, guest hangs, and benchmark acceptance failures.
nvx-rebase-openvmm-chain
Rebase or reorganize the OpenVMM microVM chain onto the latest upstream main as a new feature/microvm/release branch, validate and publish it, pin it in NVX with a remapped roadmap, and land it. Use for microVM release rebases and reorganizations, chain commits that upstream landed, rebase conflicts and fixups, and the release landing order.
nvx-promote-openvmm-pin
Pin a reviewed OpenVMM revision in NVX: verify its provenance and signature, commit the gitlink and the OpenVMM roadmap mapping, validate the exact pin, and land the OpenVMM pull request by fast-forward. Use for OpenVMM pin updates, clean replacement pull requests, source-equivalence checks, and mapping new chain commits in the OpenVMM upstream roadmap.
nvx-fix-issue
Fix one microsoft/nvx issue end to end: reproduce it on the configured hosts, commit signed fixes, open a Ready pull request against dev, and drive CI and review until only a maintainer's approval remains. Use when invoked with an NVX issue number or URL.
nvx-collect-benchmarks
Collect fresh NVX benchmark results on a prepared Linux/KVM, Linux/MSHV, or Windows/WHP host with the smoke, CI-equivalent, or canonical profile. Use for acceptance runs, performance suites, p50 collection, benchmark artifacts, and same-host performance comparisons.