server: do not remove but stop sandboxes on shutdown
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
4a8debe6c5
commit
f00edc2b2d
2 changed files with 7 additions and 8 deletions
|
@ -107,16 +107,15 @@ func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxR
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveAllPodSandboxes removes all pod sandboxes
|
// StopAllPodSandboxes removes all pod sandboxes
|
||||||
func (s *Server) RemoveAllPodSandboxes() {
|
func (s *Server) StopAllPodSandboxes() {
|
||||||
logrus.Debugf("RemoveAllPodSandboxes")
|
logrus.Debugf("StopAllPodSandboxes")
|
||||||
s.Update()
|
|
||||||
for _, sb := range s.state.sandboxes {
|
for _, sb := range s.state.sandboxes {
|
||||||
pod := &pb.RemovePodSandboxRequest{
|
pod := &pb.StopPodSandboxRequest{
|
||||||
PodSandboxId: sb.id,
|
PodSandboxId: sb.id,
|
||||||
}
|
}
|
||||||
if _, err := s.RemovePodSandbox(nil, pod); err != nil {
|
if _, err := s.StopPodSandbox(nil, pod); err != nil {
|
||||||
logrus.Warnf("could not RemovePodSandbox %s: %v", sb.id, err)
|
logrus.Warnf("could not StopPodSandbox %s: %v", sb.id, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,7 +510,7 @@ func (s *Server) cleanupSandboxesOnShutdown() {
|
||||||
_, err := os.Stat(shutdownFile)
|
_, err := os.Stat(shutdownFile)
|
||||||
if err == nil || !os.IsNotExist(err) {
|
if err == nil || !os.IsNotExist(err) {
|
||||||
logrus.Debugf("shutting down all sandboxes, on shutdown")
|
logrus.Debugf("shutting down all sandboxes, on shutdown")
|
||||||
s.RemoveAllPodSandboxes()
|
s.StopAllPodSandboxes()
|
||||||
err = os.Remove(shutdownFile)
|
err = os.Remove(shutdownFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Warnf("Failed to remove %q", shutdownFile)
|
logrus.Warnf("Failed to remove %q", shutdownFile)
|
||||||
|
|
Loading…
Add table
Reference in a new issue