1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #27152 from darrenstahlmsft/Rounding

Windows: fix rounding error in container resources
This commit is contained in:
Brian Goff 2016-10-04 21:08:14 -04:00 committed by GitHub
commit c48317ad7c

View file

@ -113,12 +113,12 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
configuration.ProcessorWeight = uint64(*spec.Windows.Resources.CPU.Shares) configuration.ProcessorWeight = uint64(*spec.Windows.Resources.CPU.Shares)
} }
if spec.Windows.Resources.CPU.Percent != nil { if spec.Windows.Resources.CPU.Percent != nil {
configuration.ProcessorMaximum = int64(*spec.Windows.Resources.CPU.Percent * 100) // ProcessorMaximum is a value between 1 and 10000 configuration.ProcessorMaximum = int64(*spec.Windows.Resources.CPU.Percent) * 100 // ProcessorMaximum is a value between 1 and 10000
} }
} }
if spec.Windows.Resources.Memory != nil { if spec.Windows.Resources.Memory != nil {
if spec.Windows.Resources.Memory.Limit != nil { if spec.Windows.Resources.Memory.Limit != nil {
configuration.MemoryMaximumInMB = int64(*spec.Windows.Resources.Memory.Limit / 1024 / 1024) configuration.MemoryMaximumInMB = int64(*spec.Windows.Resources.Memory.Limit) / 1024 / 1024
} }
} }
if spec.Windows.Resources.Storage != nil { if spec.Windows.Resources.Storage != nil {