Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/domain/infra/abi/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"errors"
"fmt"
"io/fs"
"net/url"
"os"
"os/exec"
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions pkg/domain/infra/abi/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ func (ic *ContainerEngine) VolumeInspect(_ context.Context, namesOrIds []string,
for _, v := range vols {
inspectOut, err := v.Inspect()
if err != nil {
if opts.All && errors.Is(err, define.ErrNoSuchVolume) {
// Volume must have been removed in the meantime,
// because all volumes were requested just ignore
// the case to make inspecting all volumes not fail randomly.
continue
}
return nil, nil, err
}
config := entities.VolumeConfigResponse{
Expand Down
4 changes: 2 additions & 2 deletions test/system/055-rm.bats
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ load helpers

# DO NOT CHANGE "sleep infinity"! This is how we get a container to
# remain in state "stopping" for long enough to check it.
# $1 = container name, $2 = optional stop-timeout (default 2)
# $1 = container name, $2 = optional stop-timeout (default 4)
function __run_healthcheck_container() {
local stop_timeout=${2:-2}
local stop_timeout=${2:-4}
run_podman run -d --name $1 \
--health-cmd /bin/false \
--health-interval 1s \
Expand Down