[libvirt] [PATCH] qemu: domain: raise an error when no emulator is found

Cole Robinson posted 1 patch 4 years, 4 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/e88a589e529eb7591969ebb2e5f8f8801f72fc66.1575915266.git.crobinso@redhat.com
src/qemu/qemu_domain.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[libvirt] [PATCH] qemu: domain: raise an error when no emulator is found
Posted by Cole Robinson 4 years, 4 months ago
$ 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'

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 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;
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: domain: raise an error when no emulator is found
Posted by Daniel P. Berrangé 4 years, 4 months ago
On Mon, Dec 09, 2019 at 01:14:26PM -0500, Cole Robinson wrote:
> $ 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'
> 
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
> ---
>  src/qemu/qemu_domain.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

(assuming make check passes)

> 
> 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;
> -- 
> 2.23.0
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list