mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-14 14:14:15 +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:
parent
743309cdc9
commit
6eae033f48
@ -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 {
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user