Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename cpu-share to cpu-shares in command line #1547

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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