podman/libpod
Adrian Reber f7c8fd8a3d
Add support to checkpoint/restore containers
runc uses CRIU to support checkpoint and restore of containers. This
brings an initial checkpoint/restore implementation to podman.

None of the additional runc flags are yet supported and container
migration optimization (pre-copy/post-copy) is also left for the future.

The current status is that it is possible to checkpoint and restore a
container. I am testing on RHEL-7.x and as the combination of RHEL-7 and
CRIU has seccomp troubles I have to create the container without
seccomp.

With the following steps I am able to checkpoint and restore a
container:

 # podman run --security-opt="seccomp=unconfined" -d registry.fedoraproject.org/f27/httpd
 # curl -I 10.22.0.78:8080
 HTTP/1.1 403 Forbidden # <-- this is actually a good answer
 # podman container checkpoint <container>
 # curl -I 10.22.0.78:8080
 curl: (7) Failed connect to 10.22.0.78:8080; No route to host
 # podman container restore <container>
 # curl -I 10.22.0.78:8080
 HTTP/1.1 403 Forbidden

I am using CRIU, runc and conmon from git. All required changes for
checkpoint/restore support in podman have been merged in the
corresponding projects.

To have the same IP address in the restored container as before
checkpointing, CNI is told which IP address to use.

If the saved network configuration cannot be found during restore, the
container is restored with a new IP address.

For CRIU to restore established TCP connections the IP address of the
network namespace used for restore needs to be the same. For TCP
connections in the listening state the IP address can change.

During restore only one network interface with one IP address is handled
correctly. Support to restore containers with more advanced network
configuration will be implemented later.

v2:
 * comment typo
 * print debug messages during cleanup of restore files
 * use createContainer() instead of createOCIContainer()
 * introduce helper CheckpointPath()
 * do not try to restore a container that is paused
 * use existing helper functions for cleanup
 * restructure code flow for better readability
 * do not try to restore if checkpoint/inventory.img is missing
 * git add checkpoint.go restore.go

v3:
 * move checkpoint/restore under 'podman container'

