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:
Adrian Reber
2018-11-21 13:09:17 +00:00
committed by Adrian Reber
parent 6df7409cb5
commit 0592558289
7 changed files with 17 additions and 15 deletions

View File

@ -831,7 +831,7 @@ func (c *Container) Refresh(ctx context.Context) error {
}
// ContainerCheckpointOptions is a struct used to pass the parameters
// for checkpointing to corresponding functions
// for checkpointing (and restoring) to the corresponding functions
type ContainerCheckpointOptions struct {
Keep bool
KeepRunning bool
@ -853,7 +853,7 @@ func (c *Container) Checkpoint(ctx context.Context, options ContainerCheckpointO
}
// Restore restores a container
func (c *Container) Restore(ctx context.Context, keep bool) (err error) {
func (c *Container) Restore(ctx context.Context, options ContainerCheckpointOptions) (err error) {
logrus.Debugf("Trying to restore container %s", c)
if !c.batched {
c.lock.Lock()
@ -864,5 +864,5 @@ func (c *Container) Restore(ctx context.Context, keep bool) (err error) {
}
}
return c.restore(ctx, keep)
return c.restore(ctx, options)
}