Skip to content

Commit

Permalink
fix: rename cpu-share to cpu-shares in command line
Browse files Browse the repository at this point in the history
Signed-off-by: Allen Sun <[email protected]>
  • Loading branch information
allencloud committed Jun 19, 2018
1 parent 9337b3b commit 6e0a937
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cli/common_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)]")
Expand Down
2 changes: 1 addition & 1 deletion cli/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion daemon/mgr/container_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions test/cli_restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion test/cli_run_cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions test/cli_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions test/cli_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 6e0a937

Please sign in to comment.