Documentation ¶
Index ¶
- Constants
- Variables
- func DeviceToCgroupDeviceRule(device string) (*devices.Rule, error)
- func DeviceToLinuxDevice(device string) (specs.LinuxDeviceCgroup, error)
- func IsCgroupV1() (bool, error)
- func IsSystemdCgroup(cgroupPath string) bool
- func RenameCgroupPath(path string) (string, error)
- func SetLogger(logger *logrus.Entry)
- func SetThreadAffinity(threadID int, cpuSetSlice []int) error
- func ValidCgroupPath(path string, isCgroupV2 bool, systemdCgroup bool) (string, error)
- type LinuxCgroup
- func (c *LinuxCgroup) AddDevice(deviceHostPath string) error
- func (c *LinuxCgroup) AddProcess(pid int, subsystems ...string) error
- func (c *LinuxCgroup) AddThread(pid int, subsystems ...string) error
- func (c *LinuxCgroup) Delete() error
- func (c *LinuxCgroup) ID() string
- func (c *LinuxCgroup) Logger() *logrus.Entry
- func (c *LinuxCgroup) MoveTo(path string) error
- func (c *LinuxCgroup) Parent() string
- func (c *LinuxCgroup) RemoveDevice(deviceHostPath string) error
- func (c *LinuxCgroup) Stat() (interface{}, error)
- func (c *LinuxCgroup) Type() ResourceControllerType
- func (c *LinuxCgroup) Update(resources *specs.LinuxResources) error
- func (c *LinuxCgroup) UpdateCpuSet(cpuset, memset string) error
- type ResourceController
- func LoadResourceController(path string) (ResourceController, error)
- func NewResourceController(path string, resources *specs.LinuxResources) (ResourceController, error)
- func NewSandboxResourceController(path string, resources *specs.LinuxResources, sandboxCgroupOnly bool) (ResourceController, error)
- type ResourceControllerType
Constants ¶
View Source
const ( // 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. CgroupKataPrefix = "kata" )
View Source
const DefaultResourceControllerID = "/vc"
DefaultResourceControllerID runtime-determined location in the cgroups hierarchy.
Variables ¶
View Source
var (
ErrCgroupMode = errors.New("cgroup controller type error")
)
Functions ¶
func DeviceToLinuxDevice ¶
func IsCgroupV1 ¶
func IsSystemdCgroup ¶
func RenameCgroupPath ¶
func SetThreadAffinity ¶
func ValidCgroupPath ¶
ValidCgroupPath returns a valid cgroup path. see https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#cgroups-path
Types ¶
type LinuxCgroup ¶
func (*LinuxCgroup) AddDevice ¶
func (c *LinuxCgroup) AddDevice(deviceHostPath string) error
func (*LinuxCgroup) AddProcess ¶
func (c *LinuxCgroup) AddProcess(pid int, subsystems ...string) error
func (*LinuxCgroup) AddThread ¶
func (c *LinuxCgroup) AddThread(pid int, subsystems ...string) error
func (*LinuxCgroup) Delete ¶
func (c *LinuxCgroup) Delete() error
func (*LinuxCgroup) ID ¶
func (c *LinuxCgroup) ID() string
func (*LinuxCgroup) Logger ¶
func (c *LinuxCgroup) Logger() *logrus.Entry
func (*LinuxCgroup) MoveTo ¶
func (c *LinuxCgroup) MoveTo(path string) error
func (*LinuxCgroup) Parent ¶
func (c *LinuxCgroup) Parent() string
func (*LinuxCgroup) RemoveDevice ¶
func (c *LinuxCgroup) RemoveDevice(deviceHostPath string) error
func (*LinuxCgroup) Stat ¶
func (c *LinuxCgroup) Stat() (interface{}, error)
func (*LinuxCgroup) Type ¶
func (c *LinuxCgroup) Type() ResourceControllerType
func (*LinuxCgroup) Update ¶
func (c *LinuxCgroup) Update(resources *specs.LinuxResources) error
func (*LinuxCgroup) UpdateCpuSet ¶
func (c *LinuxCgroup) UpdateCpuSet(cpuset, memset string) error
type ResourceController ¶
type ResourceController interface { // Type returns the resource controller implementation type. Type() ResourceControllerType // The controller identifier, e.g. a Linux cgroups path. ID() string // Parent returns the parent controller, on hierarchically // defined resource (e.g. Linux cgroups). Parent() string // Delete the controller. Delete() error // Stat returns the statistics for the controller. Stat() (interface{}, error) // AddProcess adds a process to a set of controllers. AddProcess(int, ...string) error // AddThread adds a process thread to a set of controllers. AddThread(int, ...string) error // Update updates the set of resources controlled, based on // an OCI resources description. Update(*specs.LinuxResources) error // MoveTo moves a controller to another one. MoveTo(string) error // AddDevice adds a device resource to the controller. AddDevice(string) error // RemoveDevice removes a device resource to the controller. RemoveDevice(string) error // UpdateCpuSet updates the set of controlled CPUs and memory nodes. UpdateCpuSet(string, string) error }
ResourceController represents a system resources controller. On Linux this interface is implemented through the cgroups API.
func LoadResourceController ¶
func LoadResourceController(path string) (ResourceController, error)
func NewResourceController ¶
func NewResourceController(path string, resources *specs.LinuxResources) (ResourceController, error)
func NewSandboxResourceController ¶
func NewSandboxResourceController(path string, resources *specs.LinuxResources, sandboxCgroupOnly bool) (ResourceController, error)
type ResourceControllerType ¶
type ResourceControllerType string
ResourceControllerType describes a resource controller type.
const ( LinuxCgroups ResourceControllerType = "cgroups" DarwinResourceControllerType ResourceControllerType = "darwin" )
func (*ResourceControllerType) String ¶
func (rType *ResourceControllerType) String() string
String converts a resource type to a string.
Click to show internal directories.
Click to hide internal directories.