Add support for blkio.weight_device

Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
This commit is contained in:
Ma Shimiao 2015-06-12 08:34:20 +08:00 committed by Tibor Vass
parent d6bac18914
commit e303d6cc9f
7 changed files with 41 additions and 2 deletions

View File

@ -1355,6 +1355,7 @@ _docker_run() {
--add-host --add-host
--attach -a --attach -a
--blkio-weight --blkio-weight
--blkio-weight-device
--cap-add --cap-add
--cap-drop --cap-drop
--cgroup-parent --cgroup-parent

View File

@ -418,6 +418,7 @@ __docker_subcommand() {
"($help -a --attach)"{-a=,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)" "($help -a --attach)"{-a=,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)"
"($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: "
"($help)--blkio-weight=[Block IO (relative weight), between 10 and 1000]:Block IO weight:(10 100 500 1000)" "($help)--blkio-weight=[Block IO (relative weight), between 10 and 1000]:Block IO weight:(10 100 500 1000)"
"($help)--blkio-weight-device=-[Block IO (relative device weight)]:device:Block IO weight: "
"($help)*--cap-add=[Add Linux capabilities]:capability: " "($help)*--cap-add=[Add Linux capabilities]:capability: "
"($help)*--cap-drop=[Drop Linux capabilities]:capability: " "($help)*--cap-drop=[Drop Linux capabilities]:capability: "
"($help)--cidfile=[Write the container ID to the file]:CID file:_files" "($help)--cidfile=[Write the container ID to the file]:CID file:_files"

View File

@ -19,6 +19,7 @@ Creates a new container.
-a, --attach=[] Attach to STDIN, STDOUT or STDERR -a, --attach=[] Attach to STDIN, STDOUT or STDERR
--add-host=[] Add a custom host-to-IP mapping (host:ip) --add-host=[] Add a custom host-to-IP mapping (host:ip)
--blkio-weight=0 Block IO weight (relative weight) --blkio-weight=0 Block IO weight (relative weight)
--blkio-weight-device="" Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`)
--cpu-shares=0 CPU shares (relative weight) --cpu-shares=0 CPU shares (relative weight)
--cap-add=[] Add Linux capabilities --cap-add=[] Add Linux capabilities
--cap-drop=[] Drop Linux capabilities --cap-drop=[] Drop Linux capabilities

View File

@ -17,6 +17,7 @@ parent = "smn_cli"
-a, --attach=[] Attach to STDIN, STDOUT or STDERR -a, --attach=[] Attach to STDIN, STDOUT or STDERR
--add-host=[] Add a custom host-to-IP mapping (host:ip) --add-host=[] Add a custom host-to-IP mapping (host:ip)
--blkio-weight=0 Block IO weight (relative weight) --blkio-weight=0 Block IO weight (relative weight)
--blkio-weight-device="" Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`)
--cpu-shares=0 CPU shares (relative weight) --cpu-shares=0 CPU shares (relative weight)
--cap-add=[] Add Linux capabilities --cap-add=[] Add Linux capabilities
--cap-drop=[] Drop Linux capabilities --cap-drop=[] Drop Linux capabilities

View File

@ -623,6 +623,7 @@ container:
| `--cpuset-mems=""` | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. | | `--cpuset-mems=""` | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. |
| `--cpu-quota=0` | Limit the CPU CFS (Completely Fair Scheduler) quota | | `--cpu-quota=0` | Limit the CPU CFS (Completely Fair Scheduler) quota |
| `--blkio-weight=0` | Block IO weight (relative weight) accepts a weight value between 10 and 1000. | | `--blkio-weight=0` | Block IO weight (relative weight) accepts a weight value between 10 and 1000. |
| `--blkio-weight-device=""` | Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`) |
| `--oom-kill-disable=false` | Whether to disable OOM Killer for the container or not. | | `--oom-kill-disable=false` | Whether to disable OOM Killer for the container or not. |
| `--memory-swappiness="" ` | Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. | | `--memory-swappiness="" ` | Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. |
@ -937,6 +938,9 @@ By default, all containers get the same proportion of block IO bandwidth
container's blkio weight relative to the weighting of all other running container's blkio weight relative to the weighting of all other running
containers using the `--blkio-weight` flag. containers using the `--blkio-weight` flag.
> **Note:** The blkio weight setting is only available for direct IO. Buffered IO
> is not currently supported.
The `--blkio-weight` flag can set the weighting to a value between 10 to 1000. The `--blkio-weight` flag can set the weighting to a value between 10 to 1000.
For example, the commands below create two containers with different blkio For example, the commands below create two containers with different blkio
weight: weight:
@ -951,8 +955,24 @@ If you do block IO in the two containers at the same time, by, for example:
You'll find that the proportion of time is the same as the proportion of blkio You'll find that the proportion of time is the same as the proportion of blkio
weights of the two containers. weights of the two containers.
> **Note:** The blkio weight setting is only available for direct IO. Buffered IO The `--blkio-weight-device="DEVICE_NAME:WEIGHT"` flag sets a specific device weight.
> is not currently supported. The `DEVICE_NAME:WEIGHT` is a string containing a colon-separated device name and weight.
For example, to set `/dev/sda` device weight to `200`:
$ docker run -it \
--blkio-weight-device "/dev/sda:200" \
ubuntu
If you specify both the `--blkio-weight` and `--blkio-weight-device`, Docker
uses the `--blkio-weight` as the default weight and uses `--blkio-weight-device`
to override this default with a new value on a specific device.
The following example uses a default weight of `300` and overrides this default
on `/dev/sda` setting that weight to `200`:
$ docker run -it \
--blkio-weight 300 \
--blkio-weight-device "/dev/sda:200" \
ubuntu
## Additional groups ## Additional groups
--group-add: Add Linux capabilities --group-add: Add Linux capabilities

View File

@ -9,6 +9,7 @@ docker-create - Create a new container
[**-a**|**--attach**[=*[]*]] [**-a**|**--attach**[=*[]*]]
[**--add-host**[=*[]*]] [**--add-host**[=*[]*]]
[**--blkio-weight**[=*[BLKIO-WEIGHT]*]] [**--blkio-weight**[=*[BLKIO-WEIGHT]*]]
[**--blkio-weight-device**[=*[]*]]
[**--cpu-shares**[=*0*]] [**--cpu-shares**[=*0*]]
[**--cap-add**[=*[]*]] [**--cap-add**[=*[]*]]
[**--cap-drop**[=*[]*]] [**--cap-drop**[=*[]*]]
@ -82,6 +83,9 @@ The initial status of the container created with **docker create** is 'created'.
**--blkio-weight**=*0* **--blkio-weight**=*0*
Block IO weight (relative weight) accepts a weight value between 10 and 1000. Block IO weight (relative weight) accepts a weight value between 10 and 1000.
**--blkio-weight-device**=[]
Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`).
**--cpu-shares**=*0* **--cpu-shares**=*0*
CPU shares (relative weight) CPU shares (relative weight)

