qemu: domain: raise an error when no emulator is found

$ cat f | grep -e arch -e emulator
    <type arch='mipsel'>hvm</type>
$ sudo virsh define f
error: Failed to define domain from f
error: An error occurred, but the cause is unknown

After:
$ sudo virsh define f
error: Failed to define domain from f
error: unsupported configuration: No emulator found for arch 'mipsel'

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-12-09 11:34:45 -05:00
parent 66d4fd7009
commit 97cafa610e

View File

@ -4687,8 +4687,12 @@ qemuDomainDefPostParseBasic(virDomainDefPtr def,
/* check for emulator and create a default one if needed */
if (!def->emulator) {
if (!(def->emulator = virQEMUCapsGetDefaultEmulator(
driver->hostarch, def->os.arch)))
driver->hostarch, def->os.arch))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("No emulator found for arch '%s'"),
virArchToString(def->os.arch));
return 1;
}
}
return 0;