info: add cgroups2
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
61e32a5711
commit
4069d6581a
12
info.go
12
info.go
|
@ -11,6 +11,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/cgroups"
|
||||||
"github.com/containers/buildah/pkg/unshare"
|
"github.com/containers/buildah/pkg/unshare"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/storage/pkg/system"
|
||||||
|
@ -45,6 +46,17 @@ func hostInfo() map[string]interface{} {
|
||||||
info["arch"] = runtime.GOARCH
|
info["arch"] = runtime.GOARCH
|
||||||
info["cpus"] = runtime.NumCPU()
|
info["cpus"] = runtime.NumCPU()
|
||||||
info["rootless"] = unshare.IsRootless()
|
info["rootless"] = unshare.IsRootless()
|
||||||
|
|
||||||
|
unified, err := cgroups.IsCgroup2UnifiedMode()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Error(err, "err 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 {
|
||||||
logrus.Error(err, "err reading memory info")
|
logrus.Error(err, "err reading memory info")
|
||||||
|
|
Loading…
Reference in New Issue