Merge pull request #14466 from Mashimiao/add-support-blkio_throtte_bps
Add support for blkio read/write bps device
This commit is contained in:
commit
92079d14e1
3 changed files with 30 additions and 2 deletions
|
@ -13,3 +13,13 @@ type WeightDevice struct {
|
||||||
func (w *WeightDevice) String() string {
|
func (w *WeightDevice) String() string {
|
||||||
return fmt.Sprintf("%s:%d", w.Path, w.Weight)
|
return fmt.Sprintf("%s:%d", w.Path, w.Weight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ThrottleDevice is a structure that hold device:rate_per_second pair
|
||||||
|
type ThrottleDevice struct {
|
||||||
|
Path string
|
||||||
|
Rate uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *ThrottleDevice) String() string {
|
||||||
|
return fmt.Sprintf("%s:%d", t.Path, t.Rate)
|
||||||
|
}
|
||||||
|
|
|
@ -63,6 +63,12 @@ type cgroupBlkioInfo struct {
|
||||||
|
|
||||||
// Whether Block IO weight_device is supported or not
|
// Whether Block IO weight_device is supported or not
|
||||||
BlkioWeightDevice bool
|
BlkioWeightDevice bool
|
||||||
|
|
||||||
|
// Whether Block IO read limit in bytes per second is supported or not
|
||||||
|
BlkioReadBpsDevice bool
|
||||||
|
|
||||||
|
// Whether Block IO write limit in bytes per second is supported or not
|
||||||
|
BlkioWriteBpsDevice bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type cgroupCpusetInfo struct {
|
type cgroupCpusetInfo struct {
|
||||||
|
|
|
@ -126,9 +126,21 @@ func checkCgroupBlkioInfo(quiet bool) cgroupBlkioInfo {
|
||||||
if !quiet && !weightDevice {
|
if !quiet && !weightDevice {
|
||||||
logrus.Warn("Your kernel does not support cgroup blkio weight_device")
|
logrus.Warn("Your kernel does not support cgroup blkio weight_device")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readBpsDevice := cgroupEnabled(mountPoint, "blkio.throttle.read_bps_device")
|
||||||
|
if !quiet && !readBpsDevice {
|
||||||
|
logrus.Warn("Your kernel does not support cgroup blkio throttle.read_bps_device")
|
||||||
|
}
|
||||||
|
|
||||||
|
writeBpsDevice := cgroupEnabled(mountPoint, "blkio.throttle.write_bps_device")
|
||||||
|
if !quiet && !writeBpsDevice {
|
||||||
|
logrus.Warn("Your kernel does not support cgroup blkio throttle.write_bps_device")
|
||||||
|
}
|
||||||
return cgroupBlkioInfo{
|
return cgroupBlkioInfo{
|
||||||
BlkioWeight: weight,
|
BlkioWeight: weight,
|
||||||
BlkioWeightDevice: weightDevice,
|
BlkioWeightDevice: weightDevice,
|
||||||
|
BlkioReadBpsDevice: readBpsDevice,
|
||||||
|
BlkioWriteBpsDevice: writeBpsDevice,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue