libxc/migration: Pass checkpoint information into the save algorithm.
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 14 May 2015 08:55:06 +0000 (16:55 +0800)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 14 May 2015 12:01:11 +0000 (13:01 +0100)
The old code checks the callbacks "postcopy & checkpoint", if the
callbacks exists, it will call them. However this is unreliable, so
add this flag to explicitly indicate a checkpointed stream in the new
code. This is backward compatible with the legacy migration just don't
know this flag and will ignore it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Yang Hongyang <yanghy@cn.fujitsu.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
[ ijc -- added discussion of legacy compat ]

tools/libxc/include/xenguest.h
tools/libxc/xc_sr_common.h
tools/libxc/xc_sr_save.c
tools/libxl/libxl_dom.c

index 8e390758ee0abe9694af35b95f20ba2936d9bd1c..7581263b82fa65f9a84a006373e609445484574d 100644 (file)
@@ -30,6 +30,7 @@
 #define XCFLAGS_HVM       (1 << 2)
 #define XCFLAGS_STDVGA    (1 << 3)
 #define XCFLAGS_CHECKPOINT_COMPRESS    (1 << 4)
+#define XCFLAGS_CHECKPOINTED    (1 << 5)
 
 #define X86_64_B_SIZE   64 
 #define X86_32_B_SIZE   32
index c4fe92cc60cac3eadfdaa816fa30d2fdb7ff80a3..c0f90d4f777f3344e19b08461ab45435499128e1 100644 (file)
@@ -174,6 +174,9 @@ struct xc_sr_context
             /* Live migrate vs non live suspend. */
             bool live;
 
+            /* Plain VM, or checkpoints over time. */
+            bool checkpointed;
+
             /* Further debugging information in the stream. */
             bool debug;
 
index 66fcd3e546576916276c19bc02dd2c4376816990..caa727d6ac11694e3bf0a84823d1ed98ff61579c 100644 (file)
@@ -732,6 +732,7 @@ int xc_domain_save2(xc_interface *xch, int io_fd, uint32_t dom,
     ctx.save.callbacks = callbacks;
     ctx.save.live  = !!(flags & XCFLAGS_LIVE);
     ctx.save.debug = !!(flags & XCFLAGS_DEBUG);
+    ctx.save.checkpointed = !!(flags & XCFLAGS_CHECKPOINTED);
 
     /*
      * TODO: Find some time to better tweak the live migration algorithm.
@@ -745,6 +746,8 @@ int xc_domain_save2(xc_interface *xch, int io_fd, uint32_t dom,
     /* Sanity checks for callbacks. */
     if ( hvm )
         assert(callbacks->switch_qemu_logdirty);
+    if ( ctx.save.checkpointed )
+        assert(callbacks->checkpoint && callbacks->postcopy);
 
     IPRINTF("In experimental %s", __func__);
     DPRINTF("fd %d, dom %u, max_iters %u, max_factor %u, flags %u, hvm %d",
index f408646ea0a832a42df6d97f6076a71d7a3010c1..a0c9850324c9efb0f20eeeb43a641aa3f1fb7c61 100644 (file)
@@ -2003,6 +2003,7 @@ void libxl__domain_suspend(libxl__egc *egc, libxl__domain_suspend_state *dss)
 
     if (r_info != NULL) {
         dss->interval = r_info->interval;
+        dss->xcflags |= XCFLAGS_CHECKPOINTED;
         if (libxl_defbool_val(r_info->compression))
             dss->xcflags |= XCFLAGS_CHECKPOINT_COMPRESS;
     }