mirror of
https://github.com/containers/podman.git
synced 2025-05-19 08:07:10 +08:00
cleanup: add new --stopped-only option
The podman container cleanup process runs asynchronous and by the time it gets the lock it is possible another podman process already did the cleanup and then did a new init() to start it again. If the cleanup process gets the lock there it will cause very weird things. This can be observed in the remote start API as CI flakes. Fixes #23754 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -180,7 +180,7 @@ func (p *Pod) stopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
|
||||
}
|
||||
|
||||
if cleanup {
|
||||
err := c.Cleanup(ctx)
|
||||
err := c.Cleanup(ctx, false)
|
||||
if err != nil && !errors.Is(err, define.ErrCtrStateInvalid) && !errors.Is(err, define.ErrCtrStopped) {
|
||||
return err
|
||||
}
|
||||
@ -299,7 +299,7 @@ func (p *Pod) Cleanup(ctx context.Context) (map[string]error, error) {
|
||||
c := ctr
|
||||
logrus.Debugf("Adding parallel job to clean up container %s", c.ID())
|
||||
retChan := parallel.Enqueue(ctx, func() error {
|
||||
return c.Cleanup(ctx)
|
||||
return c.Cleanup(ctx, false)
|
||||
})
|
||||
|
||||
ctrErrChan[c.ID()] = retChan
|
||||
|
Reference in New Issue
Block a user