Allow to limit cgroup cpu shares

Related-bug: #1755605

Change-Id: I1f24866ea2ec01e3ef22571145efa25ab219bb3a
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
This commit is contained in:
Bogdan Dobrelya 2018-03-20 14:22:36 +01:00
parent 9b8c252b75
commit 4a4f43ac36
3 changed files with 9 additions and 0 deletions

View File

@ -182,6 +182,8 @@ class ComposeV1Builder(object):
cmd.append('--volumes-from=%s' % v)
if 'log_tag' in cconfig:
cmd.append('--log-opt=tag=%s' % cconfig['log_tag'])
if 'cpu_shares' in cconfig:
cmd.append('--cpu-shares=%s' % cconfig['cpu_shares'])
if 'security_opt' in cconfig:
cmd.append('--security-opt=%s' % cconfig['security_opt'])

View File

@ -419,6 +419,7 @@ three-12345678 three''', '', 0),
},
'env_file': '/tmp/foo.env',
'log_tag': '{{.ImageName}}/{{.Name}}/{{.ID}}',
'cpu_shares': 600,
'security_opt': 'label:disable'
}
}
@ -434,6 +435,7 @@ three-12345678 three''', '', 0),
'--health-timeout=10s', '--health-retries=3',
'--privileged=true', '--restart=always', '--user=bar',
'--log-opt=tag={{.ImageName}}/{{.Name}}/{{.ID}}',
'--cpu-shares=600',
'--security-opt=label:disable', 'centos:7'],
cmd
)

View File

@ -0,0 +1,5 @@
---
features:
- |
Add `--cpu-shares=xxx` option for the action run a container. Allows to
define upper `cpu.shares` limits in the cpu cgroup.