Skip to content

Commit

Permalink
Merge pull request containers#8339 from rhatdan/df
Browse files Browse the repository at this point in the history
Wrap missing container errors with container ID
  • Loading branch information
openshift-merge-robot authored Nov 16, 2020
2 parents 6f08f2a + ff65d60 commit 5843f33
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions pkg/domain/infra/abi/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 5843f33

Please sign in to comment.