cgroups

package
v0.0.0-...-5cef3e7 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CgroupKataPrefix = "kata"

prepend a kata specific string to oci cgroup path to form a different cgroup path, thus cAdvisor couldn't find kata containers cgroup path on host to prevent it from grabbing the stats data.

View Source
const DefaultCgroupPath = "/vc"

DefaultCgroupPath runtime-determined location in the cgroups hierarchy.

Variables

This section is empty.

Functions

func DeviceToCgroupDevice

func DeviceToCgroupDevice(device string) (*configs.Device, error)

func DeviceToLinuxDevice

func DeviceToLinuxDevice(device string) (specs.LinuxDeviceCgroup, error)

func EnableSystemdCgroup

func EnableSystemdCgroup()

func IsSystemdCgroup

func IsSystemdCgroup(cgroupPath string) bool

func RenameCgroupPath

func RenameCgroupPath(path string) (string, error)

func UseSystemdCgroup

func UseSystemdCgroup() bool

func ValidCgroupPath

func ValidCgroupPath(path string, systemdCgroup bool) (string, error)

validCgroupPath returns a valid cgroup path. see https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#cgroups-path

Types

type Config

type Config struct {
	// Cgroups specifies specific cgroup settings for the various subsystems that the container is
	// placed into to limit the resources the container has available
	// If nil, New() will create one.
	Cgroups *configs.Cgroup

	// CgroupPaths contains paths to all the cgroups setup for a container. Key is cgroup subsystem name
	// with the value as the path.
	CgroupPaths map[string]string

	// Resources represents the runtime resource constraints
	Resources specs.LinuxResources

	// CgroupPath is the OCI spec cgroup path
	CgroupPath string
}

type Manager

type Manager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(config *Config) (*Manager, error)

New creates a new CgroupManager

func (*Manager) Add

func (m *Manager) Add(pid int) error

Add pid to cgroups

func (*Manager) AddDevice

func (m *Manager) AddDevice(device string) error

AddDevice adds a device to the device cgroup

func (*Manager) Apply

func (m *Manager) Apply() error

Apply constraints

func (*Manager) Destroy

func (m *Manager) Destroy() error

func (*Manager) GetCgroups

func (m *Manager) GetCgroups() (*configs.Cgroup, error)

func (*Manager) GetPaths

func (m *Manager) GetPaths() map[string]string

func (*Manager) RemoveDevice

func (m *Manager) RemoveDevice(device string) error

RemoceDevice removed a device from the device cgroup

Jump to

Keyboard shortcuts

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