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>
Mon, 9 May 2022 20:30:57 +0000 (22:30 +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 1864ee30f0a22f3c8157066a4d72faa7d8dc75f7..222975157bfb53cb179a8414027593810e4cf18c 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;
     }