summaryrefslogtreecommitdiff
path: root/libpod/container_internal_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-11-21 05:11:12 -0800
committerGitHub <noreply@github.com>2018-11-21 05:11:12 -0800
commit1fdfeb87100aee82d4de17b2b3f9a81aedfcb6a8 (patch)
treeaadb41e32b4d66420b50a6b7b2dc62b404d03afb /libpod/container_internal_linux.go
parent23feb0d6f9a6a43e44f959c99100ae24d6c27f6d (diff)
parent24c0739453b3f103a1b548c1bb611013b488afbe (diff)
downloadpodman-1fdfeb87100aee82d4de17b2b3f9a81aedfcb6a8.tar.gz
podman-1fdfeb87100aee82d4de17b2b3f9a81aedfcb6a8.tar.bz2
podman-1fdfeb87100aee82d4de17b2b3f9a81aedfcb6a8.zip
Merge pull request #1835 from adrianreber/master
Added option to keep container running after checkpointing
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 66c7e8a04..e6071945d 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -431,7 +431,7 @@ func (c *Container) addNamespaceContainer(g *generate.Generator, ns LinuxNS, ctr
return nil
}
-func (c *Container) checkpoint(ctx context.Context, keep bool) (err error) {
+func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointOptions) (err error) {
if !criu.CheckForCriu() {
return errors.Errorf("checkpointing a container requires at least CRIU %d", criu.MinCriuVersion)
@@ -440,7 +440,7 @@ func (c *Container) checkpoint(ctx context.Context, keep bool) (err error) {
if c.state.State != ContainerStateRunning {
return errors.Wrapf(ErrCtrStateInvalid, "%q is not running, cannot checkpoint", c.state.State)
}
- if err := c.runtime.ociRuntime.checkpointContainer(c); err != nil {
+ if err := c.runtime.ociRuntime.checkpointContainer(c, options); err != nil {
return err
}
@@ -457,14 +457,16 @@ func (c *Container) checkpoint(ctx context.Context, keep bool) (err error) {
logrus.Debugf("Checkpointed container %s", c.ID())
- c.state.State = ContainerStateStopped
+ if !options.KeepRunning {
+ c.state.State = ContainerStateStopped
- // Cleanup Storage and Network
- if err := c.cleanup(ctx); err != nil {
- return err
+ // Cleanup Storage and Network
+ if err := c.cleanup(ctx); err != nil {
+ return err
+ }
}
- if !keep {
+ if !options.Keep {
// Remove log file
os.Remove(filepath.Join(c.bundlePath(), "dump.log"))
// Remove statistic file