add pre checkpoint

Signed-off-by: Zhuohan Chen <chen_zhuohan@163.com>
This commit is contained in:
unknown
2021-01-10 18:12:12 +08:00
parent 49db79e735
commit 2aa381f2d0
11 changed files with 192 additions and 2 deletions

View File

@ -706,6 +706,13 @@ type ContainerCheckpointOptions struct {
// IgnoreVolumes tells the API to not export or not to import
// the content of volumes associated with the container
IgnoreVolumes bool
// Pre Checkpoint container and leave container running
PreCheckPoint bool
// Dump container with Pre Checkpoint images
WithPrevious bool
// ImportPrevious tells the API to restore container with two
// images. One is TargetFile, the other is ImportPrevious.
ImportPrevious string
}
// Checkpoint checkpoints a container
@ -718,6 +725,12 @@ func (c *Container) Checkpoint(ctx context.Context, options ContainerCheckpointO
}
}
if options.WithPrevious {
if err := c.canWithPrevious(); err != nil {
return err
}
}
if !c.batched {
c.lock.Lock()
defer c.lock.Unlock()