v4:
 * incorporated changes from latest reviews

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-10-03 21:41:39 +02:00
..
common Change un/pwd handling to match Buildah's 2018-02-06 09:29:23 -05:00
driver switch projectatomic to containers 2018-08-16 17:12:36 +00:00
image Add container runlabel command 2018-09-28 14:14:13 -05:00
layers Initial checkin from CRI-O repo 2017-11-01 11:24:59 -04:00
testdata Add hooks support to podman 2018-04-05 14:13:49 +00:00
boltdb_state.go Make failure to retrieve individual ctrs/pods nonfatal 2018-08-17 19:10:21 +00:00
boltdb_state_internal.go Do not fetch pod and ctr State on retrieval in Bolt 2018-07-31 14:19:50 +00:00
boltdb_state_linux.go Do not fetch pod and ctr State on retrieval in Bolt 2018-07-31 14:19:50 +00:00
boltdb_state_unsupported.go Fix build on non-linux platforms 2018-07-31 14:19:50 +00:00
common_test.go Rework state testing to allow State structs to be empty 2018-07-31 14:19:50 +00:00
container.go Add ContainerStateExited and OCI delete() in cleanup() 2018-10-02 12:05:22 -04:00
container_api.go Add support to checkpoint/restore containers 2018-10-03 21:41:39 +02:00
container_attach.go switch projectatomic to containers 2018-08-16 17:12:36 +00:00
container_commit.go Vendor in latest containers/buildah 2018-09-18 17:20:30 -04:00
container_easyjson.go Vendor in latest containers/buildah 2018-09-18 17:20:30 -04:00
container_graph.go Remove a loop in container graph 2018-03-29 02:18:45 +00:00
container_graph_test.go Fix tests 2018-03-29 02:18:45 +00:00
container_inspect.go Reveal information about container capabilities 2018-08-24 12:16:19 +00:00
container_internal.go Add support to checkpoint/restore containers 2018-10-03 21:41:39 +02:00
container_internal_linux.go Add support to checkpoint/restore containers 2018-10-03 21:41:39 +02:00
container_internal_test.go vendor containerd/cgroups 2018-09-06 15:19:25 +00:00
container_internal_unsupported.go Add support to checkpoint/restore containers 2018-10-03 21:41:39 +02:00
container_linux.go Do not fetch pod and ctr State on retrieval in Bolt 2018-07-31 14:19:50 +00:00
container_top_linux.go vendor latest containers/psgo 2018-07-26 17:01:40 +00:00
container_top_unsupported.go podman-top: use containers/psgo 2018-07-19 20:47:52 +00:00
container_unsupported.go Do not fetch pod and ctr State on retrieval in Bolt 2018-07-31 14:19:50 +00:00
diff.go Don't output inodes created to run a container 2018-09-21 09:45:14 +00:00
errors.go Add namespaces and initial constraints to database 2018-07-24 16:12:31 -04:00
in_memory_state.go switch projectatomic to containers 2018-08-16 17:12:36 +00:00
info.go Add buildah version and distribution to info 2018-09-28 10:48:16 -05:00
networking_linux.go Replace existing iptables handler with firewall code 2018-09-10 18:53:27 +00:00
networking_unsupported.go switch projectatomic to containers 2018-08-16 17:12:36 +00:00
oci.go Add support to checkpoint/restore containers 2018-10-03 21:41:39 +02:00
oci_linux.go Add support to checkpoint/restore containers 2018-10-03 21:41:39 +02:00
oci_unsupported.go Add support to checkpoint/restore containers 2018-10-03 21:41:39 +02:00
options.go Add new field to libpod to indicate whether or not to use labelling 2018-09-20 16:01:29 +00:00
pod.go Swap from FFJSON to easyjson 2018-08-24 19:19:43 +00:00
pod_api.go Add ContainerStateExited and OCI delete() in cleanup() 2018-10-02 12:05:22 -04:00
pod_easyjson.go Regenerate easyjson after rebase 2018-08-24 19:19:43 +00:00
pod_internal.go Change pause container to infra container 2018-08-23 18:16:28 +00:00
pod_top_linux.go Add podman pod top 2018-08-23 15:01:17 +00:00
pod_top_unsupported.go Add podman pod top 2018-08-23 15:01:17 +00:00
runtime.go rootless: always set XDG_RUNTIME_DIR 2018-10-03 10:41:47 +02:00
runtime_ctr.go Fix bug with exited state and container remove 2018-10-02 12:07:23 -04:00
runtime_img.go Vendor in latest containers/buildah 2018-09-18 17:20:30 -04:00
runtime_img_test.go switch projectatomic to containers 2018-08-16 17:12:36 +00:00
runtime_pod.go Fixing network ns segfault 2018-08-23 18:16:28 +00:00
runtime_pod_infra_linux.go rootless: create compatible pod infra container 2018-09-04 14:36:57 +00:00
runtime_pod_linux.go Add ability for ubuntu to be tested 2018-10-03 12:45:37 -05:00
runtime_pod_unsupported.go Added option to share kernel namespaces in libpod and podman 2018-08-23 18:16:28 +00:00
state.go Do not fetch pod and ctr State on retrieval in Bolt 2018-07-31 14:19:50 +00:00
state_test.go Rework state testing to allow State structs to be empty 2018-07-31 14:19:50 +00:00
stats.go Add ability for ubuntu to be tested 2018-10-03 12:45:37 -05:00
stats_config.go changes to allow for darwin compilation 2018-06-29 20:44:09 +00:00
stats_unsupported.go changes to allow for darwin compilation 2018-06-29 20:44:09 +00:00
storage.go Add --force to podman umount to force the unmounting of the rootfs 2018-08-01 17:53:30 +00:00
util.go Add ability for ubuntu to be tested 2018-10-03 12:45:37 -05:00
util_linux.go Fix build on non-Linux OSes 2018-08-15 18:07:04 +00:00
util_test.go Stage3 Image Library 2018-03-14 20:21:31 +00:00
util_unsupported.go Fix build on non-Linux OSes 2018-08-15 18:07:04 +00:00
version.go switch projectatomic to containers 2018-08-16 17:12:36 +00:00