[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 32 of 32 RFC] libxl: Default to stub device model whenever possible



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1326715929 0
# Node ID 953a1ce643856edcf9fbbbc2680690b3a26dede8
# Parent  a2dc899d0f229d82baca92a06b3b7a5b4d918324
libxl: Default to stub device model whenever possible.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r a2dc899d0f22 -r 953a1ce64385 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Mon Jan 16 11:33:18 2012 +0000
+++ b/tools/libxl/libxl_create.c        Mon Jan 16 12:12:09 2012 +0000
@@ -94,7 +94,20 @@ int libxl__domain_build_info_setdefaults
         b_info->device_model_version =
             LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
 
-    libxl_defbool_setdefault(&b_info->device_model_stubdomain, false);
+    /* Default to stub domain device model if possible */
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM
+        && b_info->device_model_version
+        == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL
+        && access(libxl__stubdom_kernel(gc), R_OK) == 0) {
+        libxl_defbool_setdefault(&b_info->device_model_stubdomain, true);
+    } else {
+        libxl_defbool_setdefault(&b_info->device_model_stubdomain, false);
+    }
+
+    if (b_info->device_model_version !=
+        LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL &&
+        libxl_defbool_val(b_info->device_model_stubdomain))
+        return ERROR_INVAL;
 
     if (!b_info->max_vcpus)
         b_info->max_vcpus = 1;
diff -r a2dc899d0f22 -r 953a1ce64385 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Mon Jan 16 11:33:18 2012 +0000
+++ b/tools/libxl/libxl_dm.c    Mon Jan 16 12:12:09 2012 +0000
@@ -686,6 +686,11 @@ retry_transaction:
     return 0;
 }
 
+char *libxl__stubdom_kernel(libxl__gc *gc)
+{
+    return libxl__abs_path(gc, "ioemu-stubdom.gz", 
libxl_xenfirmwaredir_path());
+}
+
 static int libxl__create_stubdom(libxl__gc *gc,
                                  int guest_domid,
                                  libxl_domain_config *guest_config,
@@ -729,8 +734,7 @@ static int libxl__create_stubdom(libxl__
     dm_config.b_info.target_memkb = dm_config.b_info.max_memkb;
 
     dm_config.b_info.type = LIBXL_DOMAIN_TYPE_PV;
-    dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
-                                              libxl_xenfirmwaredir_path());
+    dm_config.b_info.u.pv.kernel.path = libxl__stubdom_kernel(gc);
     dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", guest_domid);
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
diff -r a2dc899d0f22 -r 953a1ce64385 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Mon Jan 16 11:33:18 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Mon Jan 16 12:12:09 2012 +0000
@@ -482,6 +482,8 @@ _hidden int libxl__create_device_model(l
                               libxl_domain_config *guest_config,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
+_hidden char *libxl__stubdom_kernel(libxl__gc *gc);
+
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
                               libxl__domain_build_state *state,

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.