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)
committerMaximilian Engelhardt <maxi@daemonizer.de>
Thu, 23 Mar 2023 21:26:15 +0000 (22:26 +0100)
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 dbee32b7b7a28a95e797c6d7b434d8f619eeadd6..6567e84d7fd821086959a61508da07a417234950 100644 (file)
@@ -110,6 +110,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;
@@ -129,6 +130,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
                 }
             }
         }
+#endif
     }
 
     if (b_info->blkdev_start == NULL)
index fc264a3a13a6a5a956ea25b7d8d1c4adb507cc71..2dca5d9077565116f6ca71c2f273178dcaa0413c 100644 (file)
@@ -2897,6 +2897,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;
     }