firecracker: opt-in virtio-pci transport - #217
Merged
Merged
Conversation
--pci on vm run/create starts Firecracker with --enable-pci so the guest enumerates virtio-pci devices, the prerequisite for Firecracker device hot-plug. The transport is recorded on the VM config, so clones and restores relaunch on the transport their snapshot was taken with, and Cloud Hypervisor rejects the flag since it is always virtio-pci. cocoon no longer puts pci=off on the Firecracker command line: Firecracker adds it itself whenever PCI is disabled (since the PCI work in 1.13, below the 1.16.1 floor), and on --enable-pci the flag would hide every device.
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.
Why
Firecracker device hot-plug (Developer Preview since 1.16.0) only works on the virtio-pci transport, which Firecracker enables per process with
--enable-pci. cocoon always ran Firecracker on MMIO. This is the first of two steps: make the transport a per-VM choice, keep MMIO the default, and leave hot-plug itself to a follow-up.What
--pcionvm run/vm create(Firecracker only;validateBackendFlagsrejects it on Cloud Hypervisor, which is always virtio-pci). Stored asConfig.PCI, so it travels with snapshots:CloneVMConfigFromFlagsinherits it andRestoreVMConfigFromFlagsalready copies the wholeConfig, so clones and restores relaunch on the transport their snapshot was taken with.--enable-pciwhen the record says so (launchArgs);vm debugprints the same line.pci=offleaves the Firecracker command line: Firecracker inserts it itself whenever PCI is disabled (builder.rs, in every release from 1.13 on, below the 1.16.1 floor), and with--enable-pciit would hide every device (the boot hangs, as seen in the hot-plug round). The MMIO guest still boots with exactly onepci=off.--pcirow in cli.md, a "PCI Transport (Firecracker)" section in vm.md, the clone-constraint sentence in snapshots.md.Tests:
TestValidateBackendFlagsRejectsPCIOnCloudHypervisor,TestBuildCmdlineLeavesPCIToFirecracker,TestLaunchArgsEnablePCI, and the clone-config test now assertsPCIinheritance.Hot-path cost: none (one bool read at launch).
Evidence
Gates on the branch:
make fmt-checkclean;make lint0 issues on GOOS=linux and darwin;asl ./...andGOOS=linux asl ./...0 findings;GOWORK=off go test -race -count=1 ./...35 ok packages, no FAIL.Hardware (cocoon-test2, isolated root, Firecracker fork
devbuildv1.18.0-dev,ghcr.io/cocoonstack/cocoon/ubuntu:24.04):Full record: cocoon-specs
tests/2026-09-05-fc-hotplug-mtu-parity.md(2026-09-06 addendum). Not covered: the sandbox guest image, whose kernel has noCONFIG_VIRTIO_MMIOand did not come up on Firecracker on either transport within the round; that is a separate investigation and vm.md says so.