Validate --cpuset-cpus, --cpuset-mems
Before this patch libcontainer badly errored out with `invalid argument` or `numerical result out of range` while trying to write to cpuset.cpus or cpuset.mems with an invalid value provided. This patch adds validation to --cpuset-cpus and --cpuset-mems flag along with validation based on system's available cpus/mems before starting a container. Signed-off-by: Antonio Murdaca <runcom@linux.com> Upstream-commit: 94464e3a5e1dce0f6b3e821f79fe193278f67dba Component: engine
This commit is contained in:
@@ -3407,3 +3407,17 @@ func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *check.C) {
|
||||
c.Fatal("timeout waiting for command to exit")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWrongCpusetCpusFlagValue(c *check.C) {
|
||||
out, _, err := dockerCmdWithError("run", "--cpuset-cpus", "1-10,11--", "busybox", "true")
|
||||
c.Assert(err, check.NotNil)
|
||||
expected := "Error response from daemon: Invalid value 1-10,11-- for cpuset cpus.\n"
|
||||
c.Assert(out, check.Equals, expected, check.Commentf("Expected output to contain %q, got %q", expected, out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWrongCpusetMemsFlagValue(c *check.C) {
|
||||
out, _, err := dockerCmdWithError("run", "--cpuset-mems", "1-42--", "busybox", "true")
|
||||
c.Assert(err, check.NotNil)
|
||||
expected := "Error response from daemon: Invalid value 1-42-- for cpuset mems.\n"
|
||||
c.Assert(out, check.Equals, expected, check.Commentf("Expected output to contain %q, got %q", expected, out))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user