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] Remus: Initiate failover if a packet is n

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Remus: Initiate failover if a packet is not received every 500ms.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 09 Nov 2009 12:00:30 -0800
Delivery-date: Mon, 09 Nov 2009 12:00:54 -0800
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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1257794134 0
# Node ID 139a8a2536589b8555ef16cc24dda2ddb6802530
# Parent  0f893b8f7c152990cb3be458427827506a500f44
Remus: Initiate failover if a packet is not received every 500ms.

This breaks checkpoints at lower frequencies, and should be made
optional.

Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
---
 tools/libxc/xc_domain_restore.c |   52 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 51 insertions(+), 1 deletion(-)

diff -r 0f893b8f7c15 -r 139a8a253658 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c   Mon Nov 09 19:14:03 2009 +0000
+++ b/tools/libxc/xc_domain_restore.c   Mon Nov 09 19:15:34 2009 +0000
@@ -453,6 +453,51 @@ alloc_page:
 }
 
 
+/* set when a consistent image is available */
+static int completed = 0;
+
+#define HEARTBEAT_MS 500
+
+#ifndef __MINIOS__
+static ssize_t read_exact_timed(int fd, void* buf, size_t size)
+{
+    size_t offset = 0;
+    ssize_t len;
+    struct timeval tv;
+    fd_set rfds;
+
+    while ( offset < size )
+    {
+        if ( completed ) {
+            /* expect a heartbeat every HEARBEAT_MS ms maximum */
+            tv.tv_sec = 0;
+            tv.tv_usec = HEARTBEAT_MS * 1000;
+
+            FD_ZERO(&rfds);
+            FD_SET(fd, &rfds);
+            len = select(fd + 1, &rfds, NULL, NULL, &tv);
+            if ( !FD_ISSET(fd, &rfds) ) {
+                fprintf(stderr, "read_exact_timed failed (select returned 
%zd)\n", len);
+                return -1;
+            }
+        }
+
+        len = read(fd, buf + offset, size - offset);
+        if ( (len == -1) && ((errno == EINTR) || (errno == EAGAIN)) )
+            continue;
+        if ( len <= 0 )
+            return -1;
+        offset += len;
+    }
+
+    return 0;
+}
+
+#define read_exact read_exact_timed
+
+#else
+#define read_exact_timed read_exact
+#endif
 /*
 ** In the state file (or during transfer), all page-table pages are
 ** converted into a 'canonical' form where references to actual mfns
@@ -1079,7 +1124,6 @@ int xc_domain_restore(int xc_handle, int
     /* Buffer for holding HVM context */
     uint8_t *hvm_buf = NULL;
 
-    int completed = 0;
     pagebuf_t pagebuf;
     tailbuf_t tailbuf, tmptail;
     void* vcpup;
@@ -1342,12 +1386,18 @@ int xc_domain_restore(int xc_handle, int
     /* Non-HVM guests only from here on */
 
     if ( !completed ) {
+        int flags = 0;
+
         if ( buffer_tail(&tailbuf, io_fd, max_vcpu_id, vcpumap,
                          ext_vcpucontext) < 0 ) {
             ERROR ("error buffering image tail");
             goto out;
         }
         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);
     }
 
     // DPRINTF("Buffered checkpoint\n");

_______________________________________________
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] Remus: Initiate failover if a packet is not received every 500ms., Xen patchbot-unstable <=