diff --git a/nomad/structs/funcs.go b/nomad/structs/funcs.go index 91298c97b..5ace4bc8c 100644 --- a/nomad/structs/funcs.go +++ b/nomad/structs/funcs.go @@ -111,6 +111,11 @@ func AllocsFit(node *Node, allocs []*Allocation, netIdx *NetworkIndex) (bool, st // For each alloc, add the resources for _, alloc := range allocs { + // Do not consider the resource impact of terminal allocations + if alloc.TerminalStatus() { + continue + } + if alloc.Resources != nil { if err := used.Add(alloc.Resources); err != nil { return false, "", nil, err diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 1588cc101..68fd8d529 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -7138,6 +7138,10 @@ func (p *Plan) PopUpdate(alloc *Allocation) { func (p *Plan) AppendAlloc(alloc *Allocation) { node := alloc.NodeID existing := p.NodeAllocation[node] + + // Normalize the job + alloc.Job = nil + p.NodeAllocation[node] = append(existing, alloc) } diff --git a/nomad/worker.go b/nomad/worker.go index b6bab0bbc..911f4ee3a 100644 --- a/nomad/worker.go +++ b/nomad/worker.go @@ -326,7 +326,7 @@ SUBMIT: } return nil, nil, err } else { - w.logger.Debug("submitted plan for evaluation", "plan_resp_index", resp.Index, "eval_id", plan.EvalID) + w.logger.Debug("submitted plan for evaluation", "eval_id", plan.EvalID) w.backoffReset() }