Merge pull request #4141 from giuseppe/add-cgroups-info
info: add cgroups2
This commit is contained in:
commit
5702dd7005
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/buildah"
|
"github.com/containers/buildah"
|
||||||
|
"github.com/containers/libpod/pkg/cgroups"
|
||||||
"github.com/containers/libpod/pkg/rootless"
|
"github.com/containers/libpod/pkg/rootless"
|
||||||
"github.com/containers/libpod/utils"
|
"github.com/containers/libpod/utils"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
|
|
@ -29,6 +30,15 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
|
||||||
info["arch"] = runtime.GOARCH
|
info["arch"] = runtime.GOARCH
|
||||||
info["cpus"] = runtime.NumCPU()
|
info["cpus"] = runtime.NumCPU()
|
||||||
info["rootless"] = rootless.IsRootless()
|
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()
|
mi, err := system.ReadMemInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error reading memory info")
|
return nil, errors.Wrapf(err, "error reading memory info")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue