iSulad/0047-log-adjust-log-level-from-EVENT-to-WARN-to-reduce-lo.patch
haozi007 e72b756384 iSulad: sync with upstream iSulad
Signed-off-by: haozi007 <liuhao27@huawei.com>
2021-03-23 09:50:40 +08:00

329 lines
14 KiB
Diff

From 9a605646c7e20773c52799ee4abcff20e26071de Mon Sep 17 00:00:00 2001
From: Li Feng <lifeng2221dd1@zoho.com.cn>
Date: Sat, 27 Feb 2021 14:19:24 +0800
Subject: [PATCH 47/53] log: adjust log level from EVENT to WARN to reduce log
number
Signed-off-by: Li Feng <lifeng2221dd1@zoho.com.cn>
---
src/cmd/isulad/main.c | 2 +-
.../connect/grpc/runtime_image_service.cc | 13 ++++-----
.../connect/grpc/runtime_runtime_service.cc | 28 +++++++++----------
src/daemon/executor/container_cb/list.c | 2 +-
src/daemon/modules/image/image.c | 12 ++++----
.../modules/image/oci/oci_common_operators.c | 4 +--
src/utils/cutils/utils_fs.c | 2 +-
7 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/src/cmd/isulad/main.c b/src/cmd/isulad/main.c
index ce93eaa0..cb2b71a2 100644
--- a/src/cmd/isulad/main.c
+++ b/src/cmd/isulad/main.c
@@ -1515,7 +1515,7 @@ int main(int argc, char **argv)
clock_gettime(CLOCK_MONOTONIC, &t_end);
use_time = (double)(t_end.tv_sec - t_start.tv_sec) * (double)1000000000 + (double)(t_end.tv_nsec - t_start.tv_nsec);
use_time /= 1000000000;
- INFO("iSulad successfully booted in %.3f s", use_time);
+ EVENT("iSulad successfully booted in %.3f s", use_time);
#ifdef GRPC_CONNECTOR
INFO("Starting grpc server...");
#else
diff --git a/src/daemon/entry/connect/grpc/runtime_image_service.cc b/src/daemon/entry/connect/grpc/runtime_image_service.cc
index 8e740caf..23447baf 100644
--- a/src/daemon/entry/connect/grpc/runtime_image_service.cc
+++ b/src/daemon/entry/connect/grpc/runtime_image_service.cc
@@ -21,7 +21,6 @@
#include "cri_helpers.h"
#include "cri_image_manager_service_impl.h"
-
RuntimeImageServiceImpl::RuntimeImageServiceImpl()
{
std::unique_ptr<ImageManagerService> service(new ImageManagerServiceImpl);
@@ -55,7 +54,7 @@ grpc::Status RuntimeImageServiceImpl::ListImages(grpc::ServerContext *context,
std::vector<std::unique_ptr<runtime::v1alpha2::Image>> images;
Errors error;
- EVENT("Event: {Object: CRI, Type: Listing all images}");
+ WARN("Event: {Object: CRI, Type: Listing all images}");
rService->ListImages(request->filter(), &images, error);
if (!error.Empty()) {
@@ -71,7 +70,7 @@ grpc::Status RuntimeImageServiceImpl::ListImages(grpc::ServerContext *context,
*image = *(iter->get());
}
- EVENT("Event: {Object: CRI, Type: Listed all images}");
+ WARN("Event: {Object: CRI, Type: Listed all images}");
return grpc::Status::OK;
}
@@ -83,7 +82,7 @@ grpc::Status RuntimeImageServiceImpl::ImageStatus(grpc::ServerContext *context,
std::unique_ptr<runtime::v1alpha2::Image> image_info = nullptr;
Errors error;
- EVENT("Event: {Object: CRI, Type: Statusing image %s}", request->image().image().c_str());
+ WARN("Event: {Object: CRI, Type: Statusing image %s}", request->image().image().c_str());
image_info = rService->ImageStatus(request->image(), error);
if (!error.Empty() && !CRIHelpers::IsImageNotFoundError(error.GetMessage())) {
@@ -97,7 +96,7 @@ grpc::Status RuntimeImageServiceImpl::ImageStatus(grpc::ServerContext *context,
*image = *image_info;
}
- EVENT("Event: {Object: CRI, Type: Statused image %s}", request->image().image().c_str());
+ WARN("Event: {Object: CRI, Type: Statused image %s}", request->image().image().c_str());
return grpc::Status::OK;
}
@@ -109,7 +108,7 @@ grpc::Status RuntimeImageServiceImpl::ImageFsInfo(grpc::ServerContext *context,
std::vector<std::unique_ptr<runtime::v1alpha2::FilesystemUsage>> usages;
Errors error;
- EVENT("Event: {Object: CRI, Type: Statusing image fs info}");
+ WARN("Event: {Object: CRI, Type: Statusing image fs info}");
rService->ImageFsInfo(&usages, error);
if (!error.Empty()) {
@@ -126,7 +125,7 @@ grpc::Status RuntimeImageServiceImpl::ImageFsInfo(grpc::ServerContext *context,
*fs_info = *(iter->get());
}
- EVENT("Event: {Object: CRI, Type: Statused image fs info}");
+ WARN("Event: {Object: CRI, Type: Statused image fs info}");
return grpc::Status::OK;
}
diff --git a/src/daemon/entry/connect/grpc/runtime_runtime_service.cc b/src/daemon/entry/connect/grpc/runtime_runtime_service.cc
index c09153eb..c9702401 100644
--- a/src/daemon/entry/connect/grpc/runtime_runtime_service.cc
+++ b/src/daemon/entry/connect/grpc/runtime_runtime_service.cc
@@ -50,8 +50,8 @@ void RuntimeRuntimeServiceImpl::Init(Network::NetworkPluginConf mConf, isulad_da
Network::ProbeNetworkPlugins(mConf.GetPluginConfDir(), mConf.GetPluginBinDir(), &plugins);
std::shared_ptr<Network::NetworkPlugin> chosen { nullptr };
- Network::InitNetworkPlugin(&plugins, mConf.GetPluginName(), mConf.GetHairpinMode(),
- mConf.GetNonMasqueradeCIDR(), mConf.GetMTU(), &chosen, err);
+ Network::InitNetworkPlugin(&plugins, mConf.GetPluginName(), mConf.GetHairpinMode(), mConf.GetNonMasqueradeCIDR(),
+ mConf.GetMTU(), &chosen, err);
if (err.NotEmpty()) {
ERROR("Init network plugin failed: %s", err.GetCMessage());
return;
@@ -181,7 +181,7 @@ grpc::Status RuntimeRuntimeServiceImpl::ListContainers(grpc::ServerContext *cont
{
Errors error;
- EVENT("Event: {Object: CRI, Type: Listing all Container}");
+ WARN("Event: {Object: CRI, Type: Listing all Container}");
std::vector<std::unique_ptr<runtime::v1alpha2::Container>> containers;
rService->ListContainers(request->has_filter() ? &request->filter() : nullptr, &containers, error);
@@ -199,7 +199,7 @@ grpc::Status RuntimeRuntimeServiceImpl::ListContainers(grpc::ServerContext *cont
*container = *(iter->get());
}
- EVENT("Event: {Object: CRI, Type: Listed all Container}");
+ WARN("Event: {Object: CRI, Type: Listed all Container}");
return grpc::Status::OK;
}
@@ -210,7 +210,7 @@ grpc::Status RuntimeRuntimeServiceImpl::ListContainerStats(grpc::ServerContext *
{
Errors error;
- EVENT("Event: {Object: CRI, Type: Listing all Container stats}");
+ WARN("Event: {Object: CRI, Type: Listing all Container stats}");
std::vector<std::unique_ptr<runtime::v1alpha2::ContainerStats>> containers;
rService->ListContainerStats(request->has_filter() ? &request->filter() : nullptr, &containers, error);
@@ -228,7 +228,7 @@ grpc::Status RuntimeRuntimeServiceImpl::ListContainerStats(grpc::ServerContext *
*container = *(iter->get());
}
- EVENT("Event: {Object: CRI, Type: Listed all Container stats}");
+ WARN("Event: {Object: CRI, Type: Listed all Container stats}");
return grpc::Status::OK;
}
@@ -239,7 +239,7 @@ grpc::Status RuntimeRuntimeServiceImpl::ContainerStatus(grpc::ServerContext *con
{
Errors error;
- EVENT("Event: {Object: CRI, Type: Statusing Container: %s}", request->container_id().c_str());
+ WARN("Event: {Object: CRI, Type: Statusing Container: %s}", request->container_id().c_str());
std::unique_ptr<runtime::v1alpha2::ContainerStatus> contStatus =
rService->ContainerStatus(request->container_id(), error);
@@ -249,7 +249,7 @@ grpc::Status RuntimeRuntimeServiceImpl::ContainerStatus(grpc::ServerContext *con
}
*(reply->mutable_status()) = *contStatus;
- EVENT("Event: {Object: CRI, Type: Statused Container: %s}", request->container_id().c_str());
+ WARN("Event: {Object: CRI, Type: Statused Container: %s}", request->container_id().c_str());
return grpc::Status::OK;
}
@@ -339,7 +339,7 @@ grpc::Status RuntimeRuntimeServiceImpl::PodSandboxStatus(grpc::ServerContext *co
{
Errors error;
- EVENT("Event: {Object: CRI, Type: Status Pod: %s}", request->pod_sandbox_id().c_str());
+ WARN("Event: {Object: CRI, Type: Status Pod: %s}", request->pod_sandbox_id().c_str());
std::unique_ptr<runtime::v1alpha2::PodSandboxStatus> podStatus;
podStatus = rService->PodSandboxStatus(request->pod_sandbox_id(), error);
@@ -350,7 +350,7 @@ grpc::Status RuntimeRuntimeServiceImpl::PodSandboxStatus(grpc::ServerContext *co
}
*(reply->mutable_status()) = *podStatus;
- EVENT("Event: {Object: CRI, Type: Statused Pod: %s}", request->pod_sandbox_id().c_str());
+ WARN("Event: {Object: CRI, Type: Statused Pod: %s}", request->pod_sandbox_id().c_str());
return grpc::Status::OK;
}
@@ -361,7 +361,7 @@ grpc::Status RuntimeRuntimeServiceImpl::ListPodSandbox(grpc::ServerContext *cont
{
Errors error;
- EVENT("Event: {Object: CRI, Type: Listing all Pods}");
+ WARN("Event: {Object: CRI, Type: Listing all Pods}");
std::vector<std::unique_ptr<runtime::v1alpha2::PodSandbox>> pods;
rService->ListPodSandbox(request->has_filter() ? &request->filter() : nullptr, &pods, error);
@@ -378,7 +378,7 @@ grpc::Status RuntimeRuntimeServiceImpl::ListPodSandbox(grpc::ServerContext *cont
*pod = *(iter->get());
}
- EVENT("Event: {Object: CRI, Type: Listed all Pods}");
+ WARN("Event: {Object: CRI, Type: Listed all Pods}");
return grpc::Status::OK;
}
@@ -470,7 +470,7 @@ grpc::Status RuntimeRuntimeServiceImpl::Status(grpc::ServerContext *context,
{
Errors error;
- EVENT("Event: {Object: CRI, Type: Statusing daemon}");
+ WARN("Event: {Object: CRI, Type: Statusing daemon}");
std::unique_ptr<runtime::v1alpha2::RuntimeStatus> status = rService->Status(error);
if (status == nullptr || error.NotEmpty()) {
@@ -479,7 +479,7 @@ grpc::Status RuntimeRuntimeServiceImpl::Status(grpc::ServerContext *context,
}
*(reply->mutable_status()) = *status;
- EVENT("Event: {Object: CRI, Type: Statused daemon}");
+ WARN("Event: {Object: CRI, Type: Statused daemon}");
return grpc::Status::OK;
}
diff --git a/src/daemon/executor/container_cb/list.c b/src/daemon/executor/container_cb/list.c
index 34c1b956..d8f26328 100644
--- a/src/daemon/executor/container_cb/list.c
+++ b/src/daemon/executor/container_cb/list.c
@@ -503,7 +503,7 @@ static container_container *get_container_info(const char *name, const struct li
cont = containers_store_get(name);
if (cont == NULL) {
- ERROR("Container '%s' already removed", name);
+ ERROR("Container '%s' not exist", name);
return NULL;
}
cont_state = container_dup_state(cont->state);
diff --git a/src/daemon/modules/image/image.c b/src/daemon/modules/image/image.c
index 4563efea..8e663863 100644
--- a/src/daemon/modules/image/image.c
+++ b/src/daemon/modules/image/image.c
@@ -392,7 +392,7 @@ int im_get_filesystem_info(const char *image_type, im_fs_info_response **respons
goto out;
}
- EVENT("Event: {Object: get image filesystem info, Type: inspecting}");
+ WARN("Event: {Object: get image filesystem info, Type: inspecting}");
ret = q->ops->get_filesystem_info(response);
if (ret != 0) {
if (response != NULL && *response != NULL) {
@@ -402,7 +402,7 @@ int im_get_filesystem_info(const char *image_type, im_fs_info_response **respons
}
goto out;
}
- EVENT("Event: {Object: get image filesystem info, Type: inspected}");
+ WARN("Event: {Object: get image filesystem info, Type: inspected}");
out:
return ret;
@@ -442,7 +442,7 @@ int im_get_container_filesystem_usage(const char *image_type, const char *id, im
request->name_id = util_strdup_s(id);
}
- EVENT("Event: {Object: container \'%s\' filesystem info, Type: inspecting}", id != NULL ? id : "");
+ WARN("Event: {Object: container \'%s\' filesystem info, Type: inspecting}", id != NULL ? id : "");
ret = q->ops->container_fs_usage(request, &filesystemusage);
if (ret != 0) {
ERROR("Failed to get filesystem usage for container %s", id);
@@ -452,7 +452,7 @@ int im_get_container_filesystem_usage(const char *image_type, const char *id, im
*fs_usage = filesystemusage;
filesystemusage = NULL;
- EVENT("Event: {Object: container \'%s\' filesystem info, Type: inspected}", id != NULL ? id : "");
+ WARN("Event: {Object: container \'%s\' filesystem info, Type: inspected}", id != NULL ? id : "");
out:
free_im_container_fs_usage_request(request);
@@ -1597,7 +1597,7 @@ int im_inspect_image(const im_inspect_request *request, im_inspect_response **re
image_ref = util_strdup_s(request->image.image);
- EVENT("Event: {Object: %s, Type: image inspecting}", image_ref);
+ WARN("Event: {Object: %s, Type: image inspecting}", image_ref);
bim_type = bim_query(image_ref);
if (bim_type == NULL) {
@@ -1619,7 +1619,7 @@ int im_inspect_image(const im_inspect_request *request, im_inspect_response **re
goto pack_response;
}
- EVENT("Event: {Object: %s, Type: image inspected}", image_ref);
+ WARN("Event: {Object: %s, Type: image inspected}", image_ref);
pack_response:
if (g_isulad_errmsg != NULL) {
diff --git a/src/daemon/modules/image/oci/oci_common_operators.c b/src/daemon/modules/image/oci/oci_common_operators.c
index aecb63d0..845e1fde 100644
--- a/src/daemon/modules/image/oci/oci_common_operators.c
+++ b/src/daemon/modules/image/oci/oci_common_operators.c
@@ -431,7 +431,7 @@ int oci_summary_image(im_summary_request *request, im_summary_response *response
goto pack_response;
}
- EVENT("Event: {Object: %s, Type: statusing image summary}", resolved_name);
+ WARN("Event: {Object: %s, Type: statusing image summary}", resolved_name);
image_summary = storage_img_get_summary(resolved_name);
if (image_summary == NULL) {
@@ -444,7 +444,7 @@ int oci_summary_image(im_summary_request *request, im_summary_response *response
response->image_summary = image_summary;
image_summary = NULL;
- EVENT("Event: {Object: %s, Type: statused image summary}", resolved_name);
+ WARN("Event: {Object: %s, Type: statused image summary}", resolved_name);
pack_response:
free(resolved_name);
diff --git a/src/utils/cutils/utils_fs.c b/src/utils/cutils/utils_fs.c
index 788557f9..bbbf2d2d 100644
--- a/src/utils/cutils/utils_fs.c
+++ b/src/utils/cutils/utils_fs.c
@@ -515,7 +515,7 @@ int util_mount(const char *src, const char *dst, const char *mtype, const char *
if ((mntflags & MS_REMOUNT) != MS_REMOUNT) {
if (util_detect_mounted(dst)) {
- ERROR("mount dst %s had been mounted, skip mount", dst);
+ WARN("mount dst %s had been mounted, skip mount", dst);
ret = 0;
goto out;
}
--
2.25.1