Merge pull request #6286 from hashicorp/b-inplaceupdate-bugfix

Fix inplace updates bug with group level networks
This commit is contained in:
Michael Schurter 2019-09-05 17:01:30 -07:00 committed by GitHub
commit b460271de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -509,9 +509,11 @@ func (s *GenericScheduler) computePlacements(destructive, place []placementResul
AllocatedResources: resources,
DesiredStatus: structs.AllocDesiredStatusRun,
ClientStatus: structs.AllocClientStatusPending,
// SharedResources is considered deprecated, will be removed in 0.11.
// It is only set for compat reasons.
SharedResources: &structs.Resources{
DiskMB: tg.EphemeralDisk.SizeMB,
Networks: tg.Networks,
Networks: resources.Shared.Networks,
},
}

View File

@ -363,9 +363,11 @@ func (s *SystemScheduler) computePlacements(place []allocTuple) error {
AllocatedResources: resources,
DesiredStatus: structs.AllocDesiredStatusRun,
ClientStatus: structs.AllocClientStatusPending,
// SharedResources is considered deprecated, will be removed in 0.11.
// It is only set for compat reasons
SharedResources: &structs.Resources{
DiskMB: missing.TaskGroup.EphemeralDisk.SizeMB,
Networks: missing.TaskGroup.Networks,
Networks: resources.Shared.Networks,
},
}

View File

@ -822,7 +822,7 @@ func genericAllocUpdateFn(ctx Context, stack Stack, evalID string) allocUpdateTy
networks = tr.Networks
}
// Add thhe networks back
// Add the networks back
resources.Networks = networks
}
@ -837,8 +837,11 @@ func genericAllocUpdateFn(ctx Context, stack Stack, evalID string) allocUpdateTy
newAlloc.AllocatedResources = &structs.AllocatedResources{
Tasks: option.TaskResources,
Shared: structs.AllocatedSharedResources{
DiskMB: int64(newTG.EphemeralDisk.SizeMB),
Networks: newTG.Networks,
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,
},
}