requirements_unix.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. pidsLimit = testRequirement{
  34. func() bool {
  35. return SysInfo.PidsLimit
  36. },
  37. "Test requires pids limit enabled.",
  38. }
  39. kernelMemorySupport = testRequirement{
  40. func() bool {
  41. return SysInfo.KernelMemory
  42. },
  43. "Test requires an environment that supports cgroup kernel memory.",
  44. }
  45. memoryLimitSupport = testRequirement{
  46. func() bool {
  47. return SysInfo.MemoryLimit
  48. },
  49. "Test requires an environment that supports cgroup memory limit.",
  50. }
  51. memoryReservationSupport = testRequirement{
  52. func() bool {
  53. return SysInfo.MemoryReservation
  54. },
  55. "Test requires an environment that supports cgroup memory reservation.",
  56. }
  57. swapMemorySupport = testRequirement{
  58. func() bool {
  59. return SysInfo.SwapLimit
  60. },
  61. "Test requires an environment that supports cgroup swap memory limit.",
  62. }
  63. memorySwappinessSupport = testRequirement{
  64. func() bool {
  65. return SysInfo.MemorySwappiness
  66. },
  67. "Test requires an environment that supports cgroup memory swappiness.",
  68. }
  69. blkioWeight = testRequirement{
  70. func() bool {
  71. return SysInfo.BlkioWeight
  72. },
  73. "Test requires an environment that supports blkio weight.",
  74. }
  75. cgroupCpuset = testRequirement{
  76. func() bool {
  77. return SysInfo.Cpuset
  78. },
  79. "Test requires an environment that supports cgroup cpuset.",
  80. }
  81. seccompEnabled = testRequirement{
  82. func() bool {
  83. return supportsSeccomp && SysInfo.Seccomp
  84. },
  85. "Test requires that seccomp support be enabled in the daemon.",
  86. }
  87. bridgeNfIptables = testRequirement{
  88. func() bool {
  89. return !SysInfo.BridgeNFCallIPTablesDisabled
  90. },
  91. "Test requires that bridge-nf-call-iptables support be enabled in the daemon.",
  92. }
  93. bridgeNfIP6tables = testRequirement{
  94. func() bool {
  95. return !SysInfo.BridgeNFCallIP6TablesDisabled
  96. },
  97. "Test requires that bridge-nf-call-ip6tables support be enabled in the daemon.",
  98. }
  99. )
  100. func init() {
  101. SysInfo = sysinfo.New(true)
  102. }