aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-11-18 19:48:16 +0100
committerGitHub <noreply@github.com>2021-11-18 19:48:16 +0100
commit0376e6092c850435b4740876045fdccb467cafd8 (patch)
tree3f218782c0726046d5e191570a2e33bddcf4bddf
parent9b964945d661d4f97b4a97f2f67d33f9dcd11e50 (diff)
parentfceecc3a5bb48280fb40f7547156fda44e313421 (diff)
downloadpodman-0376e6092c850435b4740876045fdccb467cafd8.tar.gz
podman-0376e6092c850435b4740876045fdccb467cafd8.tar.bz2
podman-0376e6092c850435b4740876045fdccb467cafd8.zip
Merge pull request #12342 from vrothberg/fix-12334
remote checkpoint/restore: more fixes
-rw-r--r--docs/source/markdown/podman-container-restore.1.md1
-rw-r--r--pkg/api/handlers/libpod/containers.go4
-rw-r--r--pkg/bindings/containers/types.go2
-rw-r--r--pkg/bindings/containers/types_checkpoint_options.go30
-rw-r--r--pkg/domain/infra/tunnel/containers.go6
-rw-r--r--test/e2e/checkpoint_test.go1
6 files changed, 44 insertions, 0 deletions
diff --git a/docs/source/markdown/podman-container-restore.1.md b/docs/source/markdown/podman-container-restore.1.md
index 962770ea0..be67792fc 100644
--- a/docs/source/markdown/podman-container-restore.1.md
+++ b/docs/source/markdown/podman-container-restore.1.md
@@ -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*
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go
index b0cec2b1f..d5da22a91 100644
--- a/pkg/api/handlers/libpod/containers.go
+++ b/pkg/api/handlers/libpod/containers.go
@@ -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
}
@@ -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 {
diff --git a/pkg/bindings/containers/types.go b/pkg/bindings/containers/types.go
index 4bbb4a62b..9f7986cbd 100644
--- a/pkg/bindings/containers/types.go
+++ b/pkg/bindings/containers/types.go
@@ -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
diff --git a/pkg/bindings/containers/types_checkpoint_options.go b/pkg/bindings/containers/types_checkpoint_options.go
index b606922e0..6301564e2 100644
--- a/pkg/bindings/containers/types_checkpoint_options.go
+++ b/pkg/bindings/containers/types_checkpoint_options.go
@@ -106,3 +106,33 @@ func (o *CheckpointOptions) GetPrintStats() bool {
}
return *o.PrintStats
}
+
+// WithPreCheckpoint set field PreCheckpoint to given value
+func (o *CheckpointOptions) WithPreCheckpoint(value bool) *CheckpointOptions {
+ o.PreCheckpoint = &value
+ return o
+}
+
+// GetPreCheckpoint returns value of field PreCheckpoint
+func (o *CheckpointOptions) GetPreCheckpoint() bool {
+ if o.PreCheckpoint == nil {
+ var z bool
+ return z
+ }
+ return *o.PreCheckpoint
+}
+
+// WithWithPrevious set field WithPrevious to given value
+func (o *CheckpointOptions) WithWithPrevious(value bool) *CheckpointOptions {
+ o.WithPrevious = &value
+ return o
+}
+
+// GetWithPrevious returns value of field WithPrevious
+func (o *CheckpointOptions) GetWithPrevious() bool {
+ if o.WithPrevious == nil {
+ var z bool
+ return z
+ }
+ return *o.WithPrevious
+}
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index 152e3c302..a7dcc923b 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -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
@@ -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)
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 37935fd38..14545c4f9 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -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.")
}