diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-10-04 12:34:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-04 12:34:49 -0700 |
commit | 06a959f74ab4f23d5a789d03de4b2b73a3d53dc6 (patch) | |
tree | 42e0437cd91aae4b53cd769401d7becd2309feb6 /libpod/container_api.go | |
parent | 3c31e176c7dfce3c86a45ff4750f740a5f8f9321 (diff) | |
parent | dc987af0b0146ec5fd2026ca8db403806c3425df (diff) | |
download | podman-06a959f74ab4f23d5a789d03de4b2b73a3d53dc6.tar.gz podman-06a959f74ab4f23d5a789d03de4b2b73a3d53dc6.tar.bz2 podman-06a959f74ab4f23d5a789d03de4b2b73a3d53dc6.zip |
Merge pull request #469 from adrianreber/master
Add support to checkpoint/restore containers
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r-- | libpod/container_api.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 192ccd347..93becb80d 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -832,3 +832,33 @@ func (c *Container) Refresh(ctx context.Context) error { return nil } + +// Checkpoint checkpoints a container +func (c *Container) Checkpoint(ctx context.Context, keep bool) error { + logrus.Debugf("Trying to checkpoint container %s", c) + if !c.batched { + c.lock.Lock() + defer c.lock.Unlock() + + if err := c.syncContainer(); err != nil { + return err + } + } + + return c.checkpoint(ctx, keep) +} + +// Restore restores a container +func (c *Container) Restore(ctx context.Context, keep bool) (err error) { + logrus.Debugf("Trying to restore container %s", c) + if !c.batched { + c.lock.Lock() + defer c.lock.Unlock() + + if err := c.syncContainer(); err != nil { + return err + } + } + + return c.restore(ctx, keep) +} |