fix system df flake

When reading the mount path here it can be missing and thus fail with
ENOENT when the voluem is removed in parallel. Because we do not want to
block for a full directory walk of course with the volume lock the only
choice is to ignore the error.

I have seen this error many times in CI in the past weeks:
    FAIL: podman system df --format '{{"\n"}}'
expected: = ''
  actual:   Error: lstat /home/ubuntu.guest/.local/share/containers/storage/volumes/v-t450-1djh1zmh/_data: no such file or directory

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2026-06-19 17:35:26 +02:00
parent a057a9bbc5
commit 246724fc60

View File

@@ -6,6 +6,7 @@ import (
"context"
"errors"
"fmt"
"io/fs"
"net/url"
"os"
"os/exec"
@@ -271,6 +272,12 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, _ entities.SystemDfOpti
}
volSize, err := directory.Size(mountPoint)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
// volume is not locked here, if the directory is missing
// all of the sudden we must assume the volume was removed
// in parallel and ignore it like in the case below
continue
}
return nil, err
}
inUse, err := v.VolumeInUse()