mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Prevent a non-zero NanoCPUs from setting a zero CPU.Count
Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
parent
4480e0417e
commit
b3649f4065
1 changed files with 5 additions and 0 deletions
|
@ -92,6 +92,11 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
|
|||
}
|
||||
} else {
|
||||
cpuPercent = uint8(c.HostConfig.NanoCPUs * 100 / int64(sysinfo.NumCPU()) / 1e9)
|
||||
|
||||
if cpuPercent < 1 {
|
||||
// The requested NanoCPUs is so small that we rounded to 0, use 1 instead
|
||||
cpuPercent = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
memoryLimit := uint64(c.HostConfig.Memory)
|
||||
|
|
Loading…
Reference in a new issue