瀏覽代碼

Fixing error reporting on servicing failure

The code that handles waiting for the servicing container to complete correctly grabs the exit code and logs a failure, but doesn't return that failure to the caller, mistakenly causing servicing operations to look successful when they really failed during processing.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Stefan J. Wernli 8 年之前
父節點
當前提交
f65647463e
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      libcontainerd/container_windows.go

+ 5 - 2
libcontainerd/container_windows.go

@@ -1,6 +1,7 @@
 package libcontainerd
 package libcontainerd
 
 
 import (
 import (
+	"fmt"
 	"io"
 	"io"
 	"strings"
 	"strings"
 	"syscall"
 	"syscall"
@@ -105,8 +106,10 @@ func (ctr *container) start() error {
 		exitCode := ctr.waitProcessExitCode(&ctr.process)
 		exitCode := ctr.waitProcessExitCode(&ctr.process)
 
 
 		if exitCode != 0 {
 		if exitCode != 0 {
-			logrus.Warnf("libcontainerd: servicing container %s returned non-zero exit code %d", ctr.containerID, exitCode)
-			return ctr.terminate()
+			if err := ctr.terminate(); err != nil {
+				logrus.Warnf("libcontainerd: terminating servicing container %s failed: %s", ctr.containerID, err)
+			}
+			return fmt.Errorf("libcontainerd: servicing container %s returned non-zero exit code %d", ctr.containerID, exitCode)
 		}
 		}
 
 
 		return ctr.hcsContainer.WaitTimeout(time.Minute * 5)
 		return ctr.hcsContainer.WaitTimeout(time.Minute * 5)