Skip to content

Commit

Permalink
blkiodev: limit blkio device's read/write Bps/IOps
Browse files Browse the repository at this point in the history
fixes AliyunContainerService#2509

Signed-off-by: Leno Hou <lenohou@gmail.com>
  • Loading branch information
houstar committed Dec 14, 2018
1 parent 6dbedc4 commit 4666332
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cli/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func (uc *UpdateCommand) addFlags() {
flagSet.StringSliceVarP(&uc.labels, "label", "l", nil, "Set label for container")
flagSet.StringVar(&uc.restartPolicy, "restart", "", "Restart policy to apply when container exits")
flagSet.StringSliceVar(&uc.diskQuota, "disk-quota", nil, "Update disk quota for container(/=10g)")
flagSet.Var(&uc.blkioDeviceReadBps, "device-read-bps", "Limit read rate (bytes per second) from a device")
flagSet.Var(&uc.blkioDeviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) from a device")
flagSet.Var(&uc.blkioDeviceReadIOps, "device-read-iops", "Limit read rate (bytes per second) from a device")
flagSet.Var(&uc.blkioDeviceWriteIOps, "device-write-iops", "Limit write rate (bytes per second) from a device")
}

// updateRun is the entry of update command.
Expand Down Expand Up @@ -83,6 +87,10 @@ func (uc *UpdateCommand) updateRun(args []string) error {
Memory: memory,
MemorySwap: memorySwap,
BlkioWeight: uc.blkioWeight,
BlkioDeviceReadBps: uc.blkioDeviceReadBps.Value(),
BlkioDeviceWriteBps: uc.blkioDeviceWriteBps.Value(),
BlkioDeviceReadIOps: uc.blkioDeviceReadIOps.Value(),
BlkioDeviceWriteIOps: uc.blkioDeviceWriteIOps.Value(),
}

restartPolicy, err := opts.ParseRestartPolicy(uc.restartPolicy)
Expand Down

0 comments on commit 4666332

Please sign in to comment.