2015-05-29 14:22:21 -04:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-08-23 23:37:11 -04:00
|
|
|
"github.com/docker/docker/pkg/sysinfo"
|
2015-05-29 14:22:21 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2015-08-23 23:37:11 -04:00
|
|
|
// SysInfo stores information about which features a kernel supports.
|
|
|
|
SysInfo *sysinfo.SysInfo
|
2015-07-22 08:59:24 -04:00
|
|
|
cpuCfsPeriod = testRequirement{
|
2015-05-29 14:22:21 -04:00
|
|
|
func() bool {
|
2015-08-23 23:37:11 -04:00
|
|
|
return SysInfo.CPUCfsPeriod
|
2015-05-29 14:22:21 -04:00
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup cfs period.",
|
|
|
|
}
|
2015-07-22 08:59:24 -04:00
|
|
|
cpuCfsQuota = testRequirement{
|
2015-05-29 14:22:21 -04:00
|
|
|
func() bool {
|
2015-08-23 23:37:11 -04:00
|
|
|
return SysInfo.CPUCfsQuota
|
2015-05-29 14:22:21 -04:00
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup cfs quota.",
|
|
|
|
}
|
2015-08-23 23:37:11 -04:00
|
|
|
cpuShare = testRequirement{
|
|
|
|
func() bool {
|
|
|
|
return SysInfo.CPUShares
|
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup cpu shares.",
|
|
|
|
}
|
2015-07-22 08:59:24 -04:00
|
|
|
oomControl = testRequirement{
|
2015-07-08 16:30:03 -04:00
|
|
|
func() bool {
|
2015-08-23 23:37:11 -04:00
|
|
|
return SysInfo.OomKillDisable
|
2015-07-08 16:30:03 -04:00
|
|
|
},
|
|
|
|
"Test requires Oom control enabled.",
|
|
|
|
}
|
2015-08-19 11:56:55 -04:00
|
|
|
kernelMemorySupport = testRequirement{
|
|
|
|
func() bool {
|
2015-08-23 23:37:11 -04:00
|
|
|
return SysInfo.KernelMemory
|
2015-08-19 11:56:55 -04:00
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup kernel memory.",
|
|
|
|
}
|
2015-08-23 23:37:11 -04:00
|
|
|
memoryLimitSupport = testRequirement{
|
|
|
|
func() bool {
|
|
|
|
return SysInfo.MemoryLimit
|
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup memory limit.",
|
|
|
|
}
|
2015-09-23 02:02:45 -04:00
|
|
|
memoryReservationSupport = testRequirement{
|
|
|
|
func() bool {
|
|
|
|
return SysInfo.MemoryReservation
|
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup memory reservation.",
|
|
|
|
}
|
2015-08-23 23:37:11 -04:00
|
|
|
swapMemorySupport = testRequirement{
|
|
|
|
func() bool {
|
|
|
|
return SysInfo.SwapLimit
|
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup swap memory limit.",
|
|
|
|
}
|
|
|
|
memorySwappinessSupport = testRequirement{
|
|
|
|
func() bool {
|
|
|
|
return SysInfo.MemorySwappiness
|
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup memory swappiness.",
|
|
|
|
}
|
|
|
|
blkioWeight = testRequirement{
|
|
|
|
func() bool {
|
|
|
|
return SysInfo.BlkioWeight
|
|
|
|
},
|
|
|
|
"Test requires an environment that supports blkio weight.",
|
|
|
|
}
|
|
|
|
cgroupCpuset = testRequirement{
|
|
|
|
func() bool {
|
|
|
|
return SysInfo.Cpuset
|
|
|
|
},
|
|
|
|
"Test requires an environment that supports cgroup cpuset.",
|
|
|
|
}
|
2015-05-29 14:22:21 -04:00
|
|
|
)
|
2015-08-23 23:37:11 -04:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
SysInfo = sysinfo.New(true)
|
|
|
|
}
|