Merge pull request #32727 from darrenstahlmsft/WindowsSmallNanoCPUs

Prevent a non-zero NanoCPUs from setting a zero CPU.Count
Upstream-commit: 2f3f1e6ccd609080b209ab876210491689d77201
Component: engine
This commit is contained in:
Tõnis Tiigi
2017-05-04 09:37:55 -07:00
committed by GitHub

View File

@ -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)