diff --git a/qemu/tests/cpuid.py b/qemu/tests/cpuid.py index 7e0599fc8912e6507c7cb3c33745b0338257fcbb..1d3ee28a34c67009f3a7f7faf360ef030d37e909 100644 --- a/qemu/tests/cpuid.py +++ b/qemu/tests/cpuid.py @@ -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: