diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 10bc46d21a..db8f9f3c0c 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -1633,7 +1633,8 @@ func (ic *ContainerEngine) ContainerStats(ctx context.Context, namesOrIds []stri // update the container state // https://github.com/containers/podman/issues/23334 (errors.Is(err, define.ErrCtrRemoved) || errors.Is(err, define.ErrNoSuchCtr) || - errors.Is(err, define.ErrCtrStateInvalid) || errors.Is(err, define.ErrCtrStopped)) { + errors.Is(err, define.ErrCtrStateInvalid) || errors.Is(err, define.ErrCtrStopped) || + errors.Is(err, define.ErrNoCgroups)) { continue } return nil, err diff --git a/test/system/420-cgroups.bats b/test/system/420-cgroups.bats index 084c9ae1c3..94ad19ebef 100644 --- a/test/system/420-cgroups.bats +++ b/test/system/420-cgroups.bats @@ -52,6 +52,19 @@ load helpers # --cgroupns=host is required to have full visibility of the cgroup path inside the container run_podman run --cgroups=disabled --cgroupns=host --rm $IMAGE cat /proc/self/cgroup is "$output" $current_cgroup "--cgroups=disabled must not change the current cgroup" + + ctr1="c1-$(safename)" + ctr2="c2-$(safename)" + + # verify that "podman stats --all" works when there is a container with --cgroups=disabled + run_podman run --cgroups=disabled --name $ctr1 -d $IMAGE top + run_podman run --name $ctr2 -d $IMAGE top + + run_podman stats -a --no-stream --no-reset + assert "$output" !~ "$ctr1" "ctr1 not in stats output" + assert "$output" =~ "$ctr2" "ctr2 in stats output" + + run_podman rm -f -t 0 $ctr1 $ctr2 } # vim: filetype=sh