Explorar o código

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 %!s(int64=8) %!d(string=hai) anos
pai
achega
f65647463e
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      libcontainerd/container_windows.go

+ 5 - 2
libcontainerd/container_windows.go

@@ -1,6 +1,7 @@
 package libcontainerd
 
 import (
+	"fmt"
 	"io"
 	"strings"
 	"syscall"
@@ -105,8 +106,10 @@ func (ctr *container) start() error {
 		exitCode := ctr.waitProcessExitCode(&ctr.process)
 
 		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)