From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shriram Rajagopalan Subject: Re: [PATCH 1/4] remus: remove old remus script Date: Wed, 25 Jun 2014 02:12:44 -0500 Message-ID: References: <1403679610-26695-1-git-send-email-yanghy@cn.fujitsu.com> Reply-To: rshriram@cs.ubc.ca Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8546957859167645769==" Return-path: In-Reply-To: <1403679610-26695-1-git-send-email-yanghy@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: FNST-Yang Hongyang , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============8546957859167645769== Content-Type: multipart/alternative; boundary=20cf304352ce8107d104fca3cd22 --20cf304352ce8107d104fca3cd22 Content-Type: text/plain; charset=UTF-8 On Jun 25, 2014 12:34 PM, "Yang Hongyang" wrote: > > Since xend already deleted, the old remus script which based on > xend no longer functional, remove it. > > Signed-off-by: Yang Hongyang > --- > tools/remus/Makefile | 15 ---- > tools/remus/remus | 230 --------------------------------------------------- > 2 files changed, 245 deletions(-) > delete mode 100644 tools/remus/Makefile > delete mode 100644 tools/remus/remus > > diff --git a/tools/remus/Makefile b/tools/remus/Makefile > deleted file mode 100644 > index ae82376..0000000 > --- a/tools/remus/Makefile > +++ /dev/null > @@ -1,15 +0,0 @@ > -XEN_ROOT=$(CURDIR)/../.. > -include $(XEN_ROOT)/tools/Rules.mk > - > -SCRIPTS = remus > - > -.PHONY: all > -all: subdirs-all > - > -.PHONY: install > -install: subdirs-install > - $(INSTALL_DIR) $(DESTDIR)$(BINDIR) > - $(INSTALL_PYTHON_PROG) $(SCRIPTS) $(DESTDIR)$(BINDIR) > - > -.PHONY: clean > -clean: subdirs-clean > diff --git a/tools/remus/remus b/tools/remus/remus > deleted file mode 100644 > index 38f0365..0000000 > --- a/tools/remus/remus > +++ /dev/null > @@ -1,230 +0,0 @@ > -#!/usr/bin/env python > -# > -# This is a save process which also buffers outgoing I/O between > -# rounds, so that external viewers never see anything that hasn't > -# been committed at the backup > -# > -# TODO: fencing. > - > -import optparse, os, re, select, signal, sys, time > - > -from xen.remus import save, util, vm > -from xen.remus.device import ReplicatedDisk, ReplicatedDiskException > -from xen.remus.device import BufferedNIC, BufferedNICException > -from xen.xend import XendOptions > - > -class CfgException(Exception): pass > - > -class Cfg(object): > - > - REMUS_FLAGS_COMPRESSION = 1 > - > - def __init__(self): > - # must be set > - self.domid = 0 > - > - self.host = 'localhost' > - self.nullremus = False > - self.port = XendOptions.instance().get_xend_relocation_port() > - self.interval = 200 > - self.netbuffer = True > - self.flags = self.REMUS_FLAGS_COMPRESSION > - self.timer = False > - > - parser = optparse.OptionParser() > - parser.usage = '%prog [options] domain [destination]' > - parser.add_option('-i', '--interval', dest='interval', type='int', > - metavar='MS', > - help='checkpoint every MS milliseconds') > - parser.add_option('-p', '--port', dest='port', type='int', > - help='send stream to port PORT', metavar='PORT') > - parser.add_option('', '--blackhole', dest='nullremus', action='store_true', > - help='replicate to /dev/null (no disk checkpoints, only memory & net buffering)') > - parser.add_option('', '--no-net', dest='nonet', action='store_true', > - help='run without net buffering (benchmark option)') > - parser.add_option('', '--no-compression', dest='nocompress', action='store_true', > - help='run without checkpoint compression') > - parser.add_option('', '--timer', dest='timer', action='store_true', > - help='force pause at checkpoint interval (experimental)') > - self.parser = parser > - > - def usage(self): > - self.parser.print_help() > - > - def getargs(self): > - opts, args = self.parser.parse_args() > - > - if opts.interval: > - self.interval = opts.interval > - if opts.port: > - self.port = opts.port > - if opts.nullremus: > - self.nullremus = True > - if opts.nonet: > - self.netbuffer = False > - if opts.nocompress: > - self.flags &= ~self.REMUS_FLAGS_COMPRESSION > - if opts.timer: > - self.timer = True > - > - if not args: > - raise CfgException('Missing domain') > - self.domid = args[0] > - if (len(args) > 1): > - self.host = args[1] > - > -class SignalException(Exception): pass > - > -def run(cfg): > - closure = lambda: None > - closure.cmd = None > - > - def sigexception(signo, frame): > - raise SignalException(signo) > - > - def die(): > - # I am not sure what the best way to die is. xm destroy is another option, > - # or we could attempt to trigger some instant reboot. > - print "dying..." > - print util.runcmd(['sudo', 'ifdown', 'eth2']) > - # dangling imq0 handle on vif locks up the system > - for buf in bufs: > - buf.uninstall() > - print util.runcmd(['sudo', 'xm', 'destroy', cfg.domid]) > - print util.runcmd(['sudo', 'ifup', 'eth2']) > - > - def getcommand(): > - """Get a command to execute while running. > - Commands include: > - s: die prior to postsuspend hook > - s2: die after postsuspend hook > - r: die prior to preresume hook > - r2: die after preresume hook > - c: die prior to commit hook > - c2: die after commit hook > - """ > - r, w, x = select.select([sys.stdin], [], [], 0) > - if sys.stdin not in r: > - return > - > - cmd = sys.stdin.readline().strip() > - if cmd not in ('s', 's2', 'r', 'r2', 'c', 'c2'): > - print "unknown command: %s" % cmd > - closure.cmd = cmd > - > - signal.signal(signal.SIGTERM, sigexception) > - > - dom = vm.VM(cfg.domid) > - > - # set up I/O buffers > - bufs = [] > - > - # disks must commit before network can be released > - if not cfg.nullremus: > - for disk in dom.disks: > - try: > - bufs.append(ReplicatedDisk(disk)) > - except ReplicatedDiskException, e: > - print e > - continue > - > - if cfg.netbuffer: > - for vif in dom.vifs: > - bufs.append(BufferedNIC(vif)) > - > - if cfg.nullremus: > - fd = save.NullSocket((cfg.host, cfg.port)) > - else: > - fd = save.MigrationSocket((cfg.host, cfg.port)) > - > - def postsuspend(): > - 'Begin external checkpointing after domain has paused' > - if not cfg.timer: > - # when not using a timer thread, sleep until now + interval > - closure.starttime = time.time() > - > - if closure.cmd == 's': > - die() > - > - for buf in bufs: > - buf.postsuspend() > - > - if closure.cmd == 's2': > - die() > - > - def preresume(): > - 'Complete external checkpointing before domain resumes' > - if closure.cmd == 'r': > - die() > - > - for buf in bufs: > - buf.preresume() > - > - if closure.cmd == 'r2': > - die() > - > - def commit(): > - 'commit network buffer' > - if closure.cmd == 'c': > - die() > - > - print >> sys.stderr, "PROF: flushed memory at %0.6f" % (time.time()) > - > - for buf in bufs: > - buf.commit() > - > - if closure.cmd == 'c2': > - die() > - > - # Since the domain is running at this point, it's a good time to > - # check for control channel commands > - getcommand() > - > - if not cfg.timer: > - endtime = time.time() > - elapsed = (endtime - closure.starttime) * 1000 > - > - if elapsed < cfg.interval: > - time.sleep((cfg.interval - elapsed) / 1000.0) > - > - # False ends checkpointing > - return True > - > - if cfg.timer: > - interval = cfg.interval > - else: > - interval = 0 > - > - rc = 0 > - > - checkpointer = save.Saver(cfg.domid, fd, postsuspend, preresume, commit, > - interval, cfg.flags) > - > - try: > - checkpointer.start() > - except save.CheckpointError, e: > - print e > - rc = 1 > - except KeyboardInterrupt: > - pass > - except SignalException: > - print '*** signalled ***' > - > - for buf in bufs: > - buf.uninstall() > - > - sys.exit(rc) > - > -cfg = Cfg() > -try: > - cfg.getargs() > -except CfgException, inst: > - print str(inst) > - cfg.usage() > - sys.exit(1) > - > -try: > - run(cfg) > -except vm.VMException, inst: > - print str(inst) > - sys.exit(1) > -- > 1.9.1 > Acked-by: Shriram Rajagopalan --20cf304352ce8107d104fca3cd22 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Jun 25, 2014 12:34 PM, "Yang Hongyang" <yanghy@cn.fujitsu.com> wrote:
>
> Since xend already deleted, the old remus script which based on
> xend no longer functional, remove it.
>
> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
> ---
> =C2=A0tools/remus/Makefile | =C2=A015 ----
> =C2=A0tools/remus/remus =C2=A0 =C2=A0| 230 ---------------------------= ------------------------
> =C2=A02 files changed, 245 deletions(-)
> =C2=A0delete mode 100644 tools/remus/Makefile
> =C2=A0delete mode 100644 tools/remus/remus
>
> diff --git a/tools/remus/Makefile b/tools/remus/Makefile
> deleted file mode 100644
> index ae82376..0000000
> --- a/tools/remus/Makefile
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -XEN_ROOT=3D$(CURDIR)/../..
> -include $(XEN_ROOT)/tools/Rules.mk
> -
> -SCRIPTS =3D remus
> -
> -.PHONY: all
> -all: subdirs-all
> -
> -.PHONY: install
> -install: subdirs-install
> - =C2=A0 =C2=A0 =C2=A0 $(INSTALL_DIR) $(DESTDIR)$(BINDIR)
> - =C2=A0 =C2=A0 =C2=A0 $(INSTALL_PYTHON_PROG) $(SCRIPTS) $(DESTDIR)$(B= INDIR)
> -
> -.PHONY: clean
> -clean: subdirs-clean
> diff --git a/tools/remus/remus b/tools/remus/remus
> deleted file mode 100644
> index 38f0365..0000000
> --- a/tools/remus/remus
> +++ /dev/null
> @@ -1,230 +0,0 @@
> -#!/usr/bin/env python
> -#
> -# This is a save process which also buffers outgoing I/O between
> -# rounds, so that external viewers never see anything that hasn't=
> -# been committed at the backup
> -#
> -# TODO: fencing.
> -
> -import optparse, os, re, select, signal, sys, time
> -
> -from xen.remus import save, util, vm
> -from xen.remus.device import ReplicatedDisk, ReplicatedDiskException<= br> > -from xen.remus.device import BufferedNIC, BufferedNICException
> -from xen.xend import XendOptions
> -
> -class CfgException(Exception): pass
> -
> -class Cfg(object):
> -
> - =C2=A0 =C2=A0REMUS_FLAGS_COMPRESSION =3D 1
> -
> - =C2=A0 =C2=A0def __init__(self):
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0# must be set
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.domid =3D 0
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.host =3D 'localhost'
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.nullremus =3D False
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.port =3D XendOptions.instance().get_= xend_relocation_port()
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.interval =3D 200
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.netbuffer =3D True
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.flags =3D self.REMUS_FLAGS_COMPRESSI= ON
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.timer =3D False
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0parser =3D optparse.OptionParser()
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.usage =3D '%prog [options] dom= ain [destination]'
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.add_option('-i', '--in= terval', dest=3D'interval', type=3D'int',
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0metavar=3D'MS',
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0help=3D'checkpoint every MS milliseconds')<= br> > - =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.add_option('-p', '--po= rt', dest=3D'port', type=3D'int',
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0help=3D'send stream to port PORT', metavar= =3D'PORT')
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.add_option('', '--blac= khole', dest=3D'nullremus', action=3D'store_true',
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0help=3D'replicate to /dev/null (no disk checkpo= ints, only memory & net buffering)')
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.add_option('', '--no-n= et', dest=3D'nonet', action=3D'store_true',
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0help=3D'run without net buffering (benchmark op= tion)')
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.add_option('', '--no-c= ompression', dest=3D'nocompress', action=3D'store_true'= ,
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0help=3D'run without checkpoint compression'= )
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.add_option('', '--time= r', dest=3D'timer', action=3D'store_true',
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0help=3D'force pause at checkpoint interval (exp= erimental)')
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.parser =3D parser
> -
> - =C2=A0 =C2=A0def usage(self):
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.parser.print_help()
> -
> - =C2=A0 =C2=A0def getargs(self):
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0opts, args =3D self.parser.parse_args() > -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if opts.interval:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.interval =3D opts.inte= rval
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if opts.port:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.port =3D opts.port
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if opts.nullremus:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.nullremus =3D True
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if opts.nonet:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.netbuffer =3D False > - =C2=A0 =C2=A0 =C2=A0 =C2=A0if opts.nocompress:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.flags &=3D ~self.R= EMUS_FLAGS_COMPRESSION
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if opts.timer:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.timer =3D True
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if not args:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise CfgException('Mis= sing domain')
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0self.domid =3D args[0]
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if (len(args) > 1):
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.host =3D args[1]
> -
> -class SignalException(Exception): pass
> -
> -def run(cfg):
> - =C2=A0 =C2=A0closure =3D lambda: None
> - =C2=A0 =C2=A0closure.cmd =3D None
> -
> - =C2=A0 =C2=A0def sigexception(signo, frame):
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0raise SignalException(signo)
> -
> - =C2=A0 =C2=A0def die():
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0# I am not sure what the best way to die = is. xm destroy is another option,
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0# or we could attempt to trigger some ins= tant reboot.
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0print "dying..."
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0print util.runcmd(['sudo', 'i= fdown', 'eth2'])
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0# dangling imq0 handle on vif locks up th= e system
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0for buf in bufs:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0buf.uninstall()
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0print util.runcmd(['sudo', 'x= m', 'destroy', cfg.domid])
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0print util.runcmd(['sudo', 'i= fup', 'eth2'])
> -
> - =C2=A0 =C2=A0def getcommand():
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0"""Get a command to execut= e while running.
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0Commands include:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s: die prior to postsuspend hook > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s2: die after postsuspend hook
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0r: die prior to preresume hook
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0r2: die after preresume hook
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0c: die prior to commit hook
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0c2: die after commit hook
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0r, w, x =3D select.select([sys.stdin], []= , [], 0)
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if sys.stdin not in r:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0cmd =3D sys.stdin.readline().strip()
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if cmd not in ('s', 's2',= 'r', 'r2', 'c', 'c2'):
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print "unknown command= : %s" % cmd
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0closure.cmd =3D cmd
> -
> - =C2=A0 =C2=A0signal.signal(signal.SIGTERM, sigexception)
> -
> - =C2=A0 =C2=A0dom =3D vm.VM(cfg.domid)
> -
> - =C2=A0 =C2=A0# set up I/O buffers
> - =C2=A0 =C2=A0bufs =3D []
> -
> - =C2=A0 =C2=A0# disks must commit before network can be released
> - =C2=A0 =C2=A0if not cfg.nullremus:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0for disk in dom.disks:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0try:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bufs.append(R= eplicatedDisk(disk))
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0except ReplicatedDiskExcept= ion, e:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print e
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0continue
> -
> - =C2=A0 =C2=A0if cfg.netbuffer:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0for vif in dom.vifs:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bufs.append(BufferedNIC(vif= ))
> -
> - =C2=A0 =C2=A0if cfg.nullremus:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0fd =3D save.NullSocket((cfg.host, cfg.por= t))
> - =C2=A0 =C2=A0else:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0fd =3D save.MigrationSocket((cfg.host, cf= g.port))
> -
> - =C2=A0 =C2=A0def postsuspend():
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0'Begin external checkpointing after d= omain has paused'
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if not cfg.timer:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# when not using a timer th= read, sleep until now + interval
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0closure.starttime =3D time.= time()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if closure.cmd =3D=3D 's':
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0die()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0for buf in bufs:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0buf.postsuspend()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if closure.cmd =3D=3D 's2':
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0die()
> -
> - =C2=A0 =C2=A0def preresume():
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0'Complete external checkpointing befo= re domain resumes'
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if closure.cmd =3D=3D 'r':
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0die()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0for buf in bufs:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0buf.preresume()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if closure.cmd =3D=3D 'r2':
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0die()
> -
> - =C2=A0 =C2=A0def commit():
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0'commit network buffer'
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if closure.cmd =3D=3D 'c':
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0die()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0print >> sys.stderr, "PROF: fl= ushed memory at %0.6f" % (time.time())
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0for buf in bufs:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0buf.commit()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if closure.cmd =3D=3D 'c2':
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0die()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0# Since the domain is running at this poi= nt, it's a good time to
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0# check for control channel commands
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0getcommand()
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if not cfg.timer:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0endtime =3D time.time()
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0elapsed =3D (endtime - clos= ure.starttime) * 1000
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if elapsed < cfg.interva= l:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0time.sleep((c= fg.interval - elapsed) / 1000.0)
> -
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0# False ends checkpointing
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0return True
> -
> - =C2=A0 =C2=A0if cfg.timer:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0interval =3D cfg.interval
> - =C2=A0 =C2=A0else:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0interval =3D 0
> -
> - =C2=A0 =C2=A0rc =3D 0
> -
> - =C2=A0 =C2=A0checkpointer =3D save.Saver(cfg.domid, fd, postsuspend,= preresume, commit,
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0interval, cfg.flags)
> -
> - =C2=A0 =C2=A0try:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0checkpointer.start()
> - =C2=A0 =C2=A0except save.CheckpointError, e:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0print e
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0rc =3D 1
> - =C2=A0 =C2=A0except KeyboardInterrupt:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0pass
> - =C2=A0 =C2=A0except SignalException:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0print '*** signalled ***'
> -
> - =C2=A0 =C2=A0for buf in bufs:
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0buf.uninstall()
> -
> - =C2=A0 =C2=A0sys.exit(rc)
> -
> -cfg =3D Cfg()
> -try:
> - =C2=A0 =C2=A0cfg.getargs()
> -except CfgException, inst:
> - =C2=A0 =C2=A0print str(inst)
> - =C2=A0 =C2=A0cfg.usage()
> - =C2=A0 =C2=A0sys.exit(1)
> -
> -try:
> - =C2=A0 =C2=A0run(cfg)
> -except vm.VMException, inst:
> - =C2=A0 =C2=A0print str(inst)
> - =C2=A0 =C2=A0sys.exit(1)
> --
> 1.9.1
>

Acked-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>

--20cf304352ce8107d104fca3cd22-- --===============8546957859167645769== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============8546957859167645769==--