stats: map MaxUsage to the correct value

and make sure it is not set for cgroup v2

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2022-09-14 23:18:54 +02:00
parent a73b150e70
commit cf2118eab3
2 changed files with 7 additions and 1 deletions

View File

@ -177,7 +177,7 @@ streamLabel: // A label to flatten the scope
PreCPUStats: preCPUStats,
MemoryStats: docker.MemoryStats{
Usage: cgroupStat.MemoryStats.Usage.Usage,
MaxUsage: cgroupStat.MemoryStats.Usage.Limit,
MaxUsage: cgroupStat.MemoryStats.Usage.MaxUsage,
Stats: nil,
Failcnt: 0,
Limit: memoryLimit,

View File

@ -98,6 +98,12 @@ else
fi
fi
# max_usage is not set for cgroupv2
if have_cgroupsv2; then
t GET libpod/containers/stats?containers='[$cid]' 200 \
.memory_stats.max_usage=null
fi
t DELETE libpod/containers/$cid 200 .[0].Id=$cid
# Issue #14676: make sure the stats show the memory limit specified for the container