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 {
2015-02-12 08:45:23 +08:00
Name string ` json:"name" `
2015-02-01 11:56:27 +08:00
// name of parent cgroup or slice
2015-02-12 08:45:23 +08:00
Parent string ` json:"parent" `
2015-02-01 11:56:27 +08:00
2015-12-15 08:26:29 +08:00
// ScopePrefix decribes prefix for the scope name
ScopePrefix string ` json:"scope_prefix" `
// 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.
2015-02-12 08:45:23 +08:00
AllowAllDevices bool ` json:"allow_all_devices" `
2015-02-01 11:56:27 +08:00
2015-02-12 08:45:23 +08:00
AllowedDevices [ ] * Device ` json:"allowed_devices" `
2015-02-01 11:56:27 +08:00
2015-03-31 16:36:00 +08:00
DeniedDevices [ ] * Device ` json:"denied_devices" `
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
// Total memory usage (memory + swap); set `-1' to disable 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" `
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).
CpuRtRuntime int64 ` json:"cpu_quota" `
// CPU period to be used for realtime scheduling (in usecs).
CpuRtPeriod int64 ` json:"cpu_period" `
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
// IO write rate limit per cgroup per divice, 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
MemorySwappiness int64 ` json:"memory_swappiness" `
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
NetClsClassid string ` json:"net_cls_classid" `
2015-02-01 11:56:27 +08:00
}