mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-31 04:04:51 +00:00
cpu: Take cgroupsv1 into account when reading misc.capacity
We've been only considering cgroupsv2 when trying to read misc.capacity. However, there are still a bunch of systems out there relying on cgroupsv1. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
5f181cc6d0
commit
8ed5a2343f
1 changed files with 12 additions and 3 deletions
|
@ -124,13 +124,22 @@ func sevParameterEnabled(parameter string) bool {
|
|||
|
||||
func getCgroupMiscCapacity(resource string) int64 {
|
||||
var totalResources int64 = -1
|
||||
var err error = nil
|
||||
var f *os.File = nil
|
||||
|
||||
miscCgroupsPaths := []string{"fs/cgroup/misc.capacity", "fs/cgroup/misc/misc.capacity"}
|
||||
for _, miscCgroupsPath := range miscCgroupsPaths {
|
||||
miscCgroups := hostpath.SysfsDir.Path(miscCgroupsPath)
|
||||
f, err = os.Open(miscCgroups)
|
||||
if err == nil {
|
||||
defer f.Close()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
miscCgroups := hostpath.SysfsDir.Path("fs/cgroup/misc.capacity")
|
||||
f, err := os.Open(miscCgroups)
|
||||
if err != nil {
|
||||
return totalResources
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
r := bufio.NewReader(f)
|
||||
for {
|
||||
|
|
Loading…
Add table
Reference in a new issue