]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: domain: raise an error when no emulator is found
authorCole Robinson <crobinso@redhat.com>
Mon, 9 Dec 2019 16:34:45 +0000 (11:34 -0500)
committerCole Robinson <crobinso@redhat.com>
Mon, 9 Dec 2019 19:40:43 +0000 (14:40 -0500)
$ 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>
src/qemu/qemu_domain.c

index a15364a71ed6deae16d3b9b0aeb038f630c558c1..6f53e17b6a375da59a1741be608a57f359b629e0 100644 (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;