diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-09-30 13:20:16 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-09-30 21:38:00 +0200 |
commit | b40e44ac1a7df443c8700874d23451682092599b (patch) | |
tree | 9f8b5ae056466602511a511cf0c4e62644b11a3d /libpod/info.go | |
parent | 01b7af8ee9b3df1439c4da109ba11e7410108dab (diff) | |
download | podman-b40e44ac1a7df443c8700874d23451682092599b.tar.gz podman-b40e44ac1a7df443c8700874d23451682092599b.tar.bz2 podman-b40e44ac1a7df443c8700874d23451682092599b.zip |
info: add cgroups2
Closes: https://github.com/containers/libpod/issues/4080
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/info.go')
-rw-r--r-- | libpod/info.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/info.go b/libpod/info.go index e5132b5f6..297086ebb 100644 --- a/libpod/info.go +++ b/libpod/info.go @@ -13,6 +13,7 @@ import ( "time" "github.com/containers/buildah" + "github.com/containers/libpod/pkg/cgroups" "github.com/containers/libpod/pkg/rootless" "github.com/containers/libpod/utils" "github.com/containers/storage" @@ -29,6 +30,15 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) { info["arch"] = runtime.GOARCH info["cpus"] = runtime.NumCPU() info["rootless"] = rootless.IsRootless() + unified, err := cgroups.IsCgroup2UnifiedMode() + if err != nil { + return nil, errors.Wrapf(err, "error reading cgroups mode") + } + cgroupVersion := "v1" + if unified { + cgroupVersion = "v2" + } + info["CgroupVersion"] = cgroupVersion mi, err := system.ReadMemInfo() if err != nil { return nil, errors.Wrapf(err, "error reading memory info") |