Merge pull request #687 from rjnagal/master

Fix handling of default cpu shares.
This commit is contained in:
Victor Marmol 2014-07-29 12:06:50 -07:00
commit a21cec0fc4

View File

@ -242,6 +242,10 @@ func makePortsAndBindings(container *api.Container) (map[docker.Port]struct{}, m
} }
func milliCPUToShares(milliCPU int) int { func milliCPUToShares(milliCPU int) int {
if milliCPU == 0 {
// zero milliCPU means unset. Use kernel default.
return 0
}
// Conceptually (milliCPU / milliCPUToCPU) * sharesPerCPU, but factored to improve rounding. // Conceptually (milliCPU / milliCPUToCPU) * sharesPerCPU, but factored to improve rounding.
shares := (milliCPU * sharesPerCPU) / milliCPUToCPU shares := (milliCPU * sharesPerCPU) / milliCPUToCPU
if shares < minShares { if shares < minShares {