mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-04 18:30:03 +00:00
shimv2: cleanup container if not found
Shutdown API relies on it being cleaned up in order to proceed. Otherwise it fails silently and shimv2 process never quits. This can be triggered by killing the vmm while pod is running. Fixes: #2345 Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
@@ -17,11 +17,11 @@ import (
|
||||
)
|
||||
|
||||
func deleteContainer(ctx context.Context, s *service, c *container) error {
|
||||
if !c.cType.IsSandbox() {
|
||||
status, err := s.sandbox.StatusContainer(c.id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
status, err := s.sandbox.StatusContainer(c.id)
|
||||
if err != nil && !isNotFound(err) {
|
||||
return err
|
||||
}
|
||||
if !c.cType.IsSandbox() && err == nil {
|
||||
if status.State.State != types.StateStopped {
|
||||
_, err = s.sandbox.StopContainer(c.id, false)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user