diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2019-08-19 07:41:50 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2019-08-19 07:41:50 -0400 |
commit | 539b7b6058a1b034e7b982dec3a822e024a24d54 (patch) | |
tree | 0ea0596e4b28aa59269bff45a4b66dd4938b5090 /cmd | |
parent | 98dee275d04dafa087db12bc3f0593a078039cfb (diff) | |
download | podman-539b7b6058a1b034e7b982dec3a822e024a24d54.tar.gz podman-539b7b6058a1b034e7b982dec3a822e024a24d54.tar.bz2 podman-539b7b6058a1b034e7b982dec3a822e024a24d54.zip |
Fix error message on podman stats on cgroups v1 rootless environments
podman stats does not work in rootless environments with cgroups V1.
Fix error message and document this fact.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/stats.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index 2f696445e..25514ec75 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -134,9 +134,13 @@ func statsCmd(c *cliconfig.StatsValues) error { initialStats, err := ctr.GetContainerStats(&libpod.ContainerStats{}) if err != nil { // when doing "all", dont worry about containers that are not running - if c.All && errors.Cause(err) == define.ErrCtrRemoved || errors.Cause(err) == define.ErrNoSuchCtr || errors.Cause(err) == define.ErrCtrStateInvalid { + cause := errors.Cause(err) + if c.All && (cause == define.ErrCtrRemoved || cause == define.ErrNoSuchCtr || cause == define.ErrCtrStateInvalid) { continue } + if cause == cgroups.ErrCgroupV1Rootless { + err = cause + } return err } containerStats[ctr.ID()] = initialStats |