Skip to content

Commit

Permalink
Merge pull request #20100 from Luap99/pod-rm-volume
Browse files Browse the repository at this point in the history
pod rm: do not log error if anonymous volume is still used
  • Loading branch information
openshift-merge-robot authored Sep 22, 2023
2 parents 5a3a9ce + af2665c commit 67aab13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libpod/runtime_pod_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool,
continue
}
if err := r.removeVolume(ctx, volume, false, timeout, false); err != nil {
if errors.Is(err, define.ErrNoSuchVolume) || errors.Is(err, define.ErrVolumeRemoved) {
// If the anonymous volume is still being used that means it was likely transferred
// to another container via --volumes-from so no need to log this as real error.
if errors.Is(err, define.ErrNoSuchVolume) || errors.Is(err, define.ErrVolumeRemoved) || errors.Is(err, define.ErrVolumeBeingUsed) {
continue
}
logrus.Errorf("Removing volume %s: %v", volName, err)
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/play_kube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5704,6 +5704,11 @@ spec:
Expect(inspectCtr1).Should(ExitCleanly())

Expect(inspectCtr2.OutputToString()).To(Equal(inspectCtr1.OutputToString()))

// see https://github.com/containers/podman/pull/19637, we should not see any warning/errors here
podrm := podmanTest.Podman([]string{"kube", "down", outputFile})
podrm.WaitWithDefaultTimeout()
Expect(podrm).Should(ExitCleanly())
})

It("test with reserved autoremove annotation in yaml", func() {
Expand Down

0 comments on commit 67aab13

Please sign in to comment.