Pārlūkot izejas kodu

Merge pull request #31704 from mlaventure/handle-paused-container-on-non-live-restore

Handle paused container when restoring without live-restore set
Michael Crosby 8 gadi atpakaļ
vecāks
revīzija
abb0fec9d0
1 mainītis faili ar 10 papildinājumiem un 0 dzēšanām
  1. 10 0
      libcontainerd/client_linux.go

+ 10 - 0
libcontainerd/client_linux.go

@@ -523,8 +523,18 @@ func (clnt *client) Restore(containerID string, attachStdio StdioCallback, optio
 	if err := clnt.Signal(containerID, int(syscall.SIGTERM)); err != nil {
 		logrus.Errorf("libcontainerd: error sending sigterm to %v: %v", containerID, err)
 	}
+
 	// Let the main loop handle the exit event
 	clnt.remote.Unlock()
+
+	if ev != nil && ev.Type == StatePause {
+		// resume container, it depends on the main loop, so we do it after Unlock()
+		logrus.Debugf("libcontainerd: %s was paused, resuming it so it can die", containerID)
+		if err := clnt.Resume(containerID); err != nil {
+			return fmt.Errorf("failed to resume container: %v", err)
+		}
+	}
+
 	select {
 	case <-time.After(10 * time.Second):
 		if err := clnt.Signal(containerID, int(syscall.SIGKILL)); err != nil {