From 19a03eddc8418542edab081ef59b64a5d11c41b4 Mon Sep 17 00:00:00 2001 From: Amit Barve Date: Wed, 5 May 2021 12:31:16 -0700 Subject: [PATCH] remove panic logging during delete Reading the panic.log file and logging its contents is now done from containerd so we must remove it from here to avoid logging the same thing twice. Signed-off-by: Amit Barve --- cmd/containerd-shim-runhcs-v1/delete.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/cmd/containerd-shim-runhcs-v1/delete.go b/cmd/containerd-shim-runhcs-v1/delete.go index ec673c4bec..dd65660430 100644 --- a/cmd/containerd-shim-runhcs-v1/delete.go +++ b/cmd/containerd-shim-runhcs-v1/delete.go @@ -6,7 +6,6 @@ import ( "fmt" "io/ioutil" "os" - "path/filepath" "time" "github.com/Microsoft/hcsshim/internal/hcs" @@ -30,6 +29,7 @@ The delete command will be executed in the container's bundle as its cwd. // We cant write anything to stdout for this cmd other than the // task.DeleteResponse by protcol. We can write to stderr which will be // warning logged in containerd. + logrus.SetOutput(ioutil.Discard) ctx, span := trace.StartSpan(gcontext.Background(), "delete") defer span.End() @@ -40,15 +40,6 @@ The delete command will be executed in the container's bundle as its cwd. return errors.New("bundle is required") } - // hcsshim shim writes panic logs in the bundle directory in a file named "panic.log" - // log those messages (if any) on stderr so that it shows up in containerd's log. - // This should be done as the first thing so that we don't miss any panic logs even if - // something goes wrong during delete op. - logs, err := ioutil.ReadFile(filepath.Join(bundleFlag, "panic.log")) - if err == nil && len(logs) > 0 { - logrus.WithField("log", string(logs)).Error("found shim panic logs during delete") - } - // Attempt to find the hcssystem for this bundle and terminate it. if sys, _ := hcs.OpenComputeSystem(ctx, idFlag); sys != nil { defer sys.Close()