All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wen Congyang <wency@cn.fujitsu.com>
To: Dong Eddie <eddie.dong@intel.com>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	xen-devl <xen-devel@lists.xen.org>,
	Shriram Rajagopalan <rshriram@cs.ubc.ca>
Cc: Jiang Yunhong <yunhong.jiang@intel.com>,
	Wen Congyang <wency@cn.fujitsu.com>,
	Ye Wei <wei.ye1987@gmail.com>, Xu Yao <xuyao.xu@huawei.com>,
	Hong Tao <bobby.hong@huawei.com>
Subject: [RFC Patch v2 16/16] remus: implement colo mode
Date: Thu, 11 Jul 2013 16:35:48 +0800	[thread overview]
Message-ID: <1373531748-12547-17-git-send-email-wency@cn.fujitsu.com> (raw)
In-Reply-To: <1373531748-12547-1-git-send-email-wency@cn.fujitsu.com>

Add a new option --colo to the command remus. We will ignore the
options: --time, -i, --no-net when --colo is specified. In colo
mode, we will write new signature "GuestColoRestore". If the xen-tool
in secondary machine does not support colo, it will reject this
signature, and the command remus will fail.

Signed-off-by: Ye Wei <wei.ye1987@gmail.com>
Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
---
 tools/python/xen/remus/image.py |    8 ++++++--
 tools/python/xen/remus/save.py  |    7 +++++--
 tools/remus/remus               |   20 +++++++++++++++++---
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/tools/python/xen/remus/image.py b/tools/python/xen/remus/image.py
index b79d1e5..6bae8f4 100644
--- a/tools/python/xen/remus/image.py
+++ b/tools/python/xen/remus/image.py
@@ -5,6 +5,7 @@ import logging, struct
 import vm
 
 SIGNATURE = 'LinuxGuestRecord'
+COLO_SIGNATURE = "GuestColoRestore"
 LONGLEN = struct.calcsize('L')
 INTLEN = struct.calcsize('i')
 PAGE_SIZE = 4096
@@ -189,9 +190,12 @@ def parseheader(header):
     "parses a header sexpression"
     return vm.parsedominfo(vm.strtosxpr(header))
 
-def makeheader(dominfo):
+def makeheader(dominfo, colo):
     "create an image header from a VM dominfo sxpr"
-    items = [SIGNATURE]
+    if colo:
+        items = [COLO_SIGNATURE]
+    else:
+        items = [SIGNATURE]
     sxpr = vm.sxprtostr(dominfo)
     items.append(struct.pack('!i', len(sxpr)))
     items.append(sxpr)
diff --git a/tools/python/xen/remus/save.py b/tools/python/xen/remus/save.py
index 81e05b9..45be172 100644
--- a/tools/python/xen/remus/save.py
+++ b/tools/python/xen/remus/save.py
@@ -133,7 +133,8 @@ class Keepalive(object):
 
 class Saver(object):
     def __init__(self, domid, fd, suspendcb=None, resumecb=None,
-                 checkpointcb=None, setupcb=None, interval=0, flags=0):
+                 checkpointcb=None, setupcb=None, interval=0, flags=0,
+                 colo=False):
         """Create a Saver object for taking guest checkpoints.
         domid:        name, number or UUID of a running domain
         fd:           a stream to which checkpoint data will be written.
@@ -143,6 +144,7 @@ class Saver(object):
                       True to take another checkpoint, or False to stop.
         flags:        Remus flags to be passed to xc_domain_save
         setupcb:      callback invoked to configure network for colo
+        colo:         use colo mode
         """
         self.fd = fd
         self.suspendcb = suspendcb
@@ -151,6 +153,7 @@ class Saver(object):
         self.interval = interval
         self.flags = flags
         self.setupcb = setupcb
+        self.colo = colo
 
         self.vm = vm.VM(domid)
 
@@ -159,7 +162,7 @@ class Saver(object):
     def start(self):
         vm.getshadowmem(self.vm)
 
-        hdr = image.makeheader(self.vm.dominfo)
+        hdr = image.makeheader(self.vm.dominfo, self.colo)
         self.fd.write(hdr)
         self.fd.flush()
 
diff --git a/tools/remus/remus b/tools/remus/remus
index 7be7fdd..592c8cc 100644
--- a/tools/remus/remus
+++ b/tools/remus/remus
@@ -18,6 +18,7 @@ class CfgException(Exception): pass
 class Cfg(object):
 
     REMUS_FLAGS_COMPRESSION = 1
