From 6e0a9373cd76d42f6a9dfcd569ddb526a574545e Mon Sep 17 00:00:00 2001 From: Allen Sun Date: Tue, 19 Jun 2018 13:14:47 +0800 Subject: [PATCH] fix: rename cpu-share to cpu-shares in command line Signed-off-by: Allen Sun --- cli/common_flags.go | 2 +- cli/update.go | 2 +- daemon/mgr/container_utils.go | 2 +- test/cli_restart_test.go | 3 +-- test/cli_run_cpu_test.go | 2 +- test/cli_update_test.go | 4 ++-- test/cli_upgrade_test.go | 4 ++-- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cli/common_flags.go b/cli/common_flags.go index 5aab5f008..52cb32e25 100644 --- a/cli/common_flags.go +++ b/cli/common_flags.go @@ -21,7 +21,7 @@ func addCommonFlags(flagSet *pflag.FlagSet) *container { flagSet.StringSliceVar(&c.capDrop, "cap-drop", nil, "Drop Linux capabilities") // cpu - flagSet.Int64Var(&c.cpushare, "cpu-share", 0, "CPU shares (relative weight)") + flagSet.Int64Var(&c.cpushare, "cpu-shares", 0, "CPU shares (relative weight)") flagSet.StringVar(&c.cpusetcpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)") flagSet.StringVar(&c.cpusetmems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)") flagSet.Int64Var(&c.cpuperiod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period, range is in [1000(1ms),1000000(1s)]") diff --git a/cli/update.go b/cli/update.go index 8f5a1de57..a19103a8c 100644 --- a/cli/update.go +++ b/cli/update.go @@ -43,7 +43,7 @@ func (uc *UpdateCommand) addFlags() { flagSet.SetInterspersed(false) flagSet.Uint16Var(&uc.blkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000, or 0 to disable") flagSet.Int64Var(&uc.cpuperiod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period, range is in [1000(1ms),1000000(1s)]") - flagSet.Int64Var(&uc.cpushare, "cpu-share", 0, "CPU shares (relative weight)") + flagSet.Int64Var(&uc.cpushare, "cpu-shares", 0, "CPU shares (relative weight)") flagSet.Int64Var(&uc.cpuquota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota") flagSet.StringVar(&uc.cpusetcpus, "cpuset-cpus", "", "CPUs in cpuset") flagSet.StringVar(&uc.cpusetmems, "cpuset-mems", "", "MEMs in cpuset") diff --git a/daemon/mgr/container_utils.go b/daemon/mgr/container_utils.go index 2370eebc8..d6671ca80 100644 --- a/daemon/mgr/container_utils.go +++ b/daemon/mgr/container_utils.go @@ -296,7 +296,7 @@ func validateResource(r *types.Resources) ([]string, error) { r.CpusetMems = "" } if r.CPUShares > 0 && !cgroupInfo.CPU.CPUShares { - warn := "Current Kernel does not support cpu shares, discard --cpu-share" + warn := "Current Kernel does not support cpu shares, discard --cpu-shares" logrus.Warn(warn) warnings = append(warnings, warn) r.CPUShares = 0 diff --git a/test/cli_restart_test.go b/test/cli_restart_test.go index cc9b38ce0..a2ab77ec5 100644 --- a/test/cli_restart_test.go +++ b/test/cli_restart_test.go @@ -76,8 +76,7 @@ func (suite *PouchRestartSuite) TestPouchRestartPausedContainer(c *check.C) { func (suite *PouchRestartSuite) TestPouchRestartMultiContainers(c *check.C) { containernames := []string{"TestPouchRestartMultiContainer-1", "TestPouchRestartMultiContainer-2"} for _, name := range containernames { - res := command.PouchRun("run", "-d", - "--name", name, busyboxImage, "top") + res := command.PouchRun("run", "-d", "--name", name, busyboxImage, "top") defer DelContainerForceMultyTime(c, name) res.Assert(c, icmd.Success) } diff --git a/test/cli_run_cpu_test.go b/test/cli_run_cpu_test.go index 14b7aaae5..2b8768b52 100644 --- a/test/cli_run_cpu_test.go +++ b/test/cli_run_cpu_test.go @@ -38,7 +38,7 @@ func (suite *PouchRunCPUSuite) TestRunWithCPULimit(c *check.C) { res := command.PouchRun("run", "-d", "--cpuset-cpus", "0", "--cpuset-mems", "0", - "--cpu-share", "1000", + "--cpu-shares", "1000", "--cpu-period", "1000", "--cpu-quota", "1000", "--name", cname, diff --git a/test/cli_update_test.go b/test/cli_update_test.go index 48c8015c1..1723c3b20 100644 --- a/test/cli_update_test.go +++ b/test/cli_update_test.go @@ -39,7 +39,7 @@ func (suite *PouchUpdateSuite) TearDownTest(c *check.C) { func (suite *PouchUpdateSuite) TestUpdateCpu(c *check.C) { name := "update-container-cpu" - res := command.PouchRun("run", "-d", "--cpu-share", "20", "--name", name, busyboxImage, "top") + res := command.PouchRun("run", "-d", "--cpu-shares", "20", "--name", name, busyboxImage, "top") defer DelContainerForceMultyTime(c, name) res.Assert(c, icmd.Success) @@ -55,7 +55,7 @@ func (suite *PouchUpdateSuite) TestUpdateCpu(c *check.C) { c.Fatalf("container %s cgroup mountpoint not exists", containerID) } - command.PouchRun("update", "--cpu-share", "40", name).Assert(c, icmd.Success) + command.PouchRun("update", "--cpu-shares", "40", name).Assert(c, icmd.Success) out, err := exec.Command("cat", file).Output() if err != nil { diff --git a/test/cli_upgrade_test.go b/test/cli_upgrade_test.go index 42b2c299b..b8ee69acd 100644 --- a/test/cli_upgrade_test.go +++ b/test/cli_upgrade_test.go @@ -93,12 +93,12 @@ func (suite *PouchUpgradeSuite) TestPouchUpgradeContainerMemCpu(c *check.C) { name := "TestPouchUpgradeContainerMemCpu" res := command.PouchRun("run", "-d", "-m", "300m", - "--cpu-share", "20", "--name", name, busyboxImage, "top") + "--cpu-shares", "20", "--name", name, busyboxImage, "top") defer DelContainerForceMultyTime(c, name) res.Assert(c, icmd.Success) command.PouchRun("upgrade", "-m", "500m", - "--cpu-share", "40", "--name", name, busyboxImage125).Assert(c, icmd.Success) + "--cpu-shares", "40", "--name", name, busyboxImage125).Assert(c, icmd.Success) output := command.PouchRun("inspect", name).Stdout() result := []types.ContainerJSON{}