cgroup_manager_unsupported.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // +build !linux
  2. /*
  3. Copyright 2016 The Kubernetes Authors.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. package cm
  15. import "fmt"
  16. type unsupportedCgroupManager struct{}
  17. // Make sure that unsupportedCgroupManager implements the CgroupManager interface
  18. var _ CgroupManager = &unsupportedCgroupManager{}
  19. type CgroupSubsystems struct {
  20. Mounts []interface{}
  21. MountPoints map[string]string
  22. }
  23. func NewCgroupManager(_ interface{}) CgroupManager {
  24. return &unsupportedCgroupManager{}
  25. }
  26. func (m *unsupportedCgroupManager) Name(_ CgroupName) string {
  27. return ""
  28. }
  29. func (m *unsupportedCgroupManager) Exists(_ CgroupName) bool {
  30. return false
  31. }
  32. func (m *unsupportedCgroupManager) Destroy(_ *CgroupConfig) error {
  33. return nil
  34. }
  35. func (m *unsupportedCgroupManager) Update(_ *CgroupConfig) error {
  36. return nil
  37. }
  38. func (m *unsupportedCgroupManager) Create(_ *CgroupConfig) error {
  39. return fmt.Errorf("Cgroup Manager is not supported in this build")
  40. }
  41. func (m *unsupportedCgroupManager) GetResourceStats(name CgroupName) (*ResourceStats, error) {
  42. return nil, fmt.Errorf("Cgroup Manager is not supported in this build")
  43. }
  44. func (m *unsupportedCgroupManager) Pids(_ CgroupName) []int {
  45. return nil
  46. }
  47. func (m *unsupportedCgroupManager) CgroupName(name string) CgroupName {
  48. return CgroupName([]string{})
  49. }
  50. func (m *unsupportedCgroupManager) ReduceCPULimits(cgroupName CgroupName) error {
  51. return nil
  52. }
  53. var RootCgroupName = CgroupName([]string{})
  54. func NewCgroupName(base CgroupName, components ...string) CgroupName {
  55. return CgroupName(append(base, components...))
  56. }
  57. func (cgroupName CgroupName) ToSystemd() string {
  58. return ""
  59. }
  60. func ParseSystemdToCgroupName(name string) CgroupName {
  61. return nil
  62. }
  63. func (cgroupName CgroupName) ToCgroupfs() string {
  64. return ""
  65. }
  66. func ParseCgroupfsToCgroupName(name string) CgroupName {
  67. return nil
  68. }
  69. func IsSystemdStyleName(name string) bool {
  70. return false
  71. }