a73x

e5d55c04

refactor: an unconfigured host needs no special case

a73x   2026-08-23 11:13

Commit message
refactor: an unconfigured host needs no special case

quotaCheckLocked opened with a no-caps fast path that every arm of the switch
below already implies — each requires its own cap to be positive, so a host
with no caps falls out of the switch refusing nothing. No input distinguished
the two spellings, which made it a permanent mutation blind spot for the sake
of skipping a sum over tens of entries. TestQuotaZeroMeansUnlimited covers what
it was doing.

internal/agent/reconcile/reconcile.go
Old New
@@ -574,9 +574,6 @@ func (e *Engine) SeedLedger(recs map[string]state.Record) {
574 // (excluding vmID itself, so a retry does not double-count) and adds spec's 574 // (excluding vmID itself, so a retry does not double-count) and adds spec's
575 // request. 575 // request.
576 func (e *Engine) quotaCheckLocked(vmID string, spec state.VMSpec) string { 576 func (e *Engine) quotaCheckLocked(vmID string, spec state.VMSpec) string {
577 if e.MaxVCPUs == 0 && e.MaxMemMB == 0 && e.MaxDiskGB == 0 {
578 return "" // no caps configured — unlimited
579 }
580 vcpus, mem, disk := spec.VCPUs, spec.MemMB, spec.DiskGB 577 vcpus, mem, disk := spec.VCPUs, spec.MemMB, spec.DiskGB
581 for id, s := range e.committed { 578 for id, s := range e.committed {
582 if id == vmID { 579 if id == vmID {