Merge pull request #13959 from Mashimiao/add-support-blkio_weight_device
Add support for blkio.weight_device
This commit is contained in:
commit
6f501fd1ea
3 changed files with 29 additions and 3 deletions
15
blkiodev/blkiodev.go
Normal file
15
blkiodev/blkiodev.go
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package blkiodev
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// WeightDevice is a structure that hold device:weight pair
|
||||||
|
type WeightDevice struct {
|
||||||
|
Path string
|
||||||
|
Weight uint16
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WeightDevice) String() string {
|
||||||
|
return fmt.Sprintf("%s:%d", w.Path, w.Weight)
|
||||||
|
}
|
|
@ -60,6 +60,9 @@ type cgroupCPUInfo struct {
|
||||||
type cgroupBlkioInfo struct {
|
type cgroupBlkioInfo struct {
|
||||||
// Whether Block IO weight is supported or not
|
// Whether Block IO weight is supported or not
|
||||||
BlkioWeight bool
|
BlkioWeight bool
|
||||||
|
|
||||||
|
// Whether Block IO weight_device is supported or not
|
||||||
|
BlkioWeightDevice bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type cgroupCpusetInfo struct {
|
type cgroupCpusetInfo struct {
|
||||||
|
|
|
@ -117,11 +117,19 @@ func checkCgroupBlkioInfo(quiet bool) cgroupBlkioInfo {
|
||||||
return cgroupBlkioInfo{}
|
return cgroupBlkioInfo{}
|
||||||
}
|
}
|
||||||
|
|
||||||
w := cgroupEnabled(mountPoint, "blkio.weight")
|
weight := cgroupEnabled(mountPoint, "blkio.weight")
|
||||||
if !quiet && !w {
|
if !quiet && !weight {
|
||||||
logrus.Warn("Your kernel does not support cgroup blkio weight")
|
logrus.Warn("Your kernel does not support cgroup blkio weight")
|
||||||
}
|
}
|
||||||
return cgroupBlkioInfo{BlkioWeight: w}
|
|
||||||
|
weightDevice := cgroupEnabled(mountPoint, "blkio.weight_device")
|
||||||
|
if !quiet && !weightDevice {
|
||||||
|
logrus.Warn("Your kernel does not support cgroup blkio weight_device")
|
||||||
|
}
|
||||||
|
return cgroupBlkioInfo{
|
||||||
|
BlkioWeight: weight,
|
||||||
|
BlkioWeightDevice: weightDevice,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkCgroupCpusetInfo reads the cpuset information from the cpuset cgroup mount point.
|
// checkCgroupCpusetInfo reads the cpuset information from the cpuset cgroup mount point.
|
||||||
|
|
Loading…
Reference in a new issue