kata-containers/runtime/patches/0081-kata-runtime-cut-too-long-message-in-grpc-log.patch
Vanient 5280b56d80 kata:sync bugfix patches, runtime 0079-0096 agent 0021-0024
runtime:
0079-kata-runtime-fix-qemu-SCSIBus-info-not-saved-into-pe.patch
0080-kata-runtime-fix-the-block-device-not-removed-in-dev.patch
0081-kata-runtime-cut-too-long-message-in-grpc-log.patch
0082-kata-runtime-change-sandbox-state-to-unhealthy-when-.patch
0083-kata-runtime-add-removeMountBlockDevices-for-contain.patch
0084-kata-runtime-fix-validInterface-func-cause-crash-pro.patch
0085-kata-runtime-fix-kata-netmon-does-not-exit-when-cont.patch
0086-kata-runtime-add-checkCPUSet-before-create-container.patch
0087-kata-runtime-force-delete-the-sandbox-and-container.patch
0088-kata-runtime-check-sandbox-healthy-state-before-call.patch
0089-kata-add-support-for-update-iface.patch
0090-kata-set-sandbox-or-container-status-to-unhealthy.patch
0091-kata-runtime-add-sandbox-file-lock-while-call-GetSan.patch
0092-qemu-add-arm64-to-support-list-of-dimm.patch
0093-kata-runtime-add-timeout-for-grpcWaitProcessRequest.patch
0094-kata-runtime-fix-update-iface-clean-NIC-cause-route-.patch
0095-kata-runtime-fix-qemu-process-resource-resi.patch
0096-kata-containers-Move-from-query-cpus-to-query-cpus-f.patch

agent:
0021-kata-agent-fix-sync-clock-not-work-problem.patch
0022-kata-agent-delete-container-id-from-sandbox-struct.patch
0023-kata-agent-modify-log-level.patch
0024-kata-agent-fix-agent.debug_console-not-work-when-bui.patch

Signed-off-by: Vanient <xiadanni1@huawei.com>
(cherry picked from commit f2d936028666741658157472b8de9d02187c6d55)
2022-09-13 10:29:41 +08:00

52 lines
1.7 KiB
Diff

From a5c0594b1874d1693c97475136a1850a9cf6ee73 Mon Sep 17 00:00:00 2001
From: jiangpengfei <jiangpengfei9@huawei.com>
Date: Wed, 18 Nov 2020 19:51:40 -0500
Subject: [PATCH] kata-runtime: cut too long message in grpc log
reason: cut too long message in grpc log to avoid logrus prints
"too long message" error
Conflict: NA
Reference:https://gitee.com/src-openeuler/kata-containers
Change-Id: I221e78ef142c80e6b3241d10ece235fcd36a6104
Signed-off-by: jiangpengfei <jiangpengfei9@huawei.com>
---
virtcontainers/kata_agent.go | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/virtcontainers/kata_agent.go b/virtcontainers/kata_agent.go
index 66f6ef6..75985e2 100644
--- a/virtcontainers/kata_agent.go
+++ b/virtcontainers/kata_agent.go
@@ -91,6 +91,7 @@ var (
localDirOptions = []string{"mode=0777"}
maxHostnameLen = 64
GuestDNSFile = "/etc/resolv.conf"
+ maxLogLength = 1024
)
const (
@@ -2200,12 +2201,17 @@ func (k *kataAgent) sendReq(request interface{}) (interface{}, error) {
if msgName == "" || handler == nil {
return nil, errors.New("Invalid request type")
}
- message := request.(proto.Message)
+ message := request.(proto.Message).String()
+ // if message is too long, we just print top 1024 char in log
+ if len(message) > maxLogLength {
+ message = message[:maxLogLength]
+ }
+
ctx, cancel := k.getReqContext(msgName)
if cancel != nil {
defer cancel()
}
- k.Logger().WithField("name", msgName).WithField("req", message.String()).Debug("sending request")
+ k.Logger().WithField("name", msgName).WithField("req", message).Debug("sending request")
return handler(ctx, request)
}
--
1.8.3.1