summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/containers.go2
-rw-r--r--pkg/domain/infra/abi/images.go9
-rw-r--r--pkg/domain/infra/abi/manifest.go33
-rw-r--r--pkg/domain/infra/runtime_libpod.go1
-rw-r--r--pkg/domain/infra/tunnel/containers.go13
-rw-r--r--pkg/domain/infra/tunnel/manifest.go5
6 files changed, 31 insertions, 32 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index d0a2b1bae..237a43441 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -275,7 +275,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string,
case nil:
// remove container names that we successfully deleted
reports = append(reports, &report)
- case define.ErrNoSuchCtr:
+ case define.ErrNoSuchCtr, define.ErrCtrExists:
// There is still a potential this is a libpod container
tmpNames = append(tmpNames, ctr)
default:
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go
index 79e815490..083566201 100644
--- a/pkg/domain/infra/abi/images.go
+++ b/pkg/domain/infra/abi/images.go
@@ -313,12 +313,9 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
// list but could not find a matching image instance in the local
// containers storage. In that case, fall back and attempt to push the
// (entire) manifest.
- if errors.Cause(pushError) == storage.ErrImageUnknown {
- // Image might be a manifest list so attempt a manifest push
- _, manifestErr := ir.ManifestPush(ctx, source, destination, options)
- if manifestErr == nil {
- return nil
- }
+ if _, err := ir.Libpod.LibimageRuntime().LookupManifestList(source); err == nil {
+ _, err := ir.ManifestPush(ctx, source, destination, options)
+ return err
}
return pushError
}
diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go
index f932cf21d..7e5477f4f 100644
--- a/pkg/domain/infra/abi/manifest.go
+++ b/pkg/domain/infra/abi/manifest.go
@@ -68,29 +68,17 @@ func (ir *ImageEngine) ManifestInspect(ctx context.Context, name string) ([]byte
// inspect foo` wants to do a remote-inspect of foo iff "foo" in the
// containers storage is an ordinary image but not a manifest list.
- lookupOptions := &libimage.LookupImageOptions{IgnorePlatform: true}
- image, _, err := ir.Libpod.LibimageRuntime().LookupImage(name, lookupOptions)
+ manifestList, err := ir.Libpod.LibimageRuntime().LookupManifestList(name)
if err != nil {
- // If the image doesn't exist, do a remote inspect.
- if errors.Cause(err) == storage.ErrImageUnknown {
+ switch errors.Cause(err) {
+ // Do a remote inspect if there's no local image or if the
+ // local image is not a manifest list.
+ case storage.ErrImageUnknown, libimage.ErrNotAManifestList:
return ir.remoteManifestInspect(ctx, name)
- }
- return nil, err
- }
-
- isManifestList, err := image.IsManifestList(ctx)
- if err != nil {
- return nil, err
- }
- // If the image isn't a manifest list, do a remote inspect.
- if !isManifestList {
- return ir.remoteManifestInspect(ctx, name)
- }
-
- manifestList, err := image.ToManifestList()
- if err != nil {
- return nil, err
+ default:
+ return nil, err
+ }
}
schema2List, err := manifestList.Inspect()
@@ -320,6 +308,11 @@ func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (stri
return manifestList.ID(), nil
}
+// ManifestRm removes the specified manifest list from storage
+func (ir *ImageEngine) ManifestRm(ctx context.Context, names []string) (report *entities.ImageRemoveReport, rmErrors []error) {
+ return ir.Remove(ctx, names, entities.ImageRemoveOptions{})
+}
+
// ManifestPush pushes a manifest list or image index to the destination
func (ir *ImageEngine) ManifestPush(ctx context.Context, name, destination string, opts entities.ImagePushOptions) (string, error) {
manifestList, err := ir.Libpod.LibimageRuntime().LookupManifestList(name)
diff --git a/pkg/domain/infra/runtime_libpod.go b/pkg/domain/infra/runtime_libpod.go
index a98c9168a..5cbee2e76 100644
--- a/pkg/domain/infra/runtime_libpod.go
+++ b/pkg/domain/infra/runtime_libpod.go
@@ -129,6 +129,7 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo
if fs.Changed("root") {
storageSet = true
storageOpts.GraphRoot = cfg.Engine.StaticDir
+ storageOpts.GraphDriverOptions = []string{}
}
if fs.Changed("runroot") {
storageSet = true
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index 3830835cc..74ced300a 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -21,6 +21,7 @@ import (
"github.com/containers/podman/v3/pkg/errorhandling"
"github.com/containers/podman/v3/pkg/specgen"
"github.com/containers/podman/v3/pkg/util"
+ "github.com/containers/storage/types"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -580,7 +581,7 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
if err := containers.Remove(ic.ClientCtx, ctr.ID, removeOptions); err != nil {
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
errorhandling.Contains(err, define.ErrCtrRemoved) {
- logrus.Warnf("Container %s does not exist: %v", ctr.ID, err)
+ logrus.Debugf("Container %s does not exist: %v", ctr.ID, err)
} else {
logrus.Errorf("Error removing container %s: %v", ctr.ID, err)
}
@@ -613,8 +614,9 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
rmOptions := new(containers.RemoveOptions).WithForce(false).WithVolumes(true)
if err := containers.Remove(ic.ClientCtx, ctr.ID, rmOptions); err != nil {
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
- errorhandling.Contains(err, define.ErrCtrRemoved) {
- logrus.Warnf("Container %s does not exist: %v", ctr.ID, err)
+ errorhandling.Contains(err, define.ErrCtrRemoved) ||
+ errorhandling.Contains(err, types.ErrLayerUnknown) {
+ logrus.Debugf("Container %s does not exist: %v", ctr.ID, err)
} else {
logrus.Errorf("Error removing container %s: %v", ctr.ID, err)
}
@@ -691,8 +693,9 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
if !shouldRestart {
if err := containers.Remove(ic.ClientCtx, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); err != nil {
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
- errorhandling.Contains(err, define.ErrCtrRemoved) {
- logrus.Warnf("Container %s does not exist: %v", con.ID, err)
+ errorhandling.Contains(err, define.ErrCtrRemoved) ||
+ errorhandling.Contains(err, types.ErrLayerUnknown) {
+ logrus.Debugf("Container %s does not exist: %v", con.ID, err)
} else {
logrus.Errorf("Error removing container %s: %v", con.ID, err)
}
diff --git a/pkg/domain/infra/tunnel/manifest.go b/pkg/domain/infra/tunnel/manifest.go
index 8ac1f1420..b8069405a 100644
--- a/pkg/domain/infra/tunnel/manifest.go
+++ b/pkg/domain/infra/tunnel/manifest.go
@@ -83,6 +83,11 @@ func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (stri
return fmt.Sprintf("%s :%s\n", updatedListID, names[1]), nil
}
+// ManifestRm removes the specified manifest list from storage
+func (ir *ImageEngine) ManifestRm(ctx context.Context, names []string) (*entities.ImageRemoveReport, []error) {
+ return ir.Remove(ctx, names, entities.ImageRemoveOptions{})
+}
+
// ManifestPush pushes a manifest list or image index to the destination
func (ir *ImageEngine) ManifestPush(ctx context.Context, name, destination string, opts entities.ImagePushOptions) (string, error) {
options := new(images.PushOptions)