Fix reporting summed image size for compat endpoint

Signed-off-by: Jakub Panek <me@panekj.dev>
This commit is contained in:
Jakub Panek
2025-02-23 04:05:23 +01:00
parent cbc73457ab
commit 4dbbf264c7
2 changed files with 5 additions and 1 deletions

View File

@ -89,7 +89,7 @@ func GetDiskUsage(w http.ResponseWriter, r *http.Request) {
} }
utils.WriteResponse(w, http.StatusOK, handlers.DiskUsage{DiskUsage: docker.DiskUsage{ utils.WriteResponse(w, http.StatusOK, handlers.DiskUsage{DiskUsage: docker.DiskUsage{
LayersSize: 0, LayersSize: df.ImagesSize,
Images: imgs, Images: imgs,
Containers: ctnrs, Containers: ctnrs,
Volumes: vols, Volumes: vols,

View File

@ -34,6 +34,10 @@ t POST containers/create Image=$IMAGE Volumes='{"/test":{}}' HostConfig='{"Binds
.Id~[0-9a-f]\\{64\\} .Id~[0-9a-f]\\{64\\}
cid=$(jq -r '.Id' <<<"$output") cid=$(jq -r '.Id' <<<"$output")
# Verify image takes size
t GET system/df 200 '.LayersSize=12180391'
t GET libpod/system/df 200 '.ImagesSize=12180391'
# Verify that one container references the volume # Verify that one container references the volume
t GET system/df 200 '.Volumes[0].UsageData.RefCount=1' t GET system/df 200 '.Volumes[0].UsageData.RefCount=1'