2015-10-24 04:08:18 +08:00
// +build linux freebsd
2015-02-01 11:56:27 +08:00
package configs
type FreezerState string
const (
Undefined FreezerState = ""
Frozen FreezerState = "FROZEN"
Thawed FreezerState = "THAWED"
)
type Cgroup struct {
2016-01-21 10:04:59 +08:00
// Deprecated, use Path instead
Name string ` json:"name,omitempty" `
2015-02-01 11:56:27 +08:00
2016-01-21 10:04:59 +08:00
// name of parent of cgroup or slice
// Deprecated, use Path instead
Parent string ` json:"parent,omitempty" `
// Path specifies the path to cgroups that are created and/or joined by the container.
// The path is assumed to be relative to the host system cgroup mountpoint.
Path string ` json:"path" `
2015-02-01 11:56:27 +08:00
2016-10-12 07:22:48 +08:00
// ScopePrefix describes prefix for the scope name
2015-12-15 08:26:29 +08:00
ScopePrefix string ` json:"scope_prefix" `
2016-01-21 10:04:59 +08:00
// Paths represent the absolute cgroups paths to join.
// This takes precedence over Path.
2016-01-12 05:12:51 +08:00
Paths map [ string ] string
2015-12-15 08:26:29 +08:00
// Resources contains various cgroups settings to apply
2016-01-19 19:08:14 +08:00
* Resources
2015-12-15 08:26:29 +08:00
}
type Resources struct {
2015-02-01 11:56:27 +08:00
// If this is true allow access to any kind of device within the container. If false, allow access only to devices explicitly listed in the allowed_devices list.
2016-02-06 07:15:25 +08:00
// Deprecated
2016-07-21 01:46:11 +08:00
AllowAllDevices * bool ` json:"allow_all_devices,omitempty" `
2016-02-06 07:15:25 +08:00
// Deprecated
AllowedDevices [ ] * Device ` json:"allowed_devices,omitempty" `
// Deprecated
DeniedDevices [ ] * Device ` json:"denied_devices,omitempty" `
Devices [ ] * Device ` json:"devices" `
2015-03-31 16:36:00 +08:00
2015-02-01 11:56:27 +08:00
// Memory limit (in bytes)
2015-02-12 08:45:23 +08:00
Memory int64 ` json:"memory" `
2015-02-01 11:56:27 +08:00
// Memory reservation or soft_limit (in bytes)
2015-02-12 08:45:23 +08:00
MemoryReservation int64 ` json:"memory_reservation" `
2015-02-01 11:56:27 +08:00
2016-01-21 14:02:03 +08:00
// Total memory usage (memory + swap); set `-1` to enable unlimited swap
2015-02-12 08:45:23 +08:00
MemorySwap int64 ` json:"memory_swap" `
2015-02-01 11:56:27 +08:00
2015-05-15 14:24:56 +08:00
// Kernel memory limit (in bytes)
KernelMemory int64 ` json:"kernel_memory" `
2016-03-20 18:45:52 +08:00
// Kernel memory limit for TCP use (in bytes)
KernelMemoryTCP int64 ` json:"kernel_memory_tcp" `
2015-02-01 11:56:27 +08:00
// CPU shares (relative weight vs. other containers)
2015-02-12 08:45:23 +08:00
CpuShares int64 ` json:"cpu_shares" `
2015-02-01 11:56:27 +08:00
// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
2015-02-12 08:45:23 +08:00
CpuQuota int64 ` json:"cpu_quota" `
2015-02-01 11:56:27 +08:00
// CPU period to be used for hardcapping (in usecs). 0 to use system default.
2015-02-12 08:45:23 +08:00
CpuPeriod int64 ` json:"cpu_period" `
2015-02-01 11:56:27 +08:00
2015-05-14 20:42:10 +08:00
// How many time CPU will use in realtime scheduling (in usecs).
2016-07-18 15:02:30 +08:00
CpuRtRuntime int64 ` json:"cpu_rt_quota" `
2015-05-14 20:42:10 +08:00
// CPU period to be used for realtime scheduling (in usecs).
2016-07-18 15:02:30 +08:00
CpuRtPeriod int64 ` json:"cpu_rt_period" `
2015-05-14 20:42:10 +08:00
2015-02-01 11:56:27 +08:00
// CPU to use
2015-02-12 08:45:23 +08:00
CpusetCpus string ` json:"cpuset_cpus" `
2015-02-01 11:56:27 +08:00
// MEM to use
2015-02-12 08:45:23 +08:00
CpusetMems string ` json:"cpuset_mems" `
2015-02-01 11:56:27 +08:00
2015-12-14 21:33:56 +08:00
// Process limit; set <= `0' to disable limit.
PidsLimit int64 ` json:"pids_limit" `
2015-09-18 07:37:34 +08:00
// Specifies per cgroup weight, range is from 10 to 1000.
BlkioWeight uint16 ` json:"blkio_weight" `
// Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only
BlkioLeafWeight uint16 ` json:"blkio_leaf_weight" `
// Weight per cgroup per device, can override BlkioWeight.
BlkioWeightDevice [ ] * WeightDevice ` json:"blkio_weight_device" `
2015-04-17 15:27:21 +08:00
// IO read rate limit per cgroup per device, bytes per second.
2015-09-18 07:37:34 +08:00
BlkioThrottleReadBpsDevice [ ] * ThrottleDevice ` json:"blkio_throttle_read_bps_device" `
2015-04-17 15:27:21 +08:00
2016-10-12 07:22:48 +08:00
// IO write rate limit per cgroup per device, bytes per second.
2015-09-18 07:37:34 +08:00
BlkioThrottleWriteBpsDevice [ ] * ThrottleDevice ` json:"blkio_throttle_write_bps_device" `
2015-04-17 15:27:21 +08:00
// IO read rate limit per cgroup per device, IO per second.
2015-09-18 07:37:34 +08:00
BlkioThrottleReadIOPSDevice [ ] * ThrottleDevice ` json:"blkio_throttle_read_iops_device" `
2015-04-17 15:27:21 +08:00
// IO write rate limit per cgroup per device, IO per second.
2015-09-18 07:37:34 +08:00
BlkioThrottleWriteIOPSDevice [ ] * ThrottleDevice ` json:"blkio_throttle_write_iops_device" `
2015-04-08 14:11:29 +08:00
2015-02-01 11:56:27 +08:00
// set the freeze value for the process
2015-02-12 08:45:23 +08:00
Freezer FreezerState ` json:"freezer" `
2015-02-01 11:56:27 +08:00
2015-04-27 16:34:36 +08:00
// Hugetlb limit (in bytes)
HugetlbLimit [ ] * HugepageLimit ` json:"hugetlb_limit" `
2015-03-07 02:37:56 +08:00
// Whether to disable OOM Killer
OomKillDisable bool ` json:"oom_kill_disable" `
2015-05-14 10:48:46 +08:00
2015-06-11 19:26:03 +08:00
// Tuning swappiness behaviour per cgroup
2016-02-21 09:29:53 +08:00
MemorySwappiness * int64 ` json:"memory_swappiness" `
2015-06-11 19:26:03 +08:00
2015-05-14 10:48:46 +08:00
// Set priority of network traffic for container
NetPrioIfpriomap [ ] * IfPrioMap ` json:"net_prio_ifpriomap" `
2015-05-14 09:09:14 +08:00
// Set class identifier for container's network packets
2016-09-10 06:40:33 +08:00
NetClsClassid uint32 ` json:"net_cls_classid_u" `
2015-02-01 11:56:27 +08:00
}