Browse Source

Add ulimit option for run action

This will allow to set ulimit for a container.

Change-Id: I0cfcf4e3e3e13578ec42e12f459732992fb3a760
Related-Bug: #1760471
(cherry picked from commit 9348078452)
tags/2.5.0^0
yatin 1 year ago
parent
commit
e1b6ae7c13
3 changed files with 13 additions and 0 deletions
  1. +3
    -0
      paunch/builder/compose1.py
  2. +2
    -0
      paunch/tests/test_builder_compose1.py
  3. +8
    -0
      releasenotes/notes/add-ulimit-option-30dbd38044d26208.yaml

+ 3
- 0
paunch/builder/compose1.py View File

@@ -158,6 +158,9 @@ class ComposeV1Builder(object):
cmd.append('--pid=%s' % cconfig['pid'])
if 'uts' in cconfig:
cmd.append('--uts=%s' % cconfig['uts'])
for u in cconfig.get('ulimit', []):
if u:
cmd.append('--ulimit=%s' % u)
if 'healthcheck' in cconfig:
hconfig = cconfig['healthcheck']
if 'test' in hconfig:

+ 2
- 0
paunch/tests/test_builder_compose1.py View File

@@ -447,6 +447,7 @@ three-12345678 three''', '', 0),
'interactive': True,
'environment': ['FOO=BAR', 'BAR=BAZ'],
'env_file': ['/tmp/foo.env', '/tmp/bar.env'],
'ulimit': ['nofile=1024', 'nproc=1024'],
'volumes': ['/foo:/foo:rw', '/bar:/bar:ro'],
'volumes_from': ['two', 'three']
}
@@ -460,6 +461,7 @@ three-12345678 three''', '', 0),
'--env-file=/tmp/foo.env', '--env-file=/tmp/bar.env',
'--env=FOO=BAR', '--env=BAR=BAZ',
'--rm', '--interactive', '--tty',
'--ulimit=nofile=1024', '--ulimit=nproc=1024',
'--volume=/foo:/foo:rw', '--volume=/bar:/bar:ro',
'--volumes-from=two', '--volumes-from=three',
'centos:7', 'ls', '-l', '/foo'],

+ 8
- 0
releasenotes/notes/add-ulimit-option-30dbd38044d26208.yaml View File

@@ -0,0 +1,8 @@
---
features:
- |
Add `--ulimit=xxx` option for paunch run action. Using
this option, multiple ulimits can be set for the container.
For example, `--ulimit=nproc=1024 --ulimit=nofile=1024` will
set proc and nofile limit to 1024 for the container.


Loading…
Cancel
Save