runtime: sandbox delete should succeed after verifying sandbox state

Otherwise we might block delete and create orphan containers.

Fixes: #1039

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
Signed-off-by: Eric Ernst <eric_ernst@apple.com>
This commit is contained in:
Peng Tao 2020-10-18 11:58:55 +08:00 committed by Eric Ernst
parent c995a982bc
commit 35151f1786

View File

@ -686,13 +686,13 @@ func (s *Sandbox) Delete(ctx context.Context) error {
for _, c := range s.containers {
if err := c.delete(ctx); err != nil {
return err
s.Logger().WithError(err).WithField("cid", c.id).Debug("failed to delete container")
}
}
if !rootless.IsRootless() {
if err := s.cgroupsDelete(); err != nil {
return err
s.Logger().WithError(err).Error("failed to cleanup cgroups")
}
}