Skip to content

Commit

Permalink
Merge pull request #14069 from brian-athinkingape/cli-fix-memstats-cg…
Browse files Browse the repository at this point in the history
…roupsv2

cli: for systems with cgroups v2, fix alloation resource utilization showing 0 memory used
  • Loading branch information
shoenig committed Aug 11, 2022
2 parents e144298 + c0626da commit 1692112
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/14069.txt
Original file line number Diff line number Diff line change
@@ -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
```
6 changes: 5 additions & 1 deletion command/node_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1692112

Please sign in to comment.