nomad: Use AllocsByNodeTerminal in plan apply

This commit is contained in:
Armon Dadgar 2016-02-20 11:26:38 -08:00
parent abf7e52689
commit 2d7236eb95
1 changed files with 2 additions and 5 deletions

View File

@ -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