Give a PCI function to a Pod through vfio-pci behind the VFIODriverRebind gate #420
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 611 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.384
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #420"
general
weight: 0.35
aojea
What type of PR is this?
/kind feature
/kind api-change
What this PR does / why we need it:
This implements the design discussed in #375: a claim can ask for the whole PCI function through VFIO instead of its netdev. It is behind a new alpha feature gate,
VFIODriverRebind, off by default.How it follows the points raised in #375:
| Point from the issue | How the PR handles it |
|---|---|
| DRANET stays the allocator, no separate pool | One device per PCI function, published on its kernel driver as today. With the gate on it also gets
dra.net/vfioand the standardresource.kubernetes.io/pciBusID. The function is bound tovfio-pcionly in prepare, for a claim with avfio: {}config. || Never rebind without knowing the original driver | The original driver is written to the checkpoint before the first sysfs write. Functions already on
vfio-pciat scan time are not published and never touched. || Restore the original driver, including across restarts and PF reloads | Unprepare sets
driver_overrideto the recorded driver, unbinds, probes, checks it, and clears the override (naming the driver also covers a VF whose PF hassriov_drivers_autoprobeoff). If that fails, the checkpoint is kept and the error goes back to kubelet, which retries. A function that no longer exists (PF reload, VF count change) counts as restored. The daemon refuses to start with the gate on and no--db-path. || Don't advertise what would fail at prepare |
dra.net/vfioisfalsewhenvfio-pciis not loaded, the function has no IOMMU group or shares it with a device on another driver (unbound,pcieportandpci-stubmembers are fine), it is a PF with VFs, its netdev is part of a bond/bridge/VLAN, or it has host IP addresses. Prepare checks the same conditions again. || The only new host operation is the rebind | No netns work for a VFIO device. The NRI hook adds
/dev/vfio/<group>and/dev/vfio/vfio(plus the cdev and/dev/iommuwhen the kernel provides both), the same way it adds RDMA char devices. || PCI address for the workload | The standard
resource.kubernetes.io/pciBusIDattribute of the allocated device in the ResourceSlice. No CDI or KEP-5304 device metadata. || Behind a flag | With the gate off, the ResourceSlice and PrepareResult are unchanged, and a
vfioclaim fails prepare with a message naming the gate. |Commits are split by area to help review: API and gate, inventory, driver and NRI, deploy and e2e, docs.
Which issue(s) this PR is related to:
Fixes #375
Special notes for your reviewer:
site/content/docs/concepts/vfio.mdlists each case.DeleteClaimdrops every device entry of the pods that use the claim, so unprepare first restores every VFIO function those pods hold, and returns before any DHCP or profile release if a restore fails.vfioclaim does not merge cloud-provider or profile configs, since those describe a netdev. Validation rejects any interface, route, rule, neighbor, ethtool, or profile setting together withvfio.install.yamland the Helm chart now mount/dev/vfio, for the char device numbers.- Unit tests with
-racefor the bind order, rollback, restore, resume after an interrupted prepare, gate off, refused devices, unprepare with several claims, and NRI injection. A fake binder simulates the kernel'sdriver_override/probe behaviour. I also mutated the key invariants (record before the first write, error returned on a failed restore, pod-wide restore, each safety check) and confirmed the tests catch them.- A new bats test covers what kind can show: a
vfioclaim is refused with the gate off and for a non-PCI device, and netdev claims keep working with the gate on. Locally the test's assertions passed, but its final DaemonSet rollout (restoring the original args) timed out under emulation, as did the existing "allocated device in ResourceSlice remains unchanged" test, so I'd like to confirm both in CI.Does this PR introduce a user-facing change?
``
release-noteVFIODriverRebindAdd the alpha
feature gate. With it, a claim with avfio: {}config gets the PCI function bound to vfio-pci and its VFIO device nodes, and the original driver is bound back on release. Devices that can be given this way have thedra.net/vfioattribute set to true.
``🤖 Generated with Claude Code