cgroup

package
v0.59.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostRootPath = procMountPoint + "/1/root"

	HostCgroupBasePath = HostRootPath + cgroupBasePath
)

Variables

This section is empty.

Functions

func GenerateDefaultDeviceRules added in v0.50.0

func GenerateDefaultDeviceRules() []*devices.Rule

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)
}

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

func NewManagerFromPid(pid int) (manager Manager, err error)

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) 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) 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)

func (*MockManager) Set added in v0.50.0

func (_m *MockManager) Set(r *configs.Resources) 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

func (*MockruncManager) Set added in v0.56.0

func (_m *MockruncManager) Set(r *configs.Resources) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL