提交 8a6e007e 编写于 作者: P Philippe Mathieu-Daudé 提交者: Fam Zheng

tests/vm: Do not abuse parallelism when KVM is not available

Signed-off-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20181013004034.6968-3-f4bug@amsat.org>
Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
Signed-off-by: NFam Zheng <famz@redhat.com>
上级 b59b82ed
......@@ -196,6 +196,13 @@ class BaseVM(object):
return self._guest.qmp(*args, **kwargs)
def parse_args(vm_name):
def get_default_jobs():
if kvm_available():
return multiprocessing.cpu_count() / 2
else:
return 1
parser = optparse.OptionParser(
description="VM test utility. Exit codes: "
"0 = success, "
......@@ -208,7 +215,7 @@ def parse_args(vm_name):
help="image file name")
parser.add_option("--force", "-f", action="store_true",
help="force build image even if image exists")
parser.add_option("--jobs", type=int, default=multiprocessing.cpu_count() / 2,
parser.add_option("--jobs", type=int, default=get_default_jobs(),
help="number of virtual CPUs")
parser.add_option("--verbose", "-V", action="store_true",
help="Pass V=1 to builds within the guest")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册