Skip to content

Commit

Permalink
Preempted allocations should be removed from proposed allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
preetapan committed Oct 17, 2018
1 parent a84d6af commit 4db7e87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scheduler/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 4db7e87

Please sign in to comment.