mirror of
https://github.com/containers/podman.git
synced 2025-10-17 19:24:04 +08:00
pod rm: do not log error if anonymous volume is still used
This is not really an error, if the anonymous volume is still used then this likely means it was transferred to another container with --volumes-from. This is what the user wants and it is not like the user can act on the logged error anyway. Once the last user of the volume is removed it will be removed correctly. see https://github.com/containers/podman/pull/19637 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -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)
|
||||
|
@ -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() {
|
||||
|
Reference in New Issue
Block a user