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

[Xen-devel] [PATCH 31 of 32 RFC] libxl: switch device model selection over to libxl_defbool



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1326713598 0
# Node ID a2dc899d0f229d82baca92a06b3b7a5b4d918324
# Parent  7ffc8e870fbb5a9edcd6f8d46f2b0296d38cb5ed
libxl: switch device model selection over to libxl_defbool

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

diff -r 7ffc8e870fbb -r a2dc899d0f22 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Jan 16 11:29:10 2012 +0000
+++ b/tools/libxl/libxl.c       Mon Jan 16 11:33:18 2012 +0000
@@ -2445,7 +2445,7 @@ int libxl_domain_need_memory(libxl_ctx *
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         *need_memkb += b_info->shadow_memkb + LIBXL_HVM_EXTRA_MEMORY;
-        if (b_info->device_model_stubdomain)
+        if (libxl_defbool_val(b_info->device_model_stubdomain))
             *need_memkb += 32 * 1024;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
diff -r 7ffc8e870fbb -r a2dc899d0f22 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Mon Jan 16 11:29:10 2012 +0000
+++ b/tools/libxl/libxl_create.c        Mon Jan 16 11:33:18 2012 +0000
@@ -84,17 +84,18 @@ int libxl_init_build_info(libxl_ctx *ctx
     memset(b_info, '\0', sizeof(*b_info));
     b_info->type = c_info->type;
 
-    b_info->device_model_version =
-        LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
-    b_info->device_model_stubdomain = false;
-    b_info->device_model = NULL;
-
     return 0;
 }
 
 int libxl__domain_build_info_setdefaults(libxl__gc *gc,
                                          libxl_domain_build_info *b_info)
 {
+    if (!b_info->device_model_version)
+        b_info->device_model_version =
+            LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+
+    libxl_defbool_setdefault(&b_info->device_model_stubdomain, false);
+
     if (!b_info->max_vcpus)
         b_info->max_vcpus = 1;
     if (!b_info->cur_vcpus)
diff -r 7ffc8e870fbb -r a2dc899d0f22 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Mon Jan 16 11:29:10 2012 +0000
+++ b/tools/libxl/libxl_dm.c    Mon Jan 16 11:33:18 2012 +0000
@@ -47,7 +47,7 @@ const char *libxl__domain_device_model(l
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const char *dm;
 
-    if (info->device_model_stubdomain)
+    if (libxl_defbool_val(info->device_model_stubdomain))
         return NULL;
 
     if (info->device_model) {
@@ -921,7 +921,7 @@ int libxl__create_device_model(libxl__gc
     char **pass_stuff;
     const char *dm;
 
-    if (b_info->device_model_stubdomain) {
+    if (libxl_defbool_val(b_info->device_model_stubdomain)) {
         rc = libxl__create_stubdom(gc, domid, guest_config, state, starting_r);
         goto out;
     }
diff -r 7ffc8e870fbb -r a2dc899d0f22 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Mon Jan 16 11:29:10 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Mon Jan 16 11:33:18 2012 +0000
@@ -218,8 +218,8 @@ libxl_domain_build_info = Struct("domain
     ("type",            libxl_domain_type),
     
     ("device_model_version", libxl_device_model_version),
-    ("device_model_stubdomain", bool),
-    # you set device_model you must set device_model_version too
+    ("device_model_stubdomain", libxl_defbool),
+    # if you set device_model you must set device_model_version too
     ("device_model",     string),
 
     # extra parameters pass directly to qemu, NULL terminated
diff -r 7ffc8e870fbb -r a2dc899d0f22 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Jan 16 11:29:10 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Mon Jan 16 11:33:18 2012 +0000
@@ -1166,8 +1166,8 @@ skip_vfb:
         }
     } else if (b_info->device_model)
         fprintf(stderr, "WARNING: device model override given without specific 
DM version\n");
-    if (!xlu_cfg_get_long (config, "device_model_stubdomain_override", &l, 0))
-        b_info->device_model_stubdomain = l;
+    xlu_cfg_get_defbool (config, "device_model_stubdomain_override",
+                         &b_info->device_model_stubdomain, 0);
 
 #define parse_extra_args(type)                                            \
     e = xlu_cfg_get_list_as_string_list(config, "device_model_args"#type, \

_______________________________________________
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®.