]>
git.proxmox.com Git - mirror_lxc.git/blob - src/tests/lxc-test-checkpoint-restore
3 # Do an end to end checkpoint and restore with criu.
13 if [ "$(id -u)" != "0" ]; then
14 echo "ERROR: Must run as root."
19 ! [ "$1" = "$(printf "$1\n$2" | sort -V | tail -n1)" ]
22 criu_version
="$(criu --version | head -n1 | cut -d' ' -f 2)"
24 if verlte
"$criu_version" "1.3.1"; then
25 echo "SKIP: skipping test because no (or wrong) criu installed."
30 lxc-create
-t ubuntu
-n $name || FAIL
"creating container"
32 cat >> "$(lxc-config lxc.lxcpath)/$name/config" <<EOF
34 lxc.console.path = none
36 lxc.cgroup.devices.deny = c 5:1 rwm
39 lxc-start
-n $name -d || FAIL
"starting container"
40 lxc-wait
-n $name -s RUNNING || FAIL
"waiting for container to run"
42 # Let the container boot and get into a steady state.
45 # The first time this usually fails because CRIU cannot checkpoint things with
47 lxc-checkpoint
-n $name -v -s -D /tmp
/checkpoint || FAIL
"failed checkpointing"
48 lxc-wait
-n $name -s STOPPED
49 lxc-checkpoint
-n $name -v -r -D /tmp
/checkpoint || FAIL
"failed restoring"
52 lxc-destroy
-f -n $name