mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct/configs: move cgroup stuff to libct/cgroups
We have quite a few external users of libcontainer/cgroups packages, and they all have to depend on libcontainer/configs as well. Let's move cgroup-related configuration to libcontainer/croups. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -2,8 +2,6 @@ package cgroups
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/opencontainers/runc/libcontainer/configs"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -21,8 +19,8 @@ var (
|
||||
// [github.com/opencontainers/runc/libcontainer/cgroups/devices]
|
||||
// package is imported, it is set to nil, so cgroup managers can't
|
||||
// manage devices.
|
||||
DevicesSetV1 func(path string, r *configs.Resources) error
|
||||
DevicesSetV2 func(path string, r *configs.Resources) error
|
||||
DevicesSetV1 func(path string, r *Resources) error
|
||||
DevicesSetV2 func(path string, r *Resources) error
|
||||
)
|
||||
|
||||
type Manager interface {
|
||||
@@ -42,7 +40,7 @@ type Manager interface {
|
||||
GetStats() (*Stats, error)
|
||||
|
||||
// Freeze sets the freezer cgroup to the specified state.
|
||||
Freeze(state configs.FreezerState) error
|
||||
Freeze(state FreezerState) error
|
||||
|
||||
// Destroy removes cgroup.
|
||||
Destroy() error
|
||||
@@ -54,7 +52,7 @@ type Manager interface {
|
||||
// Set sets cgroup resources parameters/limits. If the argument is nil,
|
||||
// the resources specified during Manager creation (or the previous call
|
||||
// to Set) are used.
|
||||
Set(r *configs.Resources) error
|
||||
Set(r *Resources) error
|
||||
|
||||
// GetPaths returns cgroup path(s) to save in a state file in order to
|
||||
// restore later.
|
||||
@@ -67,10 +65,10 @@ type Manager interface {
|
||||
GetPaths() map[string]string
|
||||
|
||||
// GetCgroups returns the cgroup data as configured.
|
||||
GetCgroups() (*configs.Cgroup, error)
|
||||
GetCgroups() (*Cgroup, error)
|
||||
|
||||
// GetFreezerState retrieves the current FreezerState of the cgroup.
|
||||
GetFreezerState() (configs.FreezerState, error)
|
||||
GetFreezerState() (FreezerState, error)
|
||||
|
||||
// Exists returns whether the cgroup path exists or not.
|
||||
Exists() bool
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package configs
|
||||
package cgroups
|
||||
|
||||
import "fmt"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package configs
|
||||
package cgroups
|
||||
|
||||
type HugepageLimit struct {
|
||||
// which type of hugepage to limit.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package configs
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -1,4 +1,4 @@
|
||||
package configs
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
systemdDbus "github.com/coreos/go-systemd/v22/dbus"
|
||||
@@ -1,4 +1,4 @@
|
||||
package configs
|
||||
package cgroups
|
||||
|
||||
// LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11)
|
||||
type LinuxRdma struct {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//go:build !linux
|
||||
|
||||
package configs
|
||||
package cgroups
|
||||
|
||||
// Cgroup holds properties of a cgroup on Linux
|
||||
// TODO Windows: This can ultimately be entirely factored out on Windows as
|
||||
@@ -0,0 +1,26 @@
|
||||
package configs // Deprecated: use [github.com/opencontainers/runc/libcontainer/cgroups].
|
||||
|
||||
import "github.com/opencontainers/runc/libcontainer/cgroups"
|
||||
|
||||
type (
|
||||
Cgroup = cgroups.Cgroup
|
||||
Resources = cgroups.Resources
|
||||
FreezerState = cgroups.FreezerState
|
||||
LinuxRdma = cgroups.LinuxRdma
|
||||
BlockIODevice = cgroups.BlockIODevice
|
||||
WeightDevice = cgroups.WeightDevice
|
||||
ThrottleDevice = cgroups.ThrottleDevice
|
||||
HugepageLimit = cgroups.HugepageLimit
|
||||
IfPrioMap = cgroups.IfPrioMap
|
||||
)
|
||||
|
||||
const (
|
||||
Undefined = cgroups.Undefined
|
||||
Frozen = cgroups.Frozen
|
||||
Thawed = cgroups.Thawed
|
||||
)
|
||||
|
||||
var (
|
||||
NewWeightDevice = cgroups.NewWeightDevice
|
||||
NewThrottleDevice = cgroups.NewThrottleDevice
|
||||
)
|
||||
Reference in New Issue
Block a user