提交 ab2dcdf9 编写于 作者: E Eduardo Habkost

cpuid: Handle VMCreateError when CPU can't be run

avocado-vt will throw VMCreateError if QEMU refuses to start, so handle
both VMStartError and VMCreateError, to catch errors when a CPU model
can't run.
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
上级 53549271
......@@ -535,12 +535,13 @@ def run(test, params, env):
out = get_guest_cpuid(
self, cpu_model, cpu_model_flags + ',enforce',
extra_params=dict(machine_type=machine_type, smp=1))
except virt_vm.VMStartError, e:
if "host doesn't support requested feature:" in e.reason \
or ("host cpuid" in e.reason and
("lacks requested flag" in e.reason or
"flag restricted to guest" in e.reason)) \
or ("Unable to find CPU definition:" in e.reason):
except (virt_vm.VMStartError, virt_vm.VMCreateError) as e:
output = getattr(e, 'reason', getattr(e, 'output', ''))
if "host doesn't support requested feature:" in output \
or ("host cpuid" in output and
("lacks requested flag" in output or
"flag restricted to guest" in output)) \
or ("Unable to find CPU definition:" in output):
raise error.TestNAError(
"Can't run CPU model %s on this host" % (full_cpu_model_name))
else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册