diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-11 19:44:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-11 19:44:12 +0200 |
commit | 6f3cf534b70bb14291edb14b286f1c4981f542c1 (patch) | |
tree | fcf04fae703b72838b56655dadbdde00552467de /pkg | |
parent | b1a2657b4b00b35edd6eb1073631bc0f8c6c5c78 (diff) | |
parent | e57b32c5956ac4f8cfdbfaabe7b23425a22a08e1 (diff) | |
download | podman-6f3cf534b70bb14291edb14b286f1c4981f542c1.tar.gz podman-6f3cf534b70bb14291edb14b286f1c4981f542c1.tar.bz2 podman-6f3cf534b70bb14291edb14b286f1c4981f542c1.zip |
Merge pull request #11919 from Luap99/stats-cgroup
podman stats: move cgroup validation to server
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 6ca142618..c30129001 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -1319,6 +1319,15 @@ func (ic *ContainerEngine) ContainerStats(ctx context.Context, namesOrIds []stri if options.Interval < 1 { return nil, errors.New("Invalid interval, must be a positive number greater zero") } + if rootless.IsRootless() { + unified, err := cgroups.IsCgroup2UnifiedMode() + if err != nil { + return nil, err + } + if !unified { + return nil, errors.New("stats is not supported in rootless mode without cgroups v2") + } + } statsChan = make(chan entities.ContainerStatsReport, 1) containerFunc := ic.Libpod.GetRunningContainers |