View File

@ -9,6 +9,7 @@ docker-run - Run a command in a new container
[**-a**|**--attach**[=*[]*]] [**-a**|**--attach**[=*[]*]]
[**--add-host**[=*[]*]] [**--add-host**[=*[]*]]
[**--blkio-weight**[=*[BLKIO-WEIGHT]*]] [**--blkio-weight**[=*[BLKIO-WEIGHT]*]]
[**--blkio-weight-device**[=*[]*]]
[**--cpu-shares**[=*0*]] [**--cpu-shares**[=*0*]]
[**--cap-add**[=*[]*]] [**--cap-add**[=*[]*]]
[**--cap-drop**[=*[]*]] [**--cap-drop**[=*[]*]]
@ -99,6 +100,9 @@ option can be set multiple times.
**--blkio-weight**=*0* **--blkio-weight**=*0*
Block IO weight (relative weight) accepts a weight value between 10 and 1000. Block IO weight (relative weight) accepts a weight value between 10 and 1000.
**--blkio-weight-device**=[]
Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`).
**--cpu-shares**=*0* **--cpu-shares**=*0*
CPU shares (relative weight) CPU shares (relative weight)
@ -755,6 +759,13 @@ Note:
You would have to write policy defining a `svirt_apache_t` type. You would have to write policy defining a `svirt_apache_t` type.
## Setting device weight
If you want to set `/dev/sda` device weight to `200`, you can specify the device
weight by `--blkio-weight-device` flag. Use the following command:
# docker run -it --blkio-weight-device "/dev/sda:200" ubuntu
# HISTORY # HISTORY
April 2014, Originally compiled by William Henry (whenry at redhat dot com) April 2014, Originally compiled by William Henry (whenry at redhat dot com)
based on docker.com source material and internal work. based on docker.com source material and internal work.