Browse code

Handle paused container when restoring without live-restore set

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

Kenfe-Mickael Laventure authored on 2017/03/10 03:44:14
Showing 1 changed files
... ...
@@ -523,8 +523,18 @@ func (clnt *client) Restore(containerID string, attachStdio StdioCallback, optio
523 523
 	if err := clnt.Signal(containerID, int(syscall.SIGTERM)); err != nil {
524 524
 		logrus.Errorf("libcontainerd: error sending sigterm to %v: %v", containerID, err)
525 525
 	}
526
+
526 527
 	// Let the main loop handle the exit event
527 528
 	clnt.remote.Unlock()
529
+
530
+	if ev != nil && ev.Type == StatePause {
531
+		// resume container, it depends on the main loop, so we do it after Unlock()
532
+		logrus.Debugf("libcontainerd: %s was paused, resuming it so it can die", containerID)
533
+		if err := clnt.Resume(containerID); err != nil {
534
+			return fmt.Errorf("failed to resume container: %v", err)
535
+		}
536
+	}
537
+
528 538
 	select {
529 539
 	case <-time.After(10 * time.Second):
530 540
 		if err := clnt.Signal(containerID, int(syscall.SIGKILL)); err != nil {