mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 23:38:24 +00:00
Merge pull request #11802 from hqhq/hq_add_blkio_weight
add blkio.weight support
This commit is contained in:
@@ -384,6 +384,7 @@ func populateCommand(c *Container, env []string) error {
|
||||
CpusetCpus: c.hostConfig.CpusetCpus,
|
||||
CpusetMems: c.hostConfig.CpusetMems,
|
||||
CpuQuota: c.hostConfig.CpuQuota,
|
||||
BlkioWeight: c.hostConfig.BlkioWeight,
|
||||
Rlimits: rlimits,
|
||||
OomKillDisable: c.hostConfig.OomKillDisable,
|
||||
}
|
||||
|
||||
@@ -1174,6 +1174,9 @@ func (daemon *Daemon) verifyHostConfig(hostConfig *runconfig.HostConfig) ([]stri
|
||||
warnings = append(warnings, "Your kernel does not support CPU cfs quota. Quota discarded.")
|
||||
hostConfig.CpuQuota = 0
|
||||
}
|
||||
if hostConfig.BlkioWeight > 0 && (hostConfig.BlkioWeight < 10 || hostConfig.BlkioWeight > 1000) {
|
||||
return warnings, fmt.Errorf("Range of blkio weight is from 10 to 1000.")
|
||||
}
|
||||
|
||||
return warnings, nil
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ type Resources struct {
|
||||
CpusetCpus string `json:"cpuset_cpus"`
|
||||
CpusetMems string `json:"cpuset_mems"`
|
||||
CpuQuota int64 `json:"cpu_quota"`
|
||||
BlkioWeight int64 `json:"blkio_weight"`
|
||||
Rlimits []*ulimit.Rlimit `json:"rlimits"`
|
||||
OomKillDisable bool `json:"oom_kill_disable"`
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ func SetupCgroups(container *configs.Config, c *Command) error {
|
||||
container.Cgroups.CpusetCpus = c.Resources.CpusetCpus
|
||||
container.Cgroups.CpusetMems = c.Resources.CpusetMems
|
||||
container.Cgroups.CpuQuota = c.Resources.CpuQuota
|
||||
container.Cgroups.BlkioWeight = c.Resources.BlkioWeight
|
||||
container.Cgroups.OomKillDisable = c.Resources.OomKillDisable
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,9 @@ lxc.cgroup.cpuset.mems = {{.Resources.CpusetMems}}
|
||||
{{if .Resources.CpuQuota}}
|
||||
lxc.cgroup.cpu.cfs_quota_us = {{.Resources.CpuQuota}}
|
||||
{{end}}
|
||||
{{if .Resources.BlkioWeight}}
|
||||
lxc.cgroup.blkio.weight = {{.Resources.BlkioWeight}}
|
||||
{{end}}
|
||||
{{if .Resources.OomKillDisable}}
|
||||
lxc.cgroup.memory.oom_control = {{.Resources.OomKillDisable}}
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user