mirror of
https://github.com/moby/moby.git
synced 2025-12-06 07:41:18 +03:00
Fix error messages for --cpus from daemon
This fix fixes error messages for `--cpus` from daemon. When `docker run` takes `--cpus`, it will translate into NanoCPUs and pass the value to daemon. The `NanoCPU` is not visible to the user. The error message generated from daemon used 'NanoCPU' which may cause some confusion to the user. This fix fixes this issue by returning the error in CPUs instead. This fix fixes 28456. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@@ -1577,7 +1577,7 @@ func (s *DockerSuite) TestRunWithNanoCPUs(c *check.C) {
|
||||
file1 := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
|
||||
file2 := "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
|
||||
out, _ := dockerCmd(c, "run", "--cpus", "0.5", "--name", "test", "busybox", "sh", "-c", fmt.Sprintf("cat %s && cat %s", file1, file2))
|
||||
c.Assert(strings.TrimSpace(out), checker.Equals, "50000\n100000")
|
||||
c.Assert(strings.TrimSpace(out), checker.Equals, "500000\n1000000")
|
||||
|
||||
out = inspectField(c, "test", "HostConfig.NanoCpus")
|
||||
c.Assert(out, checker.Equals, "5e+08", check.Commentf("setting the Nano CPUs failed"))
|
||||
|
||||
Reference in New Issue
Block a user