summaryrefslogtreecommitdiff
path: root/pkg/cgroups/cgroups.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-20 16:57:55 +0200
committerGitHub <noreply@github.com>2019-08-20 16:57:55 +0200
commit230faa864f8922f16a0d70c4a3454d51768e9a15 (patch)
tree4e6f9e0d5436e0bc8f484b7a33e48dc3a8d67216 /pkg/cgroups/cgroups.go
parent34fc1d09d245cbd0d922562860f639667c8641d6 (diff)
parent539b7b6058a1b034e7b982dec3a822e024a24d54 (diff)
downloadpodman-230faa864f8922f16a0d70c4a3454d51768e9a15.tar.gz
podman-230faa864f8922f16a0d70c4a3454d51768e9a15.tar.bz2
podman-230faa864f8922f16a0d70c4a3454d51768e9a15.zip
Merge pull request #3569 from rhatdan/cgroupsv1
Fix error message on podman stats on cgroups v1 rootless environments
Diffstat (limited to 'pkg/cgroups/cgroups.go')
-rw-r--r--pkg/cgroups/cgroups.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index 085718855..9711e8120 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -10,6 +10,7 @@ import (
"strconv"
"strings"
+ "github.com/containers/libpod/pkg/rootless"
systemdDbus "github.com/coreos/go-systemd/dbus"
"github.com/godbus/dbus"
spec "github.com/opencontainers/runtime-spec/specs-go"
@@ -19,7 +20,9 @@ import (
var (
// ErrCgroupDeleted means the cgroup was deleted
- ErrCgroupDeleted = errors.New("cgroups: cgroup deleted")
+ ErrCgroupDeleted = errors.New("cgroup deleted")
+ // ErrCgroupV1Rootless means the cgroup v1 were attempted to be used in rootless environmen
+ ErrCgroupV1Rootless = errors.New("no support for CGroups V1 in rootless environments")
)
// CgroupControl controls a cgroup hierarchy
@@ -339,6 +342,9 @@ func Load(path string) (*CgroupControl, error) {
p := control.getCgroupv1Path(name)
if _, err := os.Stat(p); err != nil {
if os.IsNotExist(err) {
+ if rootless.IsRootless() {
+ return nil, ErrCgroupV1Rootless
+ }
// compatible with the error code
// used by containerd/cgroups
return nil, ErrCgroupDeleted