mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
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:
parent
c995a982bc
commit
35151f1786
@ -686,13 +686,13 @@ func (s *Sandbox) Delete(ctx context.Context) error {
|
|||||||
|
|
||||||
for _, c := range s.containers {
|
for _, c := range s.containers {
|
||||||
if err := c.delete(ctx); err != nil {
|
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 !rootless.IsRootless() {
|
||||||
if err := s.cgroupsDelete(); err != nil {
|
if err := s.cgroupsDelete(); err != nil {
|
||||||
return err
|
s.Logger().WithError(err).Error("failed to cleanup cgroups")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user