Revert "cmd/podman: add support for checkpoint images"

This reverts commit 9c3d8bb494.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2022-10-06 17:16:42 -04:00
parent bb0b1849d7
commit f437078d2b
No known key found for this signature in database
GPG Key ID: A2DF901DABE2C028
2 changed files with 7 additions and 36 deletions

View File

@ -93,7 +93,7 @@ func init() {
func restore(cmd *cobra.Command, args []string) error { func restore(cmd *cobra.Command, args []string) error {
var ( var (
err error e error
errs utils.OutputErrors errs utils.OutputErrors
) )
podmanStart := time.Now() podmanStart := time.Now()
@ -104,9 +104,9 @@ func restore(cmd *cobra.Command, args []string) error {
// Check if the container exists (#15055) // Check if the container exists (#15055)
exists := &entities.BoolReport{Value: false} exists := &entities.BoolReport{Value: false}
for _, ctr := range args { for _, ctr := range args {
exists, err = registry.ContainerEngine().ContainerExists(registry.GetContext(), ctr, entities.ContainerExistsOptions{}) exists, e = registry.ContainerEngine().ContainerExists(registry.GetContext(), ctr, entities.ContainerExistsOptions{})
if err != nil { if e != nil {
return err return e
} }
if exists.Value { if exists.Value {
break break
@ -115,9 +115,9 @@ func restore(cmd *cobra.Command, args []string) error {
if !exists.Value { if !exists.Value {
// Find out if this is an image // Find out if this is an image
restoreOptions.CheckpointImage, err = utils.IsCheckpointImage(context.Background(), args) restoreOptions.CheckpointImage, e = utils.IsCheckpointImage(context.Background(), args)
if err != nil { if e != nil {
return err return e
} }
} }

View File

@ -148,35 +148,6 @@ func run(cmd *cobra.Command, args []string) error {
imageName = name imageName = name
} }
// If this is a checkpoint image, invoke container restore.
// We do not return `err` when checkpointImage is false, because the value
// of `err` could be "image is not a checkpoint". In this case, the run
// command should continue as usual, preserving backwards compatibility.
checkpointImage, err := utils.IsCheckpointImage(registry.GetContext(), []string{imageName})
if checkpointImage {
if err != nil {
return err
}
var restoreOptions entities.RestoreOptions
responses, err := registry.ContainerEngine().ContainerRestore(registry.GetContext(), []string{imageName}, restoreOptions)
if err != nil {
return err
}
var errs utils.OutputErrors
for _, r := range responses {
switch {
case r.Err != nil:
errs = append(errs, r.Err)
case r.RawInput != "":
fmt.Println(r.RawInput)
default:
fmt.Println(r.Id)
}
}
return errs.PrintErrors()
}
if cliVals.Replace { if cliVals.Replace {
if err := replaceContainer(cliVals.Name); err != nil { if err := replaceContainer(cliVals.Name); err != nil {
return err return err