mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
Use also a struct to pass options to Restore()
This is basically the same change as ff47a4c2d5485fc49f937f3ce0c4e2fd6bdb1956 (Use a struct to pass options to Checkpoint()) just for the Restore() function. It is used to pass multiple restore options to the API and down to conmon which is used to restore containers. This is for the upcoming changes to support checkpointing and restoring containers with '--tcp-established'. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:

committed by
Adrian Reber

parent
6df7409cb5
commit
0592558289
@ -514,7 +514,7 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO
|
||||
return c.save()
|
||||
}
|
||||
|
||||
func (c *Container) restore(ctx context.Context, keep bool) (err error) {
|
||||
func (c *Container) restore(ctx context.Context, options ContainerCheckpointOptions) (err error) {
|
||||
|
||||
if !criu.CheckForCriu() {
|
||||
return errors.Errorf("restoring a container requires at least CRIU %d", criu.MinCriuVersion)
|
||||
@ -602,7 +602,7 @@ func (c *Container) restore(ctx context.Context, keep bool) (err error) {
|
||||
// Cleanup for a working restore.
|
||||
c.removeConmonFiles()
|
||||
|
||||
if err := c.runtime.ociRuntime.createContainer(c, c.config.CgroupParent, true); err != nil {
|
||||
if err := c.runtime.ociRuntime.createContainer(c, c.config.CgroupParent, &options); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -610,7 +610,7 @@ func (c *Container) restore(ctx context.Context, keep bool) (err error) {
|
||||
|
||||
c.state.State = ContainerStateRunning
|
||||
|
||||
if !keep {
|
||||
if !options.Keep {
|
||||
// Delete all checkpoint related files. At this point, in theory, all files
|
||||
// should exist. Still ignoring errors for now as the container should be
|
||||
// restored and running. Not erroring out just because some cleanup operation
|
||||
|
Reference in New Issue
Block a user