automation-tests/common/libimage
Paul Holzinger e3d6a28822 libimage: rework DiskUsage() to count layers
The old implementation only counted full images when sharing content
between them. That is wrong, the store is layer based. We can have two
images with no parent image that shares layers.

As such get rid of the image tree that only is able to walk child/parent
images. Instead we actually walk all layers now and correctly notice
when they are shared.

To this this correctly, first convert all layers to map so we can look
them up by ID. And add missing size information if needed. Then we walk
all images layers and count how often each layers is used. Then walk
again but this time we know if the layer size must be shared or not so
we can actually acount things correctly.

Fixes: containers/podman#24452
Fixes: https://issues.redhat.com/browse/RHEL-29641

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-10 12:16:22 +01:00
..
define libimage.ManifestList.Inspect(): show artifact types and file lists 2024-02-05 09:49:17 -05:00
filter libimage: split out search filters 2023-09-12 13:54:20 +02:00
manifests Use UnparsedInstance.Manifest instead of ImageSource.GetManifest 2025-02-28 20:16:28 +01:00
platform Fix SA1019: replace deprecated github.com/containerd/containerd/platforms with github.com/containerd/platforms 2024-08-22 09:51:42 +02:00
testdata libimage should be using containers.conf for tmpdir 2022-05-04 16:55:25 -04:00
copier.go Reliably return the correct image ID from pull 2024-11-05 19:42:11 +01:00
corrupted_test.go Fix spelling mistake 2024-05-27 06:14:44 -04:00
disk_usage.go libimage: rework DiskUsage() to count layers 2025-03-10 12:16:22 +01:00
disk_usage_test.go libimage: rework DiskUsage() to count layers 2025-03-10 12:16:22 +01:00
events.go Report error events on pull failures 2024-02-29 11:32:41 -05:00
filters.go update golangci-lint to 1.60.3 2024-09-03 15:57:02 +02:00
filters_test.go Add ListImagesByNames and change the ListImages API 2024-08-28 15:19:53 +02:00
history.go Improve runtime.layerTree method to be consistent 2024-08-28 16:00:59 +02:00
history_test.go Simplify tests by testing.TempDir instead of os.MkdirTemp 2024-01-05 22:54:51 +02:00
image.go Use UnparsedInstance.Manifest instead of ImageSource.GetManifest 2025-02-28 20:16:28 +01:00
image_config.go chore: remove outdated build constraints 2024-01-03 22:56:00 +02:00
image_test.go libimage tests: try to avoid docker.io images 2024-11-19 18:50:55 +01:00
image_tree.go Improve runtime.layerTree method to be consistent 2024-08-28 16:00:59 +02:00
import.go Reliably return the correct image ID from pull 2024-11-05 19:42:11 +01:00
import_test.go Simplify tests by testing.TempDir instead of os.MkdirTemp 2024-01-05 22:54:51 +02:00
inspect.go Use UnparsedInstance.Manifest instead of ImageSource.GetManifest 2025-02-28 20:16:28 +01:00
layer_tree.go libimage: rework DiskUsage() to count layers 2025-03-10 12:16:22 +01:00
load.go libimage: use fileutils.(Le|E)xists 2024-04-10 12:23:07 +02:00
load_test.go fix issues reported by usetesting 2025-02-14 11:50:50 +01:00
manifest_list.go Add a missing .Close() 2025-02-28 20:16:31 +01:00
manifest_list_test.go Use UnparsedInstance.Manifest instead of ImageSource.GetManifest 2025-02-28 20:16:28 +01:00
normalize.go chore: remove outdated build constraints 2024-01-03 22:56:00 +02:00
normalize_test.go chore: remove outdated build constraints 2024-01-03 22:56:00 +02:00
oci.go chore: remove outdated build constraints 2024-01-03 22:56:00 +02:00
platform.go chore: remove outdated build constraints 2024-01-03 22:56:00 +02:00
pull.go Reliably return the correct image ID from pull 2024-11-05 19:42:11 +01:00
pull_test.go libimage tests: try to avoid docker.io images 2024-11-19 18:50:55 +01:00
push.go Only reset compression if its not valid 2024-11-29 17:55:58 +00:00
push_test.go fix issues reported by usetesting 2025-02-14 11:50:50 +01:00
remove_test.go libimage tests: try to avoid docker.io images 2024-11-19 18:50:55 +01:00
runtime.go Improve runtime.layerTree method to be consistent 2024-08-28 16:00:59 +02:00
runtime_test.go fix issues reported by usetesting 2025-02-14 11:50:50 +01:00
save.go Reliably return the correct image ID from pull 2024-11-05 19:42:11 +01:00
save_test.go fix issues reported by usetesting 2025-02-14 11:50:50 +01:00
search.go update golangci-lint to 1.60.3 2024-09-03 15:57:02 +02:00
types.go Make the definition of LookupReferenceFunc unconditional 2024-07-15 10:24:02 -04:00