Skip to content

Commit

Permalink
info: add cgroups2
Browse files Browse the repository at this point in the history
Closes: containers#4080

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Sep 30, 2019
1 parent 01b7af8 commit b40e44a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libpod/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
Expand Down

0 comments on commit b40e44a

Please sign in to comment.