Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote checkpoint/restore: more fixes #12342

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/markdown/podman-container-restore.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ to import a checkpointed *container* from another host.\

Import a pre-checkpoint tar.gz file which was exported by Podman. This option
must be used with **-i** or **--import**. It only works on `runc 1.0-rc3` or `higher`.
*IMPORTANT: This OPTION is not supported on the remote client.*

#### **--name**, **-n**=*name*

Expand Down
4 changes: 4 additions & 0 deletions pkg/api/handlers/libpod/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ func Checkpoint(w http.ResponseWriter, r *http.Request) {
Export bool `schema:"export"`
IgnoreRootFS bool `schema:"ignoreRootFS"`
PrintStats bool `schema:"printStats"`
PreCheckpoint bool `schema:"preCheckpoint"`
WithPrevious bool `schema:"withPrevious"`
}{
// override any golang type defaults
}
Expand All @@ -242,6 +244,8 @@ func Checkpoint(w http.ResponseWriter, r *http.Request) {
TCPEstablished: query.TCPEstablished,
IgnoreRootFS: query.IgnoreRootFS,
PrintStats: query.PrintStats,
PreCheckPoint: query.PreCheckpoint,
WithPrevious: query.WithPrevious,
}

if query.Export {
Expand Down
2 changes: 2 additions & 0 deletions pkg/bindings/containers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type CheckpointOptions struct {
LeaveRunning *bool
TCPEstablished *bool
PrintStats *bool
PreCheckpoint *bool
WithPrevious *bool
}

//go:generate go run ../generator/generator.go RestoreOptions
Expand Down
30 changes: 30 additions & 0 deletions pkg/bindings/containers/types_checkpoint_options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pkg/domain/infra/tunnel/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [
options.WithExport(opts.Export)
options.WithTCPEstablished(opts.TCPEstablished)
options.WithPrintStats(opts.PrintStats)
options.WithPreCheckpoint(opts.PreCheckPoint)
options.WithLeaveRunning(opts.LeaveRunning)
options.WithWithPrevious(opts.WithPrevious)

var (
err error
Expand Down Expand Up @@ -345,6 +347,10 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [
}

func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []string, opts entities.RestoreOptions) ([]*entities.RestoreReport, error) {
if opts.ImportPrevious != "" {
return nil, fmt.Errorf("--import-previous is not supported on the remote client")
}

options := new(containers.RestoreOptions)
options.WithIgnoreRootfs(opts.IgnoreRootFS)
options.WithIgnoreVolumes(opts.IgnoreVolumes)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ var _ = Describe("Podman checkpoint", func() {
})

It("podman checkpoint container with --pre-checkpoint and export (migration)", func() {
SkipIfRemote("--import-previous is not yet supported on the remote client")
if !strings.Contains(podmanTest.OCIRuntime, "runc") {
Skip("Test only works on runc 1.0-rc3 or higher.")
}
Expand Down