Skip to content

Commit

Permalink
core: fix panic when AllocatedResources is nil
Browse files Browse the repository at this point in the history
Potential fix for #6540
  • Loading branch information
schmichael committed Oct 23, 2019
1 parent 6a8b80b commit 9859b83
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scheduler/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,13 +838,16 @@ func genericAllocUpdateFn(ctx Context, stack Stack, evalID string) allocUpdateTy
Tasks: option.TaskResources,
Shared: structs.AllocatedSharedResources{
DiskMB: int64(newTG.EphemeralDisk.SizeMB),
// Since this is an inplace update, we should copy network
// information from the original alloc. This is similar to
// how we copy network info for task level networks above.
Networks: existing.AllocatedResources.Shared.Networks,
},
}

// Since this is an inplace update, we should copy network
// information from the original alloc. This is similar to how
// we copy network info for task level networks above.
if existing.AllocatedResources != nil {
newAlloc.AllocatedResources.Shared.Networks = existing.AllocatedResources.Shared.Networks
}

// Use metrics from existing alloc for in place upgrade
// This is because if the inplace upgrade succeeded, any scoring metadata from
// when it first went through the scheduler should still be preserved. Using scoring
Expand Down

0 comments on commit 9859b83

Please sign in to comment.