Ensure CPU quota/period updates are sent to runc
Fixes an issue where if cpu quota/period is sent via the update API, the values are updated in the stored container data but not actually sent to the running container. Signed-off-by: Brian Goff <cpuguy83@gmail.com> Upstream-commit: 86ba63db82e87c943c9dee52559118e46f23defc Component: engine
This commit is contained in:
@@ -30,6 +30,13 @@ func toContainerdResources(resources container.Resources) *libcontainerd.Resourc
|
||||
period = uint64(100 * time.Millisecond / time.Microsecond)
|
||||
quota = resources.NanoCPUs * int64(period) / 1e9
|
||||
}
|
||||
if quota == 0 && resources.CPUQuota != 0 {
|
||||
quota = resources.CPUQuota
|
||||
}
|
||||
if period == 0 && resources.CPUPeriod != 0 {
|
||||
period = uint64(resources.CPUPeriod)
|
||||
}
|
||||
|
||||
r.CPU.Period = &period
|
||||
r.CPU.Quota = "a
|
||||
|
||||
|
||||
Reference in New Issue
Block a user