From c966179ba4c1ee0461a2d84a1d667629cca21ec8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 1 Mar 2013 17:17:04 +0000 Subject: [PATCH] libxl: move check for existence of qemuu device model The stat in libxl__domain_build_info_setdefault's default device model logic works to fall back to qemu-xen-traditional whenever the executable for qemu-xen is not found. We are going to use qemu-xen-traditional in more cases, so break this check out into its own if statement. Also add a pair of braces to make the if() statement symmetrical. Signed-off-by: Ian Jackson Acked-by: Ian Campbell --- tools/libxl/libxl_create.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index efeebf27fb..04bf4a59b7 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -105,22 +105,25 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, libxl_defbool_setdefault(&b_info->device_model_stubdomain, false); if (!b_info->device_model_version) { - if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) + if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) { b_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL; - else { + } else { + b_info->device_model_version = + LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN; + } + if (b_info->device_model_version + == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) { const char *dm; int rc; - b_info->device_model_version = - LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN; dm = libxl__domain_device_model(gc, b_info); rc = access(dm, X_OK); if (rc < 0) { /* qemu-xen unavailable, use qemu-xen-traditional */ if (errno == ENOENT) { LIBXL__LOG_ERRNO(CTX, XTL_VERBOSE, "qemu-xen is unavailable" - ", use qemu-xen-traditional instead"); + ", use qemu-xen-traditional instead"); b_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL; } else { -- 2.39.5