+    REMUS_FLAGS_COLO = 2
 
     def __init__(self):
         # must be set
@@ -30,6 +31,7 @@ class Cfg(object):
         self.netbuffer = True
         self.flags = self.REMUS_FLAGS_COMPRESSION
         self.timer = False
+        self.colo = False
 
         parser = optparse.OptionParser()
         parser.usage = '%prog [options] domain [destination]'
@@ -46,6 +48,8 @@ class Cfg(object):
                           help='run without checkpoint compression')
         parser.add_option('', '--timer', dest='timer', action='store_true',
                           help='force pause at checkpoint interval (experimental)')
+        parser.add_option('', '--colo', dest='colo', action='store_true',
+                          help='use colo checkpointing (experimental)')
         self.parser = parser
 
     def usage(self):
@@ -66,6 +70,12 @@ class Cfg(object):
             self.flags &= ~self.REMUS_FLAGS_COMPRESSION
         if opts.timer:
             self.timer = True
+        if opts.colo:
+            self.interval = 0
+            self.netbuffer = False
+            self.timer = True
+            self.colo = True
+            self.flags |= self.REMUS_FLAGS_COLO
 
         if not args:
             raise CfgException('Missing domain')
@@ -123,8 +133,12 @@ def run(cfg):
     if not cfg.nullremus:
         for disk in dom.disks:
             try:
-                bufs.append(ReplicatedDisk(disk))
-                disk.init('r')
+                rdisk = ReplicatedDisk(disk)
+                bufs.append(rdisk)
+                if cfg.colo:
+                    rdisk.init('c')
+                else:
+                    rdisk.init('r')
             except ReplicatedDiskException, e:
                 print e
                 continue
@@ -208,7 +222,7 @@ def run(cfg):
     rc = 0
 
     checkpointer = save.Saver(cfg.domid, fd, postsuspend, preresume, commit,
-                              setup, interval, cfg.flags)
+                              setup, interval, cfg.flags, cfg.colo)
 
     try:
         checkpointer.start()
-- 
1.7.4

  parent reply	other threads:[~2013-07-11  8:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11  8:35 [RFC Patch v2 00/16] COarse-grain LOck-stepping Virtual Machines for Non-stop Service Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 01/16] xen: introduce new hypercall to reset vcpu Wen Congyang
2013-07-11  9:44   ` Andrew Cooper
2013-07-11  9:58     ` Wen Congyang
2013-07-11 10:01       ` Ian Campbell
2013-08-01 11:48   ` Tim Deegan
2013-08-06  6:47     ` Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 02/16] block-remus: introduce colo mode Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 03/16] block-remus: introduce a interface to allow the user specify which mode the backup end uses Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 04/16] dominfo.completeRestore() will be called more than once in colo mode Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 05/16] xc_domain_restore: introduce restore_callbacks for colo Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 06/16] colo: implement restore_callbacks init()/free() Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 07/16] colo: implement restore_callbacks get_page() Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 08/16] colo: implement restore_callbacks flush_memory Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 09/16] colo: implement restore_callbacks update_p2m() Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 10/16] colo: implement restore_callbacks finish_restore() Wen Congyang
2013-07-11  9:40   ` Ian Campbell
2013-07-11  9:54     ` Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 11/16] xc_restore: implement for colo Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 12/16] XendCheckpoint: implement colo Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 13/16] xc_domain_save: flush cache before calling callbacks->postcopy() Wen Congyang
2013-07-11 13:43   ` Andrew Cooper
2013-07-12  1:36     ` Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 14/16] add callback to configure network for colo Wen Congyang
2013-07-11  8:35 ` [RFC Patch v2 15/16] xc_domain_save: implement save_callbacks " Wen Congyang
2013-07-11 13:52   ` Andrew Cooper
2013-07-11  8:35 ` Wen Congyang [this message]
2013-07-11  9:37 ` [RFC Patch v2 00/16] COarse-grain LOck-stepping Virtual Machines for Non-stop Service Andrew Cooper
2013-07-11  9:40 ` Ian Campbell
2013-07-14 14:33   ` Shriram Rajagopalan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373531748-12547-17-git-send-email-wency@cn.fujitsu.com \
    --to=wency@cn.fujitsu.com \
    --cc=bobby.hong@huawei.com \
    --cc=eddie.dong@intel.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=rshriram@cs.ubc.ca \
    --cc=wei.ye1987@gmail.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xuyao.xu@huawei.com \
    --cc=yunhong.jiang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.