WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxc: provide notification of final chec

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: provide notification of final checkpoint to restore end
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Sep 2010 14:40:23 -0700
Delivery-date: Fri, 10 Sep 2010 14:42:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1283882891 -3600
# Node ID a936b806eae10f53a3ca59cd5a62b5ce2b201e7a
# Parent  fc00d97c84a31de160e31cb3e276ee346ff29aa7
libxc: provide notification of final checkpoint to restore end

When the restore code sees this notification it will restore the
currently in-progress checkpoint when it completes.

This allows the restore end to finish up without waiting for a
spurious timeout on the receive fd and thereby avoids unnecessary
error logging in the case of a successful migration or restore.

In the normal migration or restore case the first checkpoint is always
the last. For a rolling checkpoint (such as Remus) the notification is
currently unused but could be used in the future for example to
provide a controlled failover for reasons other than error

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Brendan Cully <brendan@xxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxc/xc_domain_restore.c |   27 +++++++++++++++++++++++----
 tools/libxc/xc_domain_save.c    |   14 ++++++++++++++
 tools/libxc/xg_save_restore.h   |    1 +
 3 files changed, 38 insertions(+), 4 deletions(-)

diff -r fc00d97c84a3 -r a936b806eae1 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c   Tue Sep 07 19:05:17 2010 +0100
+++ b/tools/libxc/xc_domain_restore.c   Tue Sep 07 19:08:11 2010 +0100
@@ -42,6 +42,7 @@ struct restore_ctx {
     xen_pfn_t *p2m; /* A table mapping each PFN to its new MFN. */
     xen_pfn_t *p2m_batch; /* A table of P2M mappings in the current region.  */
     int completed; /* Set when a consistent image is available */
+    int last_checkpoint; /* Set when we should commit to the current 
checkpoint when it completes. */
     struct domain_info_context dinfo;
 };
 
@@ -765,6 +766,11 @@ static int pagebuf_get_one(xc_interface 
         // DPRINTF("console pfn location: %llx\n", buf->console_pfn);
         return pagebuf_get_one(xch, ctx, buf, fd, dom);
 
+    case XC_SAVE_ID_LAST_CHECKPOINT:
+        ctx->last_checkpoint = 1;
+        // DPRINTF("last checkpoint indication received");
+        return pagebuf_get_one(xch, ctx, buf, fd, dom);
+
     default:
         if ( (count > MAX_BATCH_SIZE) || (count < 0) ) {
             ERROR("Max batch size exceeded (%d). Giving up.", count);
@@ -1296,10 +1302,23 @@ int xc_domain_restore(xc_interface *xch,
             goto out;
         }
         ctx->completed = 1;
-        /* shift into nonblocking mode for the remainder */
-        if ( (flags = fcntl(io_fd, F_GETFL,0)) < 0 )
-            flags = 0;
-        fcntl(io_fd, F_SETFL, flags | O_NONBLOCK);
+
+        /*
+         * If more checkpoints are expected then shift into
+         * nonblocking mode for the remainder.
+         */
+        if ( !ctx->last_checkpoint )
+        {
+            if ( (flags = fcntl(io_fd, F_GETFL,0)) < 0 )
+                flags = 0;
+            fcntl(io_fd, F_SETFL, flags | O_NONBLOCK);
+        }
+    }
+
+    if ( ctx->last_checkpoint )
+    {
+        // DPRINTF("Last checkpoint, finishing\n");
+        goto finish;
     }
 
     // DPRINTF("Buffered checkpoint\n");
diff -r fc00d97c84a3 -r a936b806eae1 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c      Tue Sep 07 19:05:17 2010 +0100
+++ b/tools/libxc/xc_domain_save.c      Tue Sep 07 19:08:11 2010 +0100
@@ -1616,6 +1616,20 @@ int xc_domain_save(xc_interface *xch, in
         }
     }
 
+    if ( !callbacks->checkpoint )
+    {
+        /*
+         * If this is not a checkpointed save then this must be the first and
+         * last checkpoint.
+         */
+        i = XC_SAVE_ID_LAST_CHECKPOINT;
+        if ( wrexact(io_fd, &i, sizeof(int)) )
+        {
+            PERROR("Error when writing last checkpoint chunk");
+            goto out;
+        }
+    }
+
     /* Zero terminate */
     i = 0;
     if ( wrexact(io_fd, &i, sizeof(int)) )
diff -r fc00d97c84a3 -r a936b806eae1 tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h     Tue Sep 07 19:05:17 2010 +0100
+++ b/tools/libxc/xg_save_restore.h     Tue Sep 07 19:08:11 2010 +0100
@@ -131,6 +131,7 @@
 #define XC_SAVE_ID_TMEM_EXTRA         -6
 #define XC_SAVE_ID_TSC_INFO           -7
 #define XC_SAVE_ID_HVM_CONSOLE_PFN    -8 /* (HVM-only) */
+#define XC_SAVE_ID_LAST_CHECKPOINT    -9 /* Commit to restoring after 
completion of current iteration. */
 
 /*
 ** We process save/restore/migrate in batches of pages; the below

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxc: provide notification of final checkpoint to restore end, Xen patchbot-unstable <=