Skip to content

feat(microvm): apply outbound NAT and host-memory admission on both VM runtimes - #200

Merged
Shine-neko merged 1 commit into
mainfrom
feat/microvm-nat-memory-parity
Jul 25, 2026
Merged

feat(microvm): apply outbound NAT and host-memory admission on both VM runtimes#200
Shine-neko merged 1 commit into
mainfrom
feat/microvm-nat-memory-parity

Conversation

@Shine-neko

@Shine-neko Shine-neko commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Two host-side facilities existed as shared modules but were only wired into one of the two microVM runtimes. Both are now applied on both.

Outbound NAT. host_nat masquerades the guest supernet so a VM can reach external networks. It was called from Firecracker only, so a Cloud Hypervisor guest could serve inbound traffic but resolved nothing outbound. Cloud Hypervisor now makes the same call, in the branch that allocates the guest network — so it stays a no-op for a VM that declares no ports and therefore has no network at all. The rule set is idempotent and process-global, so this costs nothing after the first VM.

Host-memory admission. resources::check_host_memory refuses a deployment asking for more memory than the host has available. Cloud Hypervisor and containerd ran it; Firecracker had no memory gate, so an over-ask died on an opaque allocation failure at boot — and only after copying a full rootfs image per instance. The check now runs in start_vm before that copy. A refusal is terminal rather than a crash loop, since a retry cannot free memory.

Neither module needed changes: both were already runtime-agnostic, they were simply not called.

Docs: documented outbound access on the Cloud Hypervisor page (including the CAP_NET_ADMIN requirement and what happens without it), documented the memory gate on the Firecracker page, added both to the runtime comparison table, and corrected the Cloud Hypervisor page which described resources.requests.* as ignored — it is not used to size the VM, but requests.memory does drive admission control and takes precedence over limits.memory there.

Tests

764 unit tests pass; cargo fmt and cargo clippy --all-targets are clean. The underlying modules already have unit coverage — what changed here is where they are called from, which only an e2e run on a KVM-capable host with the runtime binaries would exercise. Those suites do not run in CI today.

Base automatically changed from fix/shared-failure-classifier to main July 25, 2026 06:18
@Shine-neko
Shine-neko force-pushed the feat/microvm-nat-memory-parity branch from cfc5fec to 7547cc8 Compare July 25, 2026 06:19
@Shine-neko
Shine-neko merged commit 72f55ef into main Jul 25, 2026
5 checks passed
@Shine-neko
Shine-neko deleted the feat/microvm-nat-memory-parity branch July 25, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant