Skip to content

feat(cli): name the card for berth hold and berth vfio run - #271

Merged
T-Crypt merged 1 commit into
nextfrom
T-Crypt/hold-vfio-gpu
Oct 31, 2026
Merged

T-Crypt merged 1 commit into
nextfrom
T-Crypt/hold-vfio-gpu

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Oct 31, 2026

Copy link
Copy Markdown
Owner

On a node with several cards, berth hold and berth vfio run always took the first card. A game on gpu1 or a passthrough of the second card had no way to name its card. Both commands now take --gpu, with the same values berth run --gpu takes.

Changes

  • berth hold --gpu CARD sends the card on the acquire. berthd already routes an acquire to the broker of each card it names. A comma list holds several cards under one lease.
  • berth vfio run --gpu CARD takes one card and refuses a comma list. It narrows berthd's status to that card with node.View before it reads the card's nvidia-smi index, so the preflight, the opener check and the wait for the card to come back all use the named card. A card berthd does not schedule is refused before any hold is asked.
  • Without --gpu, both commands take the first card, as before.
  • Help text, docs/leasing.md, docs/vfio.md, the skill table and the CHANGELOG [Unreleased] section are updated.

Tests

The tests run against a real berthd with one broker per card (serveNode, factored out of startNode):

  • TestHoldTakesTheCardItNames checks --gpu gpu1, --gpu gpu0,gpu2 and no flag on a three-card node. Each card is held or left alone as expected.
  • TestHoldRefusesABadGPU and TestHoldRefusesACardTheNodeLacks cover a malformed name and gpu7.
  • TestVfioRunTakesTheCardItNames uses an nvidia-smi stub that answers index 0 with a different card. With --gpu gpu1 the hold lands on gpu1 only, and the run finishes with the card back.
  • TestVfioRunRefusesSeveralCardsOrOneTheNodeLacks covers a comma list and gpu7.

I checked each test against a broken build. Dropping Card from the hold acquire, dropping it from the vfio acquire, and skipping the status narrowing each fail the matching test.

Full proof: go build, gofmt, go vet, the Windows build and vet, golangci-lint (0 issues) and go test ./..., all green. Against the live berthd on a one-card host, hold --gpu gpu7 and vfio run --gpu gpu7 are refused with nothing drained. The two-card path is tested only against the in-process berthd, because no multi-card host was available.

On a node with several cards, berth hold and berth vfio run always took
the first one. Both now take --gpu, the same card names and PCI
addresses berth run takes. hold accepts a comma list for one hold on
several cards. vfio run takes one card, refuses a list, and reads the
named card's nvidia-smi index from berthd's status narrowed to that
card. Without --gpu, both take the first card as before.
@T-Crypt
T-Crypt merged commit 180bc39 into next Oct 31, 2026
4 checks passed
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