Merge pull request #14069 from brian-athinkingape/cli-fix-memstats-cgroupsv2

cli: for systems with cgroups v2, fix alloation resource utilization showing 0 memory used
This commit is contained in:
Seth Hoenig
2022-08-11 07:27:48 -05:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

3
.changelog/14069.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
cli: Fixed a bug where the memory usage reported by Allocation Resource Utilization is zero on systems using cgroups v2
```

View File

@@ -964,7 +964,11 @@ func getActualResources(client *api.Client, runningAllocs []*api.Allocation, nod
}
cpu += stats.ResourceUsage.CpuStats.TotalTicks
mem += stats.ResourceUsage.MemoryStats.RSS
if stats.ResourceUsage.MemoryStats.Usage > 0 {
mem += stats.ResourceUsage.MemoryStats.Usage
} else {
mem += stats.ResourceUsage.MemoryStats.RSS
}
}
resources := make([]string, 2)