Documentation ¶
Index ¶
- Constants
- func GenerateDefaultDeviceRules() []*devices.Rule
- func GetGlobalCpuSetPath() string
- type CgroupVersion
- type Manager
- type MockManager
- func (_m *MockManager) AttachTID(subSystem string, subCgroup string, tid int) error
- func (_m *MockManager) CreateChildCgroup(name string, subSystem string) error
- func (_m *MockManager) EXPECT() *_MockManagerRecorder
- func (_m *MockManager) GetBasePathToHostSubsystem(subsystem string) (string, error)
- func (_m *MockManager) GetCgroupThreads() ([]int, error)
- func (_m *MockManager) GetCgroupVersion() CgroupVersion
- func (_m *MockManager) GetCpuSet() (string, error)
- func (_m *MockManager) Set(r *configs.Resources) error
- func (_m *MockManager) SetCpuSet(subcgroup string, cpulist []int) error
- type MockruncManager
- func (_m *MockruncManager) Apply(pid int) error
- func (_m *MockruncManager) Destroy() error
- func (_m *MockruncManager) EXPECT() *_MockruncManagerRecorder
- func (_m *MockruncManager) Exists() bool
- func (_m *MockruncManager) Freeze(state configs.FreezerState) error
- func (_m *MockruncManager) GetAllPids() ([]int, error)
- func (_m *MockruncManager) GetCgroups() (*configs.Cgroup, error)
- func (_m *MockruncManager) GetFreezerState() (configs.FreezerState, error)
- func (_m *MockruncManager) GetPaths() map[string]string
- func (_m *MockruncManager) GetPids() ([]int, error)
- func (_m *MockruncManager) GetStats() (*cgroups.Stats, error)
- func (_m *MockruncManager) OOMKillCount() (uint64, error)
- func (_m *MockruncManager) Path(_param0 string) string
- func (_m *MockruncManager) Set(r *configs.Resources) error
Constants ¶
const ( HostRootPath = procMountPoint + "/1/root" HostCgroupBasePath = HostRootPath + cgroupBasePath )
Variables ¶
This section is empty.
Functions ¶
func GenerateDefaultDeviceRules ¶ added in v0.50.0
func GetGlobalCpuSetPath ¶ added in v0.50.0
func GetGlobalCpuSetPath() string
GetGlobalCpuSetPath returns the CPU set of the main cgroup slice
Types ¶
type CgroupVersion ¶ added in v0.50.0
type CgroupVersion string
const ( V1 CgroupVersion = "v1" V2 CgroupVersion = "v2" )
Templates for logging / error messages
type Manager ¶ added in v0.50.0
type Manager interface { Set(r *configs.Resources) error // GetBasePathToHostSubsystem returns the path to the specified subsystem // from the host's viewpoint. GetBasePathToHostSubsystem(subsystem string) (string, error) // GetCgroupVersion returns the current cgroup version (i.e. v1 or v2) GetCgroupVersion() CgroupVersion // GetCpuSet returns the cpu set GetCpuSet() (string, error) // SetCpuSet returns the cpu set SetCpuSet(subcgroup string, cpulist []int) error // Create new child cgroup CreateChildCgroup(name string, subSystem string) error // Attach TID to cgroup AttachTID(subSystem string, subCgroup string, tid int) error // Get list of threads attached to cgroup GetCgroupThreads() ([]int, error) }
Manager is the only interface to use in order to inspect, update or define cgroup properties. This interface is agnostic to cgroups version (supports v1 and v2) and is completely transparent from the users perspective. To achieve this "runc"'s cgroup manager is being levitated. This package's implementation guide-line is to have the thinnest glue layer possible in order to have all runc's capabilities without extra effort. This interface can, of course, extend runc and introduce new functionalities that are specific to Kubevirt's use.
func NewManagerFromPid ¶ added in v0.50.0
NewManagerFromPid initializes a new cgroup manager from VMI's pid. The pid is expected to VMI's pid from the host's viewpoint.
func NewManagerFromVM ¶ added in v0.50.0
func NewManagerFromVM(vmi *v1.VirtualMachineInstance) (Manager, error)
type MockManager ¶ added in v0.50.0
type MockManager struct {
// contains filtered or unexported fields
}
Mock of Manager interface
func NewMockManager ¶ added in v0.50.0
func NewMockManager(ctrl *gomock.Controller) *MockManager
func (*MockManager) AttachTID ¶ added in v0.58.1
func (_m *MockManager) AttachTID(subSystem string, subCgroup string, tid int) error
func (*MockManager) CreateChildCgroup ¶ added in v0.58.1
func (_m *MockManager) CreateChildCgroup(name string, subSystem string) error
func (*MockManager) EXPECT ¶ added in v0.50.0
func (_m *MockManager) EXPECT() *_MockManagerRecorder
func (*MockManager) GetBasePathToHostSubsystem ¶ added in v0.50.0
func (_m *MockManager) GetBasePathToHostSubsystem(subsystem string) (string, error)
func (*MockManager) GetCgroupThreads ¶ added in v0.58.1
func (_m *MockManager) GetCgroupThreads() ([]int, error)
func (*MockManager) GetCgroupVersion ¶ added in v0.50.0
func (_m *MockManager) GetCgroupVersion() CgroupVersion
func (*MockManager) GetCpuSet ¶ added in v0.50.0
func (_m *MockManager) GetCpuSet() (string, error)
type MockruncManager ¶ added in v0.56.0
type MockruncManager struct {
// contains filtered or unexported fields
}
Mock of runcManager interface
func NewMockruncManager ¶ added in v0.56.0
func NewMockruncManager(ctrl *gomock.Controller) *MockruncManager
func (*MockruncManager) Apply ¶ added in v0.56.0
func (_m *MockruncManager) Apply(pid int) error
func (*MockruncManager) Destroy ¶ added in v0.56.0
func (_m *MockruncManager) Destroy() error
func (*MockruncManager) EXPECT ¶ added in v0.56.0
func (_m *MockruncManager) EXPECT() *_MockruncManagerRecorder
func (*MockruncManager) Exists ¶ added in v0.56.0
func (_m *MockruncManager) Exists() bool
func (*MockruncManager) Freeze ¶ added in v0.56.0
func (_m *MockruncManager) Freeze(state configs.FreezerState) error
func (*MockruncManager) GetAllPids ¶ added in v0.56.0
func (_m *MockruncManager) GetAllPids() ([]int, error)
func (*MockruncManager) GetCgroups ¶ added in v0.56.0
func (_m *MockruncManager) GetCgroups() (*configs.Cgroup, error)
func (*MockruncManager) GetFreezerState ¶ added in v0.56.0
func (_m *MockruncManager) GetFreezerState() (configs.FreezerState, error)
func (*MockruncManager) GetPaths ¶ added in v0.56.0
func (_m *MockruncManager) GetPaths() map[string]string
func (*MockruncManager) GetPids ¶ added in v0.56.0
func (_m *MockruncManager) GetPids() ([]int, error)
func (*MockruncManager) GetStats ¶ added in v0.56.0
func (_m *MockruncManager) GetStats() (*cgroups.Stats, error)
func (*MockruncManager) OOMKillCount ¶ added in v0.56.0
func (_m *MockruncManager) OOMKillCount() (uint64, error)
func (*MockruncManager) Path ¶ added in v0.56.0
func (_m *MockruncManager) Path(_param0 string) string