Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libmage: Exists: catch corrupted images
While various execution paths in libimage already handle corrupted images, `(*Runtime).Exists()` did not and would list an image to exist in the storage even if it is corrupted. Some corruptions can only be detected when accessing the individual data. A reliable way of accessing such data is to inspect an image. Hence, an image will only be listed to exist if a) it has been found and b) can be inspected. If the inspection fails, the image will be reported to not exists but without an error. That allows for users of libimage to properly recover and repull. Further, add a new unit tests that forces a data corruption and gradually recovers from it. Podman will now behave as follows: ``` $ ./bin/podman run -d --rm nginx ls ERRO[0000] Image nginx exists in local storage but may be corrupted: layer not known ERRO[0000] Looking up nginx in local storage: layer not known Resolved "nginx" as an alias (/home/vrothberg/.cache/containers/short-name-aliases.conf) Trying to pull docker.io/library/nginx:latest... Getting image source signatures Copying blob 596b1d696923 skipped: already exists Copying blob 30afc0b18f67 skipped: already exists Copying blob febe5bd23e98 skipped: already exists Copying blob 69692152171a skipped: already exists Copying blob 8283eee92e2f skipped: already exists Copying blob 351ad75a6cfa done Copying config d1a364dc54 done Writing manifest to image destination Storing signatures 56b65883c3c32b67277bcc173bd9f26c27cbbdbc6d3aacf6c552be796eb7a337 ``` Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
- Loading branch information