Merge pull request #37 from mrunalp/pod_stop_check
Check if container in a pod is already stopped before stopping it
This commit is contained in:
commit
3f77076fc2
1 changed files with 5 additions and 2 deletions
|
@ -226,8 +226,11 @@ func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxReque
|
||||||
return nil, fmt.Errorf("failed to destroy network for container %s in sandbox %s: %v", c.Name(), *sbName, err)
|
return nil, fmt.Errorf("failed to destroy network for container %s in sandbox %s: %v", c.Name(), *sbName, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := s.runtime.StopContainer(c); err != nil {
|
cStatus := s.runtime.ContainerStatus(c)
|
||||||
return nil, fmt.Errorf("failed to stop container %s in sandbox %s: %v", c.Name(), *sbName, err)
|
if cStatus.Status != "stopped" {
|
||||||
|
if err := s.runtime.StopContainer(c); err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to stop container %s in sandbox %s: %v", c.Name(), *sbName, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue