Merge "Failed to update memory for container"

This commit is contained in:
Zuul 2018-02-26 03:59:43 +00:00 committed by Gerrit Code Review
commit ed32609456
2 changed files with 6 additions and 1 deletions

View File

@ -48,7 +48,11 @@ won't be created.
"""),
cfg.StrOpt('container_runtime', default='runc',
help="""Define the runtime to create container with. Default value
in Zun is ``runc``.""")
in Zun is ``runc``."""),
cfg.IntOpt('default_memory_swap',
default=-1,
help='The default memory swap size in MB (default is -1 '
'which enable unlimited swap).'),
]

View File

@ -656,6 +656,7 @@ class DockerDriver(driver.ContainerDriver):
memory = patch.get('memory')
if memory is not None:
args['mem_limit'] = memory
args['memswap_limit'] = CONF.default_memory_swap
cpu = patch.get('cpu')
if cpu is not None:
args['cpu_quota'] = int(100000 * cpu)