From f00edc2b2dcc584d86b607922cf06e3ed351b1d8 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Mon, 15 May 2017 12:12:29 +0200 Subject: [PATCH] server: do not remove but stop sandboxes on shutdown Signed-off-by: Antonio Murdaca --- server/sandbox_remove.go | 13 ++++++------- server/server.go | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/server/sandbox_remove.go b/server/sandbox_remove.go index e2502cba..855df465 100644 --- a/server/sandbox_remove.go +++ b/server/sandbox_remove.go @@ -107,16 +107,15 @@ func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxR return resp, nil } -// RemoveAllPodSandboxes removes all pod sandboxes -func (s *Server) RemoveAllPodSandboxes() { - logrus.Debugf("RemoveAllPodSandboxes") - s.Update() +// StopAllPodSandboxes removes all pod sandboxes +func (s *Server) StopAllPodSandboxes() { + logrus.Debugf("StopAllPodSandboxes") for _, sb := range s.state.sandboxes { - pod := &pb.RemovePodSandboxRequest{ + pod := &pb.StopPodSandboxRequest{ PodSandboxId: sb.id, } - if _, err := s.RemovePodSandbox(nil, pod); err != nil { - logrus.Warnf("could not RemovePodSandbox %s: %v", sb.id, err) + if _, err := s.StopPodSandbox(nil, pod); err != nil { + logrus.Warnf("could not StopPodSandbox %s: %v", sb.id, err) } } } diff --git a/server/server.go b/server/server.go index 533149ae..1b0570c8 100644 --- a/server/server.go +++ b/server/server.go @@ -510,7 +510,7 @@ func (s *Server) cleanupSandboxesOnShutdown() { _, err := os.Stat(shutdownFile) if err == nil || !os.IsNotExist(err) { logrus.Debugf("shutting down all sandboxes, on shutdown") - s.RemoveAllPodSandboxes() + s.StopAllPodSandboxes() err = os.Remove(shutdownFile) if err != nil { logrus.Warnf("Failed to remove %q", shutdownFile)