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

[Xen-devel] [PATCH 16 of 23] libxl: switch generation id control to libxl_defbool



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1329150447 0
# Node ID 42c448aa641537798f4b09a6db55f3a5ee4082cd
# Parent  ca432f4ad9f58b0a0a87045a680e37a123bbda11
libxl: switch generation id control to libxl_defbool.

This allows it to be set via the _init/_setdefault methods.

Also switch the sense of the variable in the libxl API, since once you add
defbool to the mix the double negatives become even more confusing.

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

diff -r ca432f4ad9f5 -r 42c448aa6415 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Mon Feb 13 15:49:01 2012 +0000
+++ b/tools/libxl/libxl_create.c        Mon Feb 13 16:27:27 2012 +0000
@@ -88,7 +88,6 @@ void libxl_domain_build_info_init(libxl_
     case LIBXL_DOMAIN_TYPE_HVM:
         b_info->u.hvm.firmware = NULL;
         b_info->u.hvm.timer_mode = LIBXL_TIMER_MODE_DEFAULT;
-        b_info->u.hvm.no_incr_generationid = 0;
 
         b_info->u.hvm.stdvga = 0;
         b_info->u.hvm.vnc.enable = 1;
@@ -150,6 +149,8 @@ int libxl__domain_build_info_setdefault(
         libxl_defbool_setdefault(&b_info->u.hvm.hpet, true);
         libxl_defbool_setdefault(&b_info->u.hvm.vpt_align, true);
         libxl_defbool_setdefault(&b_info->u.hvm.nested_hvm, false);
+        libxl_defbool_setdefault(&b_info->u.hvm.incr_generationid, false);
+
         libxl_defbool_setdefault(&b_info->u.hvm.usb, false);
         libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci, true);
 
diff -r ca432f4ad9f5 -r 42c448aa6415 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Mon Feb 13 15:49:01 2012 +0000
+++ b/tools/libxl/libxl_dom.c   Mon Feb 13 16:27:27 2012 +0000
@@ -406,7 +406,7 @@ int libxl__domain_restore_common(libxl__
         hvm = 1;
         superpages = 1;
         pae = libxl_defbool_val(info->u.hvm.pae);
-        no_incr_generationid = info->u.hvm.no_incr_generationid;
+        no_incr_generationid = 
!libxl_defbool_val(info->u.hvm.incr_generationid);
         break;
     case LIBXL_DOMAIN_TYPE_PV:
         hvm = 0;
diff -r ca432f4ad9f5 -r 42c448aa6415 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Mon Feb 13 15:49:01 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Mon Feb 13 16:27:27 2012 +0000
@@ -243,7 +243,7 @@ libxl_domain_build_info = Struct("domain
                                        ("vpt_align",        libxl_defbool),
                                        ("timer_mode",       libxl_timer_mode),
                                        ("nested_hvm",       libxl_defbool),
-                                       ("no_incr_generationid", bool),
+                                       ("incr_generationid",libxl_defbool),
                                        ("nographic",        bool),
                                        ("stdvga",           bool),
                                        ("vnc",              libxl_vnc_info),
diff -r ca432f4ad9f5 -r 42c448aa6415 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Feb 13 15:49:01 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Mon Feb 13 16:27:27 2012 +0000
@@ -1350,7 +1350,7 @@ struct domain_create {
     const char *restore_file;
     int migrate_fd; /* -1 means none */
     char **migration_domname_r; /* from malloc */
-    int no_incr_generationid;
+    int incr_generationid;
 };
 
 static int freemem(libxl_domain_build_info *b_info)
@@ -1601,8 +1601,8 @@ static int create_domain(struct domain_c
     }
 
     if (d_config.c_info.type == LIBXL_DOMAIN_TYPE_HVM)
-        d_config.b_info.u.hvm.no_incr_generationid =
-            dom_info->no_incr_generationid;
+        libxl_defbool_set(&d_config.b_info.u.hvm.incr_generationid,
+                          dom_info->incr_generationid);
 
     if (debug || dom_info->dryrun)
         printf_info(default_output_format, -1, &d_config);
@@ -2877,7 +2877,7 @@ static void migrate_receive(int debug, i
     dom_info.restore_file = "incoming migration stream";
     dom_info.migrate_fd = 0; /* stdin */
     dom_info.migration_domname_r = &migration_domname;
-    dom_info.no_incr_generationid = 1;
+    dom_info.incr_generationid = 0;
 
     rc = create_domain(&dom_info);
     if (rc < 0) {
@@ -3002,6 +3002,7 @@ int main_restore(int argc, char **argv)
     dom_info.restore_file = checkpoint_file;
     dom_info.migrate_fd = -1;
     dom_info.console_autoconnect = console_autoconnect;
+    dom_info.incr_generationid = 1;
 
     rc = create_domain(&dom_info);
     if (rc < 0)
@@ -3384,6 +3385,7 @@ int main_create(int argc, char **argv)
     dom_info.extra_config = extra_config;
     dom_info.migrate_fd = -1;
     dom_info.console_autoconnect = console_autoconnect;
+    dom_info.incr_generationid = 0;
 
     rc = create_domain(&dom_info);
     if (rc < 0)
diff -r ca432f4ad9f5 -r 42c448aa6415 tools/libxl/xl_sxp.c
--- a/tools/libxl/xl_sxp.c      Mon Feb 13 15:49:01 2012 +0000
+++ b/tools/libxl/xl_sxp.c      Mon Feb 13 16:27:27 2012 +0000
@@ -108,8 +108,8 @@ void printf_info_sexp(int domid, libxl_d
                libxl_timer_mode_to_string(b_info->u.hvm.timer_mode));
         printf("\t\t\t(nestedhvm %s)\n",
                libxl_defbool_to_string(b_info->u.hvm.nested_hvm));
-        printf("\t\t\t(no_incr_generationid %d)\n",
-                    b_info->u.hvm.no_incr_generationid);
+        printf("\t\t\t(no_incr_generationid %s)\n",
+               libxl_defbool_to_string(b_info->u.hvm.incr_generationid));
 
         printf("\t\t\t(stdvga %d)\n", b_info->u.hvm.stdvga);
         printf("\t\t\t(vnc %d)\n", b_info->u.hvm.vnc.enable);

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