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 3100d86 commit 1bad528
Show file tree
Hide file tree
Showing 7 changed files with 10 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.StringVar(&uc.cpusetcpus, "cpuset-cpus", "", "CPUs in cpuset")
flagSet.StringVar(&uc.cpusetmems, "cpuset-mems", "", "MEMs in cpuset")
flagSet.StringVarP(&uc.memory, "memory", "m", "", "Container memory limit")
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
4 changes: 2 additions & 2 deletions test/cli_restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (suite *PouchRestartSuite) TearDownTest(c *check.C) {
func (suite *PouchRestartSuite) TestPouchRestart(c *check.C) {
name := "TestPouchRestart"

res := command.PouchRun("run", "-d", "--cpu-share", "20", "--name", name, busyboxImage)
res := command.PouchRun("run", "-d", "--cpu-shares", "20", "--name", name, busyboxImage)
defer DelContainerForceMultyTime(c, name)
res.Assert(c, icmd.Success)

Expand Down Expand Up @@ -76,7 +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", "--cpu-share", "20", "--name", name, busyboxImage)
res := command.PouchRun("run", "-d", "--cpu-shares", "20", "--name", name, busyboxImage)
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 @@ -92,11 +92,11 @@ func (suite *PouchUpgradeSuite) TestPouchUpgradeStoppedContainer(c *check.C) {
func (suite *PouchUpgradeSuite) TestPouchUpgradeContainerMemCpu(c *check.C) {
name := "TestPouchUpgradeContainerMemCpu"

res := command.PouchRun("run", "-d", "-m", "300m", "--cpu-share", "20", "--name", name, busyboxImage, "top")
res := command.PouchRun("run", "-d", "-m", "300m", "--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)
command.PouchRun("upgrade", "-m", "500m", "--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 1bad528

Please sign in to comment.