Line 59: |
Line 59: |
| === Preparations === | | === Preparations === |
| | | |
− | You not only need to [[Installation | install]] the crtools, but also check that the iproute2 utility (<code>ip</code>) is v3.6.0 or higher. | + | You not only need to [[Installation | install]] the criu, but also check that the iproute2 utility (<code>ip</code>) is v3.6.0 or higher. |
| | | |
− | You can clone the [http://git.kernel.org/?p=linux/kernel/git/shemminger/iproute2.git;a=summary git repo] or download the [http://kernel.org/pub/linux/utils/net/iproute2/ tarball] to compile it manually. In order to tell to crtools where the proper ip tool is set the <code>CR_IP_TOOL</code> environment variable. | + | You can clone the [http://git.kernel.org/?p=linux/kernel/git/shemminger/iproute2.git;a=summary git repo] or download the [http://kernel.org/pub/linux/utils/net/iproute2/ tarball] to compile it manually. In order to tell to criu where the proper ip tool is set the <code>CR_IP_TOOL</code> environment variable. |
| | | |
| === Dump and restore === | | === Dump and restore === |
| Dumping and restoring an LXC contianer means -- dumping a subtree of processes starting from container init plus all kinds of namespaces. | | Dumping and restoring an LXC contianer means -- dumping a subtree of processes starting from container init plus all kinds of namespaces. |
− | Restoring is symmetrical. The way LXC container works imposes some more requirements on crtools usage. | + | Restoring is symmetrical. The way LXC container works imposes some more requirements on criu usage. |
| | | |
| * In order to properly isolate container from unwanted networking communication during checkpoint/restore you should provide a script for locking/unlocking the container network (see below) | | * In order to properly isolate container from unwanted networking communication during checkpoint/restore you should provide a script for locking/unlocking the container network (see below) |
Line 73: |
Line 73: |
| Typically a container dump command will look like | | Typically a container dump command will look like |
| <pre> | | <pre> |
− | crtools dump
| + | criu dump |
| --tcp-established # allow for TCP connections dump | | --tcp-established # allow for TCP connections dump |
| -n net -n mnt -n ipc -n pid # dump all the namespaces container uses | | -n net -n mnt -n ipc -n pid # dump all the namespaces container uses |
Line 82: |
Line 82: |
| and restore command like | | and restore command like |
| <pre> | | <pre> |
− | crtools restore
| + | criu restore |
| --tcp-established | | --tcp-established |
| -n net -n mnt -n ipc -n pid | | -n net -n mnt -n ipc -n pid |
Line 92: |
Line 92: |
| </pre> | | </pre> |
| | | |
− | We also find it useful to use the <code>--restore-detached</code> option for restore to make contianer reparent to init rather than hanging on a crtools process launched from shell. Another useful option is the <code>--pidfile</code> one -- you will be able to find out the host-side pid of a container init after restore. | + | We also find it useful to use the <code>--restore-detached</code> option for restore to make contianer reparent to init rather than hanging on a criu process launched from shell. Another useful option is the <code>--pidfile</code> one -- you will be able to find out the host-side pid of a container init after restore. |
| | | |
| Also note, that there's a BUG in how LXC prepares the /dev filesystem for a container which sometimes makes it impossible to dump and container. The <code>--evasive-devices</code> option can help. | | Also note, that there's a BUG in how LXC prepares the /dev filesystem for a container which sometimes makes it impossible to dump and container. The <code>--evasive-devices</code> option can help. |
Line 99: |
Line 99: |
| | | |
| === Example === | | === Example === |
− | We have [http://git.criu.org/?p=crtools.git;a=tree;f=test/app-emu/lxc;hb=HEAD an application test] for dumping/restoring an LXC Container. You may look at it for better understanding how to dump and restore your container with crtools. | + | We have [http://git.criu.org/?p=crtools.git;a=tree;f=test/app-emu/lxc;hb=HEAD an application test] for dumping/restoring an LXC Container. You may look at it for better understanding how to dump and restore your container with criu. |
| | | |
| This test contains two scripts: | | This test contains two scripts: |
| ;[http://git.criu.org/?p=crtools.git;a=blob;f=test/app-emu/lxc/run.sh;hb=HEAD run.sh] | | ;[http://git.criu.org/?p=crtools.git;a=blob;f=test/app-emu/lxc/run.sh;hb=HEAD run.sh] |
− | :This is the main script, which executes ''crtools'' two times for dumping and restoring CT. It contains a working commands for dumping and restoring a container. | + | :This is the main script, which executes ''criu'' two times for dumping and restoring CT. It contains a working commands for dumping and restoring a container. |
| | | |
| ;[http://git.criu.org/?p=crtools.git;a=blob;f=test/app-emu/lxc/network-script.sh;hb=HEAD network-script.sh] | | ;[http://git.criu.org/?p=crtools.git;a=blob;f=test/app-emu/lxc/network-script.sh;hb=HEAD network-script.sh] |