[v5.2-rhel] Skip layer digests for podman system check --quick

podman system check --quick currently only skips layer contents, but
practically it's not much quicker than without the flag.

This changes the flag to also skip checking layer digests which speed up
the check significantly.

In some cases, it is useful to opt for a quicker check if we prioritize
detecting and fixing severe corruption and can tolerate minor damage.

The check option is derived from CRI-O's internal repair:
9e4d86d823/internal/lib/container_server.go (L860)

Fixes: https://issues.redhat.com/browse/OCPBUGS-57982

Cherry Picks: https://github.com/containers/podman/pull/26272

Signed-off-by: Sonny Sasaka <sonnysasaka@gmail.com>
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
This commit is contained in:
Sonny Sasaka
2025-06-03 14:01:47 -07:00
committed by tomsweeneyredhat
parent da46fda577
commit 4208690f50
2 changed files with 14 additions and 1 deletions

View File

@ -34,6 +34,8 @@ attempts to pull images, and should be treated as though they are damaged.
Skip checks which are known to be time-consuming. This will prevent some types Skip checks which are known to be time-consuming. This will prevent some types
of errors from being detected. of errors from being detected.
The exact checks performed by this option are subject to change.
#### **--repair**, **-r** #### **--repair**, **-r**
Remove any images which are determined to have been damaged in some way, unless Remove any images which are determined to have been damaged in some way, unless

View File

@ -1274,7 +1274,18 @@ func (r *Runtime) LockConflicts() (map[uint32][]string, []uint32, error) {
func (r *Runtime) SystemCheck(ctx context.Context, options entities.SystemCheckOptions) (entities.SystemCheckReport, error) { func (r *Runtime) SystemCheck(ctx context.Context, options entities.SystemCheckOptions) (entities.SystemCheckReport, error) {
what := storage.CheckEverything() what := storage.CheckEverything()
if options.Quick { if options.Quick {
what = storage.CheckMost() // Turn off checking layer digests and layer contents to do quick check.
// This is not a complete check like storage.CheckEverything(), and may fail detecting
// whether a file is missing from the image or its content has changed.
// In some cases it's desirable to trade check thoroughness for speed.
what = &storage.CheckOptions{
LayerDigests: false,
LayerMountable: true,
LayerContents: false,
LayerData: true,
ImageData: true,
ContainerData: true,
}
} }
if options.UnreferencedLayerMaximumAge != nil { if options.UnreferencedLayerMaximumAge != nil {
tmp := *options.UnreferencedLayerMaximumAge tmp := *options.UnreferencedLayerMaximumAge