From 7bb9471423a350f0b1a60f67cf3eb41abaaba329 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 13 Mar 2020 11:16:49 -0400 Subject: [PATCH] Don't set cpuset_cpus if empty If cpuset_cpus is set to '', we don't want to configure it, just skip it. Closes-Bug: #1867357 Change-Id: I615c798bdbcc0115f0ca9642969193ceada9b9cd --- paunch/builder/compose1.py | 2 +- paunch/builder/podman.py | 2 +- paunch/tests/test_builder_base.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/paunch/builder/compose1.py b/paunch/builder/compose1.py index 200c11d..4019153 100644 --- a/paunch/builder/compose1.py +++ b/paunch/builder/compose1.py @@ -82,7 +82,7 @@ class ComposeV1Builder(base.BaseBuilder): for extra_host in cconfig.get('extra_hosts', []): if extra_host: cmd.append('--add-host=%s' % extra_host) - if 'cpuset_cpus' in cconfig: + if 'cpuset_cpus' in cconfig and cconfig['cpuset_cpus'] != '': # 'all' is a special value to directly configure all CPUs # that are available. if cconfig['cpuset_cpus'] == 'all': diff --git a/paunch/builder/podman.py b/paunch/builder/podman.py index 9643b47..eb3cf08 100644 --- a/paunch/builder/podman.py +++ b/paunch/builder/podman.py @@ -91,7 +91,7 @@ class PodmanBuilder(base.BaseBuilder): for extra_host in cconfig.get('extra_hosts', []): if extra_host: cmd.append('--add-host=%s' % extra_host) - if 'cpuset_cpus' in cconfig: + if 'cpuset_cpus' in cconfig and cconfig['cpuset_cpus'] != '': # 'all' is a special value to directly configure all CPUs # that are available. if cconfig['cpuset_cpus'] == 'all': diff --git a/paunch/tests/test_builder_base.py b/paunch/tests/test_builder_base.py index 51df837..f52bfc4 100644 --- a/paunch/tests/test_builder_base.py +++ b/paunch/tests/test_builder_base.py @@ -36,6 +36,7 @@ class TestBaseBuilder(base.TestCase): 'one': { 'start_order': 0, 'image': 'centos:7', + 'cpuset_cpus': '', }, 'two': { 'start_order': 1,