HA: hardware-passthrough-aware failover (GPU/PCI devices) #7
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
CanuteTheGreat/horcrux!7
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/ha-passthrough-device-affinity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Mirrors the existing CPU-architecture-compatibility filter in ha/mod.rs for hardware passthrough (GPU/PCI). A VM with a passthrough device attached now only fails over to a node reporting an available, matching device (vendor_id:device_id); if none exists it cleanly goes to HaState::Error instead of silently migrating to an incompatible node.
Scoped to GPU-class PCI devices (reusing GpuManager discovery scope), not generalized to all PCI hostdev classes yet.
cargo check/test pass for horcrux-api + horcrux-common; all pre-existing ha tests unaffected. Not intended to merge yet -- opened for CI signal / review.
Mirrors the existing CPU-architecture-compatibility filter in ha/mod.rs: HaResource/HaConfig (and NodeResources/VmResources in cluster/balancer.rs) now carry required_passthrough_devices / available_passthrough_devices, keyed by vendor_id:device_id (NOT PCI address, since bus/slot layout differs host to host -- the same logical GPU model needs to match across different physical PCI addresses on the failover target). - cluster/node.rs: new PassthroughDeviceRequirement{vendor_id, device_id, device_name} + passthrough_devices_satisfied() helper (multiset match: a VM needing 2x of the same model needs 2 distinct available units). - cluster/balancer.rs: NodeResources gains available_passthrough_devices (live, not-in_use snapshot); VmResources gains required_passthrough_devices. ClusterBalancer::find_best_node filters candidates on this immediately after the existing architecture filter, before scoring. - ha/mod.rs: HaResource/HaConfig gain required_passthrough_devices (#[serde(default)] for backward compat). find_best_node_for_migration applies the same device-availability check to preferred_node and to the known-resource candidate set, reusing the existing 'no suitable node' -> HaState::Error path when nothing qualifies. - 4 new tests mirroring the 3 existing architecture tests: migrates-to-matching-gpu-node, never-migrates-to-node-with-gpu- already-in_use, errors-when-no-matching-gpu-available, and a mixed composition test proving an arch-compatible-but-device-missing node is still excluded (and vice versa). - Updated all existing HaConfig/NodeResources/VmResources literals (ha/mod.rs tests, cluster_tests.rs, main.rs add_ha_resource) for the new fields. All pre-existing ha::tests pass unchanged, including test_failover_x86_vm_never_migrates_to_riscv_node, test_failover_riscv_vm_only_migrates_to_riscv_node, and test_failover_riscv_vm_errors_when_no_riscv_node_available. Scope: GPU-class PCI devices only (reusing GpuManager's discovery scope), not generalized to all PCI hostdev classes -- GPU passthrough is the dominant real-world case here; a generic PCI-hostdev inventory can reuse the same PassthroughDeviceRequirement type later if needed. Not merged -- left for review.Closing: this PR's exact content (same commit message "feat(ha): hardware-passthrough-aware failover for GPU/PCI devices") was already landed directly on
mainatc53a788on 2026-10-04, per the repo's "push directly to main, no PRs" policy -- thecluster/node.rsPassthroughDeviceRequirement/passthrough_devices_satisfied helper, the balancer.rs available/required_passthrough_devices fields, and the ha/mod.rs HaResource/HaConfig wiring are all present on main today (verified viagit show origin/main:horcrux-api/src/ha/mod.rs/cluster/balancer.rs/cluster/node.rs). Test-merging this branch into current main (resolving the one trivial import-formatting conflict in ha/mod.rs) produces a byte-for-byte empty diff against main -- there is nothing left for this PR to contribute. Closing as redundant rather than leaving a permanently-unmergeable stale PR open against issue #7 (which is itself resolved byc53a788).Pull request closed