give meaningful error message if qemu device model is unavailable
authorMichael Tokarev <mjt@tls.msk.ru>
Sun, 24 Apr 2022 09:26:38 +0000 (12:26 +0300)
committerHans van Kranenburg <hans@knorrie.org>
Tue, 23 Aug 2022 11:40:41 +0000 (13:40 +0200)
There's no sense to switch to qemu-xen-traditional device model
if that one is not enabled in the first place. This way we'll
have a chance later to print a message suggesting to install the
missing qemu package if we *actually* need qemu for the device model.

tools/libs/light/libxl_create.c
tools/libs/light/libxl_dm.c

index 885675591feedc6cac917635efc387170f2bc842..54ded26dfdedb702575463cf2b8589340ddc2ff6 100644 (file)
@@ -109,6 +109,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
             b_info->device_model_version =
                 LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
         }
+#if HAVE_QEMU_TRADITIONAL
         if (b_info->device_model_version
                 == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
             const char *dm;
@@ -128,6 +129,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
                 }
             }
         }
+#endif
     }
 
     if (b_info->blkdev_start == NULL)
index 04bf5d85632ec088c79e99efc67eddb5a90859cd..69846c6cd79f8da62ad11be8bd18b18b5d77485e 100644 (file)
@@ -2880,6 +2880,9 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
     }
     if (access(dm, X_OK) < 0) {
         LOGED(ERROR, domid, "device model %s is not executable", dm);
+        if (strcmp(dm, QEMU_XEN_PATH) == 0) {
+           LOGD(ERROR, domid, "Please install the qemu-system-xen package for this domain to work");
+        }
         rc = ERROR_FAIL;
         goto out;
     }