summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-10-11 16:09:11 +0200
committerMatthew Heon <matthew.heon@pm.me>2021-10-19 15:56:35 -0400
commitfbe94088fd3dea66afcd7c7d26f1e2454b782b4d (patch)
tree22c764fcd60a3841f515f3653034f2256eee11c6 /pkg
parent338e01f04877578c7fdd0c847da81333fcc5b00b (diff)
downloadpodman-fbe94088fd3dea66afcd7c7d26f1e2454b782b4d.tar.gz
podman-fbe94088fd3dea66afcd7c7d26f1e2454b782b4d.tar.bz2
podman-fbe94088fd3dea66afcd7c7d26f1e2454b782b4d.zip
podman stats: move cgroup validation to server
Podman stats is not supported for rootless cgroupv1 setups. The check for this must be on the server side and not the client. [NO NEW TESTS NEEDED] we cannot test this because remote and server are always on the same machine in CI Fixes #11909 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/domain/infra/abi/containers.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 774362d03..d1e430f3b 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -1316,6 +1316,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