summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-04-21 11:58:56 -0400
committerGitHub <noreply@github.com>2022-04-21 11:58:56 -0400
commitcb09c26c6519c2fff8be7285d585672a9066f2da (patch)
tree4adfde8375b9a76d6942b612fe2bc75aae49124c /pkg/api
parente47dda5d81772fcc1c2417062303681a72780bbd (diff)
parentbbe1063a5ae681ad04a049518c6087421b919f2e (diff)
downloadpodman-cb09c26c6519c2fff8be7285d585672a9066f2da.tar.gz
podman-cb09c26c6519c2fff8be7285d585672a9066f2da.tar.bz2
podman-cb09c26c6519c2fff8be7285d585672a9066f2da.zip
Merge pull request #13505 from rst0git/checkpoint-image-1
Add support for checkpoint image
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/libpod/containers.go33
1 files changed, 22 insertions, 11 deletions
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go
index dfa09b8b8..03dd436f6 100644
--- a/pkg/api/handlers/libpod/containers.go
+++ b/pkg/api/handlers/libpod/containers.go
@@ -209,15 +209,16 @@ func Checkpoint(w http.ResponseWriter, r *http.Request) {
decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder)
query := struct {
- Keep bool `schema:"keep"`
- LeaveRunning bool `schema:"leaveRunning"`
- TCPEstablished bool `schema:"tcpEstablished"`
- Export bool `schema:"export"`
- IgnoreRootFS bool `schema:"ignoreRootFS"`
- PrintStats bool `schema:"printStats"`
- PreCheckpoint bool `schema:"preCheckpoint"`
- WithPrevious bool `schema:"withPrevious"`
- FileLocks bool `schema:"fileLocks"`
+ Keep bool `schema:"keep"`
+ LeaveRunning bool `schema:"leaveRunning"`
+ TCPEstablished bool `schema:"tcpEstablished"`
+ Export bool `schema:"export"`
+ IgnoreRootFS bool `schema:"ignoreRootFS"`
+ PrintStats bool `schema:"printStats"`
+ PreCheckpoint bool `schema:"preCheckpoint"`
+ WithPrevious bool `schema:"withPrevious"`
+ FileLocks bool `schema:"fileLocks"`
+ CreateImage string `schema:"createImage"`
}{
// override any golang type defaults
}
@@ -243,6 +244,7 @@ func Checkpoint(w http.ResponseWriter, r *http.Request) {
PreCheckPoint: query.PreCheckpoint,
WithPrevious: query.WithPrevious,
FileLocks: query.FileLocks,
+ CreateImage: query.CreateImage,
}
if query.Export {
@@ -341,8 +343,17 @@ func Restore(w http.ResponseWriter, r *http.Request) {
} else {
name := utils.GetName(r)
if _, err := runtime.LookupContainer(name); err != nil {
- utils.ContainerNotFound(w, name, err)
- return
+ // If container was not found, check if this is a checkpoint image
+ ir := abi.ImageEngine{Libpod: runtime}
+ report, err := ir.Exists(r.Context(), name)
+ if err != nil {
+ utils.Error(w, http.StatusNotFound, errors.Wrapf(err, "failed to find container or checkpoint image %s", name))
+ return
+ }
+ if !report.Value {
+ utils.Error(w, http.StatusNotFound, errors.Errorf("failed to find container or checkpoint image %s", name))
+ return
+ }
}
names = []string{name}
}