summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2018-11-21 14:40:43 +0000
committerAdrian Reber <adrian@lisas.de>2018-11-28 08:00:38 +0100
commit03c88a3debf77780bdad2382d4c01ccedc6d27a5 (patch)
tree496f06bdcf9b6d932cae3a70bc5d79e9d83581e4 /cmd/podman
parenta2bcb6d8bf412bae8e4591af60ee8c5994bc54ed (diff)
downloadpodman-03c88a3debf77780bdad2382d4c01ccedc6d27a5.tar.gz
podman-03c88a3debf77780bdad2382d4c01ccedc6d27a5.tar.bz2
podman-03c88a3debf77780bdad2382d4c01ccedc6d27a5.zip
Added tcp-established to checkpoint/restore
CRIU can checkpoint and restore processes/containers with established TCP connections if the correct option is specified. To implement checkpoint and restore with support for established TCP connections with Podman this commit adds the necessary options to runc during checkpoint and also tells conmon during restore to use 'runc restore' with '--tcp-established'. For this Podman feature to work a corresponding conmon change is required. Example: $ podman run --tmpfs /tmp --name podman-criu-test -d docker://docker.io/yovfiatbeb/podman-criu-test $ nc `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'` 8080 GET /examples/servlets/servlet/HelloWorldExample Connection: keep-alive 1 GET /examples/servlets/servlet/HelloWorldExample Connection: keep-alive 2 $ # Using HTTP keep-alive multiple requests are send to the server in the container $ # Different terminal: $ podman container checkpoint -l criu failed: type NOTIFY errno 0 $ # Looking at the log file would show errors because of established TCP connections $ podman container checkpoint -l --tcp-established $ # This works now and after the restore the same connection as above can be used for requests $ podman container restore -l --tcp-established The restore would fail without '--tcp-established' as the checkpoint image contains established TCP connections. Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/checkpoint.go9
-rw-r--r--cmd/podman/restore.go7
2 files changed, 13 insertions, 3 deletions
diff --git a/cmd/podman/checkpoint.go b/cmd/podman/checkpoint.go
index ddfd12bc3..824c97662 100644
--- a/cmd/podman/checkpoint.go
+++ b/cmd/podman/checkpoint.go
@@ -28,6 +28,10 @@ var (
Usage: "leave the container running after writing checkpoint to disk",
},
cli.BoolFlag{
+ Name: "tcp-established",
+ Usage: "checkpoint a container with established TCP connections",
+ },
+ cli.BoolFlag{
Name: "all, a",
Usage: "checkpoint all running containers",
},
@@ -55,8 +59,9 @@ func checkpointCmd(c *cli.Context) error {
defer runtime.Shutdown(false)
options := libpod.ContainerCheckpointOptions{
- Keep: c.Bool("keep"),
- KeepRunning: c.Bool("leave-running"),
+ Keep: c.Bool("keep"),
+ KeepRunning: c.Bool("leave-running"),
+ TCPEstablished: c.Bool("tcp-established"),
}
if err := checkAllAndLatest(c); err != nil {
diff --git a/cmd/podman/restore.go b/cmd/podman/restore.go
index 6383ebf0b..afdbc36e0 100644
--- a/cmd/podman/restore.go
+++ b/cmd/podman/restore.go
@@ -27,6 +27,10 @@ var (
// dedicated state for container which are checkpointed.
// TODO: add ContainerStateCheckpointed
cli.BoolFlag{
+ Name: "tcp-established",
+ Usage: "checkpoint a container with established TCP connections",
+ },
+ cli.BoolFlag{
Name: "all, a",
Usage: "restore all checkpointed containers",
},
@@ -54,7 +58,8 @@ func restoreCmd(c *cli.Context) error {
defer runtime.Shutdown(false)
options := libpod.ContainerCheckpointOptions{
- Keep: c.Bool("keep"),
+ Keep: c.Bool("keep"),
+ TCPEstablished: c.Bool("tcp-established"),
}
if err := checkAllAndLatest(c); err != nil {