From 97cafa610ecf5dc4316027be679b12366da57769 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 9 Dec 2019 11:34:45 -0500 Subject: [PATCH] qemu: domain: raise an error when no emulator is found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $ cat f | grep -e arch -e emulator hvm $ 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é Signed-off-by: Cole Robinson --- src/qemu/qemu_domain.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a15364a71e..6f53e17b6a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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;