kvm2: health checker on dedicated connections; kvm2 in the ProviderHealth type comment

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-16 19:26:51 +00:00
co-authored by Claude Fable 5.1
parent 794a2aef3d
commit ce62fe57f6
6 changed files with 794 additions and 3 deletions
@@ -9,7 +9,7 @@ Plan: [docs/plans/2026-09-16-1333-kvm2-provider.md](../plans/2026-09-16-1333-kvm
- [x] Step 4 — Transport, seam, decorator, fakes
- [x] Step 5 — Image cache and pool-space precheck
- [x] Step 6 — The four contract methods
- [ ] Step 7 — Checker and the CRD comment
- [x] Step 7 — Checker and the CRD comment
- [ ] Step 8 — Deployment files, Makefile, integration test
- [ ] Step 9 — Documentation
- [ ] Step 10 — Milestone review
@@ -250,3 +250,34 @@ grep -n 'provider.Wrap(' internal/provider/kvm2/*.go | grep -v _test.go | grep -
```
All `ok`. Attestation: "files read outside the allowed set: none".
## Step 7 — Checker and the CRD comment
2026-09-16 18:52. Sixth subagent step: `check.go` and `check_test.go`
(ten tests, the reasons table has 19 rows). Every host is checked
concurrently on a fresh dedicated connection that is closed when the probe
ends; the pooled table is never consulted, which the test proves with a
counting dialer. Details fill in as facts arrive, so a `PoolNotFound`
verdict still says which libvirt version answered. The `status.type` comment
in `api/v1alpha1/providerhealth_types.go` gained `kvm2` and `make manifests`
changed only the CRD's description line:
```sh
make manifests && git diff --stat config/ api/
# api/v1alpha1/providerhealth_types.go | 2 +-
# config/crd/bases/crawl.example.com_providerhealths.yaml | 2 +-
```
Decisions the agent made, accepted: a dial that runs out of time is
`Unreachable` (the host did not answer), and `Timeout` is reserved for ctx or
budget expiry on an established connection; `Close` runs synchronously in
the probe so the close-count assertion is deterministic, at the cost of up
to five seconds past ctx if a disconnect hangs on a live link.
The agent also reported that the `captureContext` helper in `kvm2_test.go`
appends to an unlocked slice, which the race detector flagged once `Check`
logged from several goroutines. The helper was outside its allowed file set,
so it built its own locked capture; the orchestrator fixed `captureContext`
with a mutex in this commit and re-ran the package at `-race -count=3`.
Attestation: "files read outside the allowed set: none".