From 4db7e87a31b842ace0c12081aa18229da376cffc Mon Sep 17 00:00:00 2001 From: Preetha Appan Date: Tue, 16 Oct 2018 21:26:42 -0500 Subject: [PATCH] Preempted allocations should be removed from proposed allocations --- scheduler/context.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scheduler/context.go b/scheduler/context.go index 031a3b45a515..1da0776913e5 100644 --- a/scheduler/context.go +++ b/scheduler/context.go @@ -123,6 +123,12 @@ func (e *EvalContext) ProposedAllocs(nodeID string) ([]*structs.Allocation, erro proposed = structs.RemoveAllocs(existingAlloc, update) } + // Remove any allocs that are being preempted + nodePreemptedAllocs := e.plan.NodePreemptions[nodeID] + if len(nodePreemptedAllocs) > 0 { + proposed = structs.RemoveAllocs(existingAlloc, nodePreemptedAllocs) + } + // We create an index of the existing allocations so that if an inplace // update occurs, we do not double count and we override the old allocation. proposedIDs := make(map[string]*structs.Allocation, len(proposed))