diff options
author | unknown <chen_zhuohan@163.com> | 2021-01-10 18:12:12 +0800 |
---|---|---|
committer | unknown <chen_zhuohan@163.com> | 2021-01-10 21:38:28 +0800 |
commit | 2aa381f2d0cdc8abb28aa8759c681198cb1e47a7 (patch) | |
tree | 3788c56606e3396d00d91b44f0eeba2d92542221 /libpod/oci_conmon_linux.go | |
parent | 49db79e735acd2c693762eaff62680cd9a8cb60b (diff) | |
download | podman-2aa381f2d0cdc8abb28aa8759c681198cb1e47a7.tar.gz podman-2aa381f2d0cdc8abb28aa8759c681198cb1e47a7.tar.bz2 podman-2aa381f2d0cdc8abb28aa8759c681198cb1e47a7.zip |
add pre checkpoint
Signed-off-by: Zhuohan Chen <chen_zhuohan@163.com>
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r-- | libpod/oci_conmon_linux.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index 6b5da439a..66c8141c2 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -769,10 +769,14 @@ func (r *ConmonOCIRuntime) CheckpointContainer(ctr *Container, options Container } // imagePath is used by CRIU to store the actual checkpoint files imagePath := ctr.CheckpointPath() + if options.PreCheckPoint { + imagePath = ctr.PreCheckPointPath() + } // workPath will be used to store dump.log and stats-dump workPath := ctr.bundlePath() logrus.Debugf("Writing checkpoint to %s", imagePath) logrus.Debugf("Writing checkpoint logs to %s", workPath) + logrus.Debugf("Pre-dump the container %t", options.PreCheckPoint) args := []string{} args = append(args, r.runtimeFlags...) args = append(args, "checkpoint") @@ -786,6 +790,15 @@ func (r *ConmonOCIRuntime) CheckpointContainer(ctr *Container, options Container if options.TCPEstablished { args = append(args, "--tcp-established") } + if !options.PreCheckPoint && options.KeepRunning { + args = append(args, "--leave-running") + } + if options.PreCheckPoint { + args = append(args, "--pre-dump") + } + if !options.PreCheckPoint && options.WithPrevious { + args = append(args, "--parent-path", ctr.PreCheckPointPath()) + } runtimeDir, err := util.GetRuntimeDir() if err != nil { return err @@ -794,6 +807,7 @@ func (r *ConmonOCIRuntime) CheckpointContainer(ctr *Container, options Container return errors.Wrapf(err, "cannot set XDG_RUNTIME_DIR") } args = append(args, ctr.ID()) + logrus.Debugf("the args to checkpoint: %s %s", r.path, strings.Join(args, " ")) return utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, nil, r.path, args...) } |