]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
Add support for checkpoint and restore via CRIU
authorTycho Andersen <tycho.andersen@canonical.com>
Tue, 26 Aug 2014 14:09:36 +0000 (09:09 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 26 Aug 2014 14:40:05 +0000 (10:40 -0400)
commit735f2c6e504a541cbb2592a3f94858bf337a24ff
tree53d6dc3fe56dfbd64a5f2991255ce1bc83d1b926
parentf4eddfef90c41595905ff45a92ca6e9e954d279b
Add support for checkpoint and restore via CRIU

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

v2: fixed some problems with the s/int/bool return code form api function
v3: added a testcase, fixed up the man page synopsis
v4: fix a small typo in lxc-test-checkpoint-restore
v5: remove a reference to the old CRIU_PATH, and a bad error about the same

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
15 files changed:
.gitignore
configure.ac
doc/Makefile.am
doc/lxc-checkpoint.sgml.in [new file with mode: 0644]
src/lxc/Makefile.am
src/lxc/lxc-restore-net [new file with mode: 0755]
src/lxc/lxc_checkpoint.c [new file with mode: 0644]
src/lxc/lxccontainer.c
src/lxc/lxccontainer.h
src/lxc/start.c
src/lxc/start.h
src/lxc/utils.c
src/lxc/utils.h
src/tests/Makefile.am
src/tests/lxc-test-checkpoint-restore [new file with mode: 0755]