Merge pull request #14720 from sstosh/rm-option

Fix: Prevent OCI runtime directory remain
This commit is contained in:
openshift-ci[bot]
2022-06-29 19:51:53 +00:00
committed by GitHub
5 changed files with 40 additions and 1 deletions

View File

@ -666,6 +666,15 @@ func (c *Container) Cleanup(ctx context.Context) error {
defer c.lock.Unlock()
if err := c.syncContainer(); err != nil {
switch errors.Cause(err) {
// When the container has already been removed, the OCI runtime directory remain.
case define.ErrNoSuchCtr, define.ErrCtrRemoved:
if err := c.cleanupRuntime(ctx); err != nil {
return errors.Wrapf(err, "error cleaning up container %s from OCI runtime", c.ID())
}
default:
logrus.Errorf("Syncing container %s status: %v", c.ID(), err)
}
return err
}
}