Skip to content

Commit

Permalink
Merge pull request containers#4141 from giuseppe/add-cgroups-info
Browse files Browse the repository at this point in the history
info: add cgroups2
  • Loading branch information
openshift-merge-robot authored Sep 30, 2019
2 parents b063383 + b40e44a commit 5702dd7
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 5702dd7

Please sign in to comment.