Add support cpu cfs quota
Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
parent
b140321e2e
commit
f28ded09c3
1 changed files with 14 additions and 0 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
type SysInfo struct {
|
||||
MemoryLimit bool
|
||||
SwapLimit bool
|
||||
CpuCfsQuota bool
|
||||
IPv4ForwardingDisabled bool
|
||||
AppArmor bool
|
||||
}
|
||||
|
@ -39,6 +40,19 @@ func New(quiet bool) *SysInfo {
|
|||
}
|
||||
}
|
||||
|
||||
if cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu"); err != nil {
|
||||
if !quiet {
|
||||
logrus.Warnf("WARING: %s\n", err)
|
||||
}
|
||||
} else {
|
||||
_, err1 := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_quota_us"))
|
||||
logrus.Warnf("%s", cgroupCpuMountpoint)
|
||||
sysInfo.CpuCfsQuota = err1 == nil
|
||||
if !sysInfo.CpuCfsQuota && !quiet {
|
||||
logrus.Warnf("WARING: Your kernel does not support cgroup cfs quotas")
|
||||
}
|
||||
}
|
||||
|
||||
// Check if AppArmor is supported.
|
||||
if _, err := os.Stat("/sys/kernel/security/apparmor"); os.IsNotExist(err) {
|
||||
sysInfo.AppArmor = false
|
||||
|
|
Loading…
Reference in a new issue