Quarantine unhealthy vGPU VFs via a persisted health store - #462
Quarantine unhealthy vGPU VFs via a persisted health store#462yummybomb wants to merge 4 commits into
Conversation
Add a VF health store persisted at <data-dir>/gpu/vf-health.json: init failures reported against a VF are tallied per instance assignment, and once failures accumulate from gpu.vf_quarantine_threshold distinct assignments (default 2) the VF is quarantined. Quarantined VFs are excluded from placement and advertised profile availability, cards with quarantined VFs are deprioritized, and selection among equivalent free VFs is randomized. An exact-assignment success report clears the match and older tallies and rescinds that assignment's quarantine. An unreadable or invalid state file fails closed: mutations are refused, placement and advertised availability are disabled, and loads are retried after repair. Writes fsync before and after the rename. GET /resources reports allocatable_slots and quarantined_slots, and GPU admission gates on the allocatable count. GPU.md documents the store semantics, draining the parent GPU, the SR-IOV recovery cycle, and clearing quarantine state.
182853a to
34d27c2
Compare
-->
✱ stlc build✅ go code · compare
✅ python code · compare
✅ typescript code · compare
Diagnostics: ❗ 0 new / 1 total error, 💡 0 new / 5 total note
Build metadata
This comment is auto-generated by stlc and is kept up to date as you push. |
A failed state write previously rolled memory back and left the store reporting healthy, so a VF whose threshold-crossing failure could not be persisted stayed allocatable. Latch write failures and refuse placement until a later write succeeds; re-reported markers retry the write. Also make acknowledged reports crash-durable (fsync the parent when the state dir is first created, treat directory sync failures as persist failures instead of logging success), and re-evaluate persisted tallies against the configured threshold at load and on threshold changes so a lowered gpu.vf_quarantine_threshold applies to existing failures.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2bea9f0. Configure here.

Summary
Bottom half of the wedged-VF work (detection lands separately on top, in #435). This PR adds the quarantine machinery: a persisted VF health store plus the placement, admission, and API changes that act on it. Nothing in this PR reports failures automatically yet — the store is fed by the guest-side detection in #435, and by operators editing the state file per the runbook.
<data-dir>/gpu/vf-health.jsonper instance assignment; a VF is quarantined once failures accumulate fromgpu.vf_quarantine_thresholddistinct assignments (default 2). An exact-assignment success report clears the match and older tallies, and rescinds that assignment's quarantine.GET /resourcesreportsallocatable_slotsandquarantined_slots; GPU admission gates on the allocatable count.Safety and failure handling
lib/devices/GPU.mddocuments the store semantics, draining the parent GPU, the SR-IOV recovery cycle, and clearing quarantine state.Testing
Passed:
go test -race ./lib/devices ./lib/paths ./lib/resources ./cmd/api/config go vet ./lib/devices ./lib/resources ./lib/paths ./cmd/api/config ./cmd/api/apiThe full
lib/instancessuite was also attempted;TestCreateInstanceWithNetworkfails in this environment on both this branch and its base (it boots a real VM image), so it is environmental, not introduced here. The stacked detection PR's tree is byte-identical to the previously reviewed and tested head of #435.Note
Medium Risk
Changes vGPU placement and admission on a fail-closed persisted store; misconfigured or corrupt
vf-health.jsoncan block new vGPU placements until fixed, though running VMs are not touched.Overview
Adds persisted VF health (
gpu/vf-health.json) and wires it through vendor-VFIO placement, capacity reporting, and GPU admission so wedged VFs stop capturing every new instance.Guest init failures are tallied per distinct instance assignment; after
gpu.vf_quarantine_threshold(default 2) the VF is quarantined—dropped from placement and profile availability, with parent GPUs deprioritized and random choice among equivalent free VFs.ReportVFInitFailure/ReportVFInitSuccessupdate the store (success clears only a matching assignment and can rescind that assignment’s quarantine). Invalid or unreadable state, or a latched persist failure, fails closed on placement and allocatable counts until repair.GET /resourcesgains requiredallocatable_slotsandquarantined_slots; reservation/validation gates on allocatable slots (nottotal_slots - used_slots). Device manager loads health at startup; config documentsvf_quarantine_threshold.Docs in
GPU.mdcover store semantics, manual drain/quarantine, and SR-IOV recovery (including DCGM quiesce). Automatic failure reporting is expected from a stacked PR—this change is the quarantine machinery only.Reviewed by Cursor Bugbot for commit ce05d4e. Bugbot is set up for automated code reviews on this repo. Configure here.