lxc-test-checkpoint-restore revision d48d22299d4fc5635f289e4a34967e6cd99cd743
4de2612967d06c4fdbf524a62556a1e8118a006fxs# Do an end to end checkpoint and restore with criu.
4de2612967d06c4fdbf524a62556a1e8118a006fxs echo "ERROR: Must run as root."
4de2612967d06c4fdbf524a62556a1e8118a006fxscriu_version="$(criu --version | head -n1 | cut -d' ' -f 2)"
4de2612967d06c4fdbf524a62556a1e8118a006fxs echo "SKIP: skipping test because no (or wrong) criu installed."
4de2612967d06c4fdbf524a62556a1e8118a006fxslxc-create -t ubuntu -n $name || FAIL "creating container"
4de2612967d06c4fdbf524a62556a1e8118a006fxs# hax for criu
4de2612967d06c4fdbf524a62556a1e8118a006fxslxc.console = none
4de2612967d06c4fdbf524a62556a1e8118a006fxslxc.tty = 0
4de2612967d06c4fdbf524a62556a1e8118a006fxslxc.cgroup.devices.deny = c 5:1 rwm
4de2612967d06c4fdbf524a62556a1e8118a006fxslxc-wait -n $name -s RUNNING || FAIL "waiting for container to run"
4ebb14b236958cfe1ef4ff3b7a50216d9e51f997frits# Let the container boot and get into a steady state.
4de2612967d06c4fdbf524a62556a1e8118a006fxs# The first time this usually fails because CRIU cannot checkpoint things with
4de2612967d06c4fdbf524a62556a1e8118a006fxs# data on a socket.
4de2612967d06c4fdbf524a62556a1e8118a006fxslxc-checkpoint -n $name -v -s -D /tmp/checkpoint || FAIL "failed checkpointing"
4de2612967d06c4fdbf524a62556a1e8118a006fxslxc-checkpoint -n $name -v -r -D /tmp/checkpoint || FAIL "failed restoring"