[lxc-devel] [PATCH] Add support for checkpoint and restore via CRIU

Stéphane Graber stgraber at ubuntu.com
Wed Aug 20 14:50:28 UTC 2014


On Wed, Aug 20, 2014 at 07:32:34AM -0500, Tycho Andersen wrote:
> Hi Stéphane,
> 
> On Tue, Aug 19, 2014 at 10:40:15PM -0500, Stéphane Graber wrote:
> > On Tue, Aug 19, 2014 at 10:14:03PM -0500, Tycho Andersen wrote:
> > > This patch adds support for checkpointing and restoring containers via CRIU.
> > > It adds two api calls, ->checkpoint and ->restore, which are wrappers around
> > > the CRIU CLI. CRIU has an RPC API, but reasons for preferring exec() are
> > > discussed in [1].
> > > 
> > > To checkpoint, users specify a directory to dump the container metadata (CRIU
> > > dump files, plus some additional information about veth pairs and which
> > > bridges they are attached to) into this directory. On restore, this
> > > information is read out of the directory, a CRIU command line is constructed,
> > > and CRIU is exec()d. CRIU uses the lxc-restore-net callback (which in turn
> > > inspects the image directory with the NIC data) to properly restore the
> > > network.
> > > 
> > > This will only work with the current git master of CRIU; anything as of
> > > a152c843 should work. There is a known bug where containers which have been
> > > restored cannot be checkpointed [2].
> > > 
> > > [1]: http://lists.openvz.org/pipermail/criu/2014-July/015117.html
> > > [2]: http://lists.openvz.org/pipermail/criu/2014-August/015876.html
> > > 
> > 
> > Thanks for that work!
> > 
> > Just one comment before I dive in a bit closer, I'd really rather we
> > just have one command, say lxc-checkpoint which does both the dumping
> > and the restarting rather than have the extremely confusing lxc-restart
> > (which to most user will sound like an equivalent to c->reboot(c).
> 
> It is lxc-restore (vs. -restart), not sure if that changes your mind
> at all.

Oops, should have read a bit more carefully :)

It is a bit less confusin indeed, though restore may be confusing with
snapshot related functions maybe?

> 
> > Would you mind merging lxc-restart into lxc-checkpoint?
> 
> Sure, what should it be called? I guess the CLI would be something
> like:
> 
> lxc-foo checkpoint [checkpoint opts]
> lxc-foo restore [restore opts]

So, I think we would have something like:

lxc-checkpoint -n <container> [-D DIR] [-s] [-v] => checkpoint
lxc-checkpoint -n <container> -r [-D DIR] [-v] [-d] [-F] => restore

So basically merging the two commands, then making the following options
conflict:
 - -r with -s
 - ! -r with -d and -F

> 
> ?
> 
> Tycho
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140820/38fe0dd2/attachment.sig>


More information about the lxc-devel mailing list