Skip to content
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 apis/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,7 @@ definitions:
description: "Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist."
type: "string"
BlkioWeight:
description: "Block IO weight (relative weight)."
description: "Block IO weight (relative weight), need CFQ IO Scheduler enable."
type: "integer"
format: "uint16"
x-nullable: false
Expand Down
2 changes: 1 addition & 1 deletion apis/types/resources.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/common_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func addCommonFlags(flagSet *pflag.FlagSet) *container {
// please add the following flag by name in alphabetical order
// blkio
flagSet.Uint16Var(&c.blkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000, or 0 to disable")
flagSet.Var(&c.blkioWeightDevice, "blkio-weight-device", "Block IO weight (relative device weight)")
flagSet.Var(&c.blkioWeightDevice, "blkio-weight-device", "Block IO weight (relative device weight), need CFQ IO Scheduler enable")
flagSet.Var(&c.blkioDeviceReadBps, "device-read-bps", "Limit read rate (bytes per second) from a device")
flagSet.Var(&c.blkioDeviceReadIOps, "device-read-iops", "Limit read rate (IO per second) from a device")
flagSet.Var(&c.blkioDeviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) from a device")
Expand Down
9 changes: 9 additions & 0 deletions test/cli_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"runtime"
Expand Down Expand Up @@ -577,6 +578,14 @@ func (suite *PouchRunSuite) TestRunBlockIOWeightDevice(c *check.C) {
c.Skip("fail to find available disk for blkio test")
}

SkipIfFalse(c, func() bool {
file := fmt.Sprintf("/sys/block/%s/queue/scheduler", strings.Trim(testDisk, "/dev/"))
if data, err := ioutil.ReadFile(file); err == nil {
return strings.Contains(string(data), "[cfq]")
}
return false
})

command.PouchRun("run", "-d", "--blkio-weight-device", testDisk+":100",
"--name", cname, busyboxImage, "sleep", "10000").Stdout()
defer DelContainerForceMultyTime(c, cname)
Expand Down