requirements_unix.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // +build !windows
  2. package main
  3. import (
  4. "github.com/docker/docker/pkg/sysinfo"
  5. )
  6. var (
  7. // SysInfo stores information about which features a kernel supports.
  8. SysInfo *sysinfo.SysInfo
  9. cpuCfsPeriod = testRequirement{
  10. func() bool {
  11. return SysInfo.CPUCfsPeriod
  12. },
  13. "Test requires an environment that supports cgroup cfs period.",
  14. }
  15. cpuCfsQuota = testRequirement{
  16. func() bool {
  17. return SysInfo.CPUCfsQuota
  18. },
  19. "Test requires an environment that supports cgroup cfs quota.",
  20. }
  21. cpuShare = testRequirement{
  22. func() bool {
  23. return SysInfo.CPUShares
  24. },
  25. "Test requires an environment that supports cgroup cpu shares.",
  26. }
  27. oomControl = testRequirement{
  28. func() bool {
  29. return SysInfo.OomKillDisable
  30. },
  31. "Test requires Oom control enabled.",
  32. }
  33. kernelMemorySupport = testRequirement{
  34. func() bool {
  35. return SysInfo.KernelMemory
  36. },
  37. "Test requires an environment that supports cgroup kernel memory.",
  38. }
  39. memoryLimitSupport = testRequirement{
  40. func() bool {
  41. return SysInfo.MemoryLimit
  42. },
  43. "Test requires an environment that supports cgroup memory limit.",
  44. }
  45. memoryReservationSupport = testRequirement{
  46. func() bool {
  47. return SysInfo.MemoryReservation
  48. },
  49. "Test requires an environment that supports cgroup memory reservation.",
  50. }
  51. swapMemorySupport = testRequirement{
  52. func() bool {
  53. return SysInfo.SwapLimit
  54. },
  55. "Test requires an environment that supports cgroup swap memory limit.",
  56. }
  57. memorySwappinessSupport = testRequirement{
  58. func() bool {
  59. return SysInfo.MemorySwappiness
  60. },
  61. "Test requires an environment that supports cgroup memory swappiness.",
  62. }
  63. blkioWeight = testRequirement{
  64. func() bool {
  65. return SysInfo.BlkioWeight
  66. },
  67. "Test requires an environment that supports blkio weight.",
  68. }
  69. cgroupCpuset = testRequirement{
  70. func() bool {
  71. return SysInfo.Cpuset
  72. },
  73. "Test requires an environment that supports cgroup cpuset.",
  74. }
  75. )
  76. func init() {
  77. SysInfo = sysinfo.New(true)
  78. }