Skip to content

Commit 1adfb78

Browse files
authored
Merge pull request #1381 from Ace-Tang/doc_blkio
cli: add instruction for blkio-weight-device
2 parents 15aec73 + 16a2ed6 commit 1adfb78

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

apis/swagger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,7 @@ definitions:
21662166
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."
21672167
type: "string"
21682168
BlkioWeight:
2169-
description: "Block IO weight (relative weight)."
2169+
description: "Block IO weight (relative weight), need CFQ IO Scheduler enable."
21702170
type: "integer"
21712171
format: "uint16"
21722172
x-nullable: false

apis/types/resources.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/common_flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func addCommonFlags(flagSet *pflag.FlagSet) *container {
1010
// please add the following flag by name in alphabetical order
1111
// blkio
1212
flagSet.Uint16Var(&c.blkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000, or 0 to disable")
13-
flagSet.Var(&c.blkioWeightDevice, "blkio-weight-device", "Block IO weight (relative device weight)")
13+
flagSet.Var(&c.blkioWeightDevice, "blkio-weight-device", "Block IO weight (relative device weight), need CFQ IO Scheduler enable")
1414
flagSet.Var(&c.blkioDeviceReadBps, "device-read-bps", "Limit read rate (bytes per second) from a device")
1515
flagSet.Var(&c.blkioDeviceReadIOps, "device-read-iops", "Limit read rate (IO per second) from a device")
1616
flagSet.Var(&c.blkioDeviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) from a device")

test/cli_run_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"encoding/json"
55
"fmt"
6+
"io/ioutil"
67
"os"
78
"os/exec"
89
"runtime"
@@ -577,6 +578,14 @@ func (suite *PouchRunSuite) TestRunBlockIOWeightDevice(c *check.C) {
577578
c.Skip("fail to find available disk for blkio test")
578579
}
579580

581+
SkipIfFalse(c, func() bool {
582+
file := fmt.Sprintf("/sys/block/%s/queue/scheduler", strings.Trim(testDisk, "/dev/"))
583+
if data, err := ioutil.ReadFile(file); err == nil {
584+
return strings.Contains(string(data), "[cfq]")
585+
}
586+
return false
587+
})
588+
580589
command.PouchRun("run", "-d", "--blkio-weight-device", testDisk+":100",
581590
"--name", cname, busyboxImage, "sleep", "10000").Stdout()
582591
defer DelContainerForceMultyTime(c, cname)

0 commit comments

Comments
 (0)