cgroup

package
v0.55.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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

Jump to

Keyboard shortcuts

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