Fix golint warning on pkg/sysinfo
Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
parent
8cd8bc1365
commit
001fc3cf5f
4 changed files with 41 additions and 21 deletions
|
@ -14,14 +14,14 @@ import (
|
|||
func New(quiet bool) *SysInfo {
|
||||
sysInfo := &SysInfo{}
|
||||
sysInfo.cgroupMemInfo = checkCgroupMem(quiet)
|
||||
sysInfo.cgroupCpuInfo = checkCgroupCpu(quiet)
|
||||
sysInfo.cgroupCPUInfo = checkCgroupCPU(quiet)
|
||||
|
||||
_, err := cgroups.FindCgroupMountpoint("devices")
|
||||
sysInfo.CgroupDevicesEnabled = err == nil
|
||||
|
||||
sysInfo.IPv4ForwardingDisabled = !readProcBool("/proc/sys/net/ipv4/ip_forward")
|
||||
sysInfo.BridgeNfCallIptablesDisabled = !readProcBool("/proc/sys/net/bridge/bridge-nf-call-iptables")
|
||||
sysInfo.BridgeNfCallIp6tablesDisabled = !readProcBool("/proc/sys/net/bridge/bridge-nf-call-ip6tables")
|
||||
sysInfo.BridgeNfCallIP6tablesDisabled = !readProcBool("/proc/sys/net/bridge/bridge-nf-call-ip6tables")
|
||||
|
||||
// Check if AppArmor is supported.
|
||||
if _, err := os.Stat("/sys/kernel/security/apparmor"); !os.IsNotExist(err) {
|
||||
|
@ -58,8 +58,8 @@ func checkCgroupMem(quiet bool) *cgroupMemInfo {
|
|||
return info
|
||||
}
|
||||
|
||||
func checkCgroupCpu(quiet bool) *cgroupCpuInfo {
|
||||
info := &cgroupCpuInfo{}
|
||||
func checkCgroupCPU(quiet bool) *cgroupCPUInfo {
|
||||
info := &cgroupCPUInfo{}
|
||||
mountPoint, err := cgroups.FindCgroupMountpoint("cpu")
|
||||
if err != nil {
|
||||
if !quiet {
|
||||
|
@ -68,13 +68,13 @@ func checkCgroupCpu(quiet bool) *cgroupCpuInfo {
|
|||
return info
|
||||
}
|
||||
|
||||
info.CpuCfsPeriod = cgroupEnabled(mountPoint, "cpu.cfs_period_us")
|
||||
if !quiet && !info.CpuCfsPeriod {
|
||||
info.CPUCfsPeriod = cgroupEnabled(mountPoint, "cpu.cfs_period_us")
|
||||
if !quiet && !info.CPUCfsPeriod {
|
||||
logrus.Warn("Your kernel does not support cgroup cfs period")
|
||||
}
|
||||
|
||||
info.CpuCfsQuota = cgroupEnabled(mountPoint, "cpu.cfs_quota_us")
|
||||
if !quiet && !info.CpuCfsQuota {
|
||||
info.CPUCfsQuota = cgroupEnabled(mountPoint, "cpu.cfs_quota_us")
|
||||
if !quiet && !info.CPUCfsQuota {
|
||||
logrus.Warn("Your kernel does not support cgroup cfs quotas")
|
||||
}
|
||||
return info
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue