summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-16 19:37:56 +0100
committerGitHub <noreply@github.com>2020-11-16 19:37:56 +0100
commit5843f33a125d3feaacb3d38f410c7d67484a2b37 (patch)
tree0122d290411fe359837182bc52208cebd5c55357
parent6f08f2a2385d0dd8ad7c246e0996f932ad0f1a2f (diff)
parentff65d6095dbb428bc8e3c560b305a20f526ae47c (diff)
downloadpodman-5843f33a125d3feaacb3d38f410c7d67484a2b37.tar.gz
podman-5843f33a125d3feaacb3d38f410c7d67484a2b37.tar.bz2
podman-5843f33a125d3feaacb3d38f410c7d67484a2b37.zip
Merge pull request #8339 from rhatdan/df
Wrap missing container errors with container ID
-rw-r--r--pkg/domain/infra/abi/system.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index 613c4a6d8..72fd98ac1 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -17,6 +17,7 @@ import (
"github.com/containers/podman/v2/pkg/rootless"
"github.com/containers/podman/v2/pkg/util"
"github.com/containers/podman/v2/utils"
+ "github.com/containers/storage"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -231,17 +232,25 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System
dfContainers := make([]*entities.SystemDfContainerReport, 0, len(cons))
for _, c := range cons {
iid, _ := c.Image()
- conSize, err := c.RootFsSize()
+ state, err := c.State()
if err != nil {
- return nil, err
+ return nil, errors.Wrapf(err, "Failed to get state of container %s", c.ID())
}
- state, err := c.State()
+ conSize, err := c.RootFsSize()
if err != nil {
- return nil, err
+ if errors.Cause(err) == storage.ErrContainerUnknown {
+ logrus.Error(errors.Wrapf(err, "Failed to get root file system size of container %s", c.ID()))
+ } else {
+ return nil, errors.Wrapf(err, "Failed to get root file system size of container %s", c.ID())
+ }
}
rwsize, err := c.RWSize()
if err != nil {
- return nil, err
+ if errors.Cause(err) == storage.ErrContainerUnknown {
+ logrus.Error(errors.Wrapf(err, "Failed to get read/write size of container %s", c.ID()))
+ } else {
+ return nil, errors.Wrapf(err, "Failed to get read/write size of container %s", c.ID())
+ }
}
report := entities.SystemDfContainerReport{
ContainerID: c.ID(),