From 2d7236eb956099b1b1533425f6752b2e1ad768bd Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sat, 20 Feb 2016 11:26:38 -0800 Subject: [PATCH] nomad: Use AllocsByNodeTerminal in plan apply --- nomad/plan_apply.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nomad/plan_apply.go b/nomad/plan_apply.go index 23ac96c1b..0a2f15955 100644 --- a/nomad/plan_apply.go +++ b/nomad/plan_apply.go @@ -256,15 +256,12 @@ func evaluateNodePlan(snap *state.StateSnapshot, plan *structs.Plan, nodeID stri return false, nil } - // Get the existing allocations - existingAlloc, err := snap.AllocsByNode(nodeID) + // Get the existing allocations that are non-terminal + existingAlloc, err := snap.AllocsByNodeTerminal(nodeID, false) if err != nil { return false, fmt.Errorf("failed to get existing allocations for '%s': %v", nodeID, err) } - // Filter on alloc state - existingAlloc = structs.FilterTerminalAllocs(existingAlloc) - // Determine the proposed allocation by first removing allocations // that are planned evictions and adding the new allocations. proposed := existingAlloc