Address review feedback
This commit is contained in:
parent
6ddc4fd17b
commit
e4524b173c
|
@ -128,8 +128,16 @@ func (s *Server) planApply() {
|
|||
|
||||
// applyPlan is used to apply the plan result and to return the alloc index
|
||||
func (s *Server) applyPlan(job *structs.Job, result *structs.PlanResult, snap *state.StateSnapshot) (raft.ApplyFuture, error) {
|
||||
// Determine the miniumum number of updates, could be more if there
|
||||
// are multiple updates per node
|
||||
minUpdates := len(result.NodeUpdate)
|
||||
minUpdates += len(result.NodeAllocation)
|
||||
minUpdates += len(result.FailedAllocs)
|
||||
|
||||
// Setup the update request
|
||||
req := structs.AllocUpdateRequest{
|
||||
Job: job,
|
||||
Job: job,
|
||||
Alloc: make([]*structs.Allocation, 0, minUpdates),
|
||||
}
|
||||
for _, updateList := range result.NodeUpdate {
|
||||
req.Alloc = append(req.Alloc, updateList...)
|
||||
|
|
|
@ -2421,9 +2421,7 @@ type Plan struct {
|
|||
func (p *Plan) AppendUpdate(alloc *Allocation, status, desc string) {
|
||||
newAlloc := new(Allocation)
|
||||
*newAlloc = *alloc
|
||||
if p.Job != nil {
|
||||
newAlloc.Job = nil // Normalize the job
|
||||
}
|
||||
newAlloc.Job = nil // Normalize the job
|
||||
newAlloc.DesiredStatus = status
|
||||
newAlloc.DesiredDescription = desc
|
||||
node := alloc.NodeID
|
||||
|
|
Loading…
Reference in New Issue