summaryrefslogtreecommitdiff
path: root/0016-improve-event-logs.patch
diff options
context:
space:
mode:
Diffstat (limited to '0016-improve-event-logs.patch')
-rw-r--r--0016-improve-event-logs.patch202
1 files changed, 202 insertions, 0 deletions
diff --git a/0016-improve-event-logs.patch b/0016-improve-event-logs.patch
new file mode 100644
index 0000000..afc4d5e
--- /dev/null
+++ b/0016-improve-event-logs.patch
@@ -0,0 +1,202 @@
+From d611f18abac0f4077c9bf85f76162719cc5e55eb Mon Sep 17 00:00:00 2001
+From: haozi007 <liuhao27@huawei.com>
+Date: Tue, 14 Nov 2023 15:12:39 +0800
+Subject: [PATCH 16/64] improve event logs
+
+Signed-off-by: haozi007 <liuhao27@huawei.com>
+---
+ .../grpc/cri/v1/cri_v1_runtime_runtime_service.cc | 13 ++++++++-----
+ .../grpc/cri/v1alpha/cri_runtime_runtime_service.cc | 10 +++++++---
+ src/daemon/entry/cri/cni_network_plugin.cc | 6 +++---
+ .../cri/v1alpha/cri_pod_sandbox_manager_service.cc | 3 ++-
+ src/daemon/executor/volume_cb/volume_cb.c | 4 ++--
+ src/daemon/modules/network/native/adaptor_native.c | 8 ++++----
+ 6 files changed, 26 insertions(+), 18 deletions(-)
+
+diff --git a/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_runtime_service.cc b/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_runtime_service.cc
+index b8d5746c..1db79307 100644
+--- a/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_runtime_service.cc
++++ b/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_runtime_service.cc
+@@ -75,7 +75,7 @@ grpc::Status RuntimeV1RuntimeServiceImpl::CreateContainer(grpc::ServerContext *c
+ return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "Invalid input arguments");
+ }
+
+- EVENT("Event: {Object: CRI, Type: Creating Container}");
++ EVENT("Event: {Object: CRI, Type: Creating Container for sandbox: %s}", request->pod_sandbox_id().c_str());
+
+ std::string responseID =
+ m_rService->CreateContainer(request->pod_sandbox_id(), request->config(), request->sandbox_config(), error);
+@@ -316,17 +316,20 @@ grpc::Status RuntimeV1RuntimeServiceImpl::RunPodSandbox(grpc::ServerContext *con
+ ERROR("Invalid input arguments");
+ return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "Invalid input arguments");
+ }
+-
+- EVENT("Event: {Object: CRI, Type: Running Pod}");
++ if (request->has_config() && request->config().has_metadata()) {
++ EVENT("Event: {Object: CRI, Type: Running Pod: %s}", request->config().metadata().name().c_str());
++ } else {
++ EVENT("Event: {Object: CRI, Type: Running Pod}");
++ }
+
+ std::string responseID = m_rService->RunPodSandbox(request->config(), request->runtime_handler(), error);
+ if (!error.Empty() || responseID.empty()) {
+- ERROR("Object: CRI, Type: Failed to run pod:%s", error.GetMessage().c_str());
++ ERROR("Object: CRI, Type: Failed to run pod: %s", error.GetMessage().c_str());
+ return grpc::Status(grpc::StatusCode::UNKNOWN, error.GetMessage());
+ }
+ reply->set_pod_sandbox_id(responseID);
+
+- EVENT("Event: {Object: CRI, Type: Run Pod success}");
++ EVENT("Event: {Object: CRI, Type: Run Pod: %s success}", responseID.c_str());
+
+ return grpc::Status::OK;
+ }
+diff --git a/src/daemon/entry/connect/grpc/cri/v1alpha/cri_runtime_runtime_service.cc b/src/daemon/entry/connect/grpc/cri/v1alpha/cri_runtime_runtime_service.cc
+index ec3f01cd..a56b167c 100644
+--- a/src/daemon/entry/connect/grpc/cri/v1alpha/cri_runtime_runtime_service.cc
++++ b/src/daemon/entry/connect/grpc/cri/v1alpha/cri_runtime_runtime_service.cc
+@@ -73,7 +73,7 @@ grpc::Status RuntimeRuntimeServiceImpl::CreateContainer(grpc::ServerContext *con
+ return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "Invalid input arguments");
+ }
+
+- EVENT("Event: {Object: CRI, Type: Creating Container}");
++ EVENT("Event: {Object: CRI, Type: Creating Container for sandbox: %s}", request->pod_sandbox_id().c_str());
+
+ std::string responseID =
+ m_rService->CreateContainer(request->pod_sandbox_id(), request->config(), request->sandbox_config(), error);
+@@ -315,7 +315,11 @@ grpc::Status RuntimeRuntimeServiceImpl::RunPodSandbox(grpc::ServerContext *conte
+ return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "Invalid input arguments");
+ }
+
+- EVENT("Event: {Object: CRI, Type: Running Pod}");
++ if (request->has_config() && request->config().has_metadata()) {
++ EVENT("Event: {Object: CRI, Type: Running Pod: %s}", request->config().metadata().name().c_str());
++ } else {
++ EVENT("Event: {Object: CRI, Type: Running Pod}");
++ }
+
+ std::string responseID = m_rService->RunPodSandbox(request->config(), request->runtime_handler(), error);
+ if (!error.Empty() || responseID.empty()) {
+@@ -324,7 +328,7 @@ grpc::Status RuntimeRuntimeServiceImpl::RunPodSandbox(grpc::ServerContext *conte
+ }
+ reply->set_pod_sandbox_id(responseID);
+
+- EVENT("Event: {Object: CRI, Type: Run Pod success}");
++ EVENT("Event: {Object: CRI, Type: Run Pod: %s success}", responseID.c_str());
+
+ return grpc::Status::OK;
+ }
+diff --git a/src/daemon/entry/cri/cni_network_plugin.cc b/src/daemon/entry/cri/cni_network_plugin.cc
+index 656fceda..377796ee 100644
+--- a/src/daemon/entry/cri/cni_network_plugin.cc
++++ b/src/daemon/entry/cri/cni_network_plugin.cc
+@@ -612,12 +612,12 @@ void CniNetworkPlugin::SetUpPod(const std::string &ns, const std::string &name,
+ if (g_isulad_errmsg != nullptr) {
+ err.SetError(g_isulad_errmsg);
+ } else {
+- err.Errorf("setup cni for container: %s failed", id.c_str());
++ err.Errorf("setup cni for sandbox: %s failed", id.c_str());
+ }
+ // rollback all network plane
+ // if mutl-networks, one network plane failed, cause to left network can not be delete.
+ if (network_module_detach(config, NETWOKR_API_TYPE_CRI) != 0) {
+- WARN("rollback all network for: %s failed", id.c_str());
++ WARN("rollback all network for sandbox: %s failed", id.c_str());
+ }
+ }
+
+@@ -671,7 +671,7 @@ void CniNetworkPlugin::TearDownPod(const std::string &ns, const std::string &nam
+ }
+
+ if (network_module_detach(config, NETWOKR_API_TYPE_CRI) != 0) {
+- err.Errorf("teardown cni for container: %s failed", id.c_str());
++ err.Errorf("teardown cni for sandbox: %s failed", id.c_str());
+ }
+
+ UnlockNetworkMap(err);
+diff --git a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
+index 8533bb8c..8eff22ac 100644
+--- a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
++++ b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
+@@ -618,6 +618,7 @@ auto PodSandboxManagerService::RunPodSandbox(const runtime::v1alpha2::PodSandbox
+ // Step 2: Create the sandbox container.
+ response_id = CreateSandboxContainer(config, image, jsonCheckpoint, runtimeHandler, error);
+ if (error.NotEmpty()) {
++ ERROR("Create sandbox failed: %s", error.GetCMessage());
+ goto cleanup;
+ }
+
+@@ -672,7 +673,7 @@ auto PodSandboxManagerService::RunPodSandbox(const runtime::v1alpha2::PodSandbox
+ UpdatePodSandboxNetworkSettings(response_id, network_setting_json, tmpErr);
+ // If saving network settings failed, ignore error
+ if (tmpErr.NotEmpty()) {
+- WARN("%s", tmpErr.GetCMessage());
++ WARN("Update sandbox network setting err: %s", tmpErr.GetCMessage());
+ }
+ }
+ goto cleanup;
+diff --git a/src/daemon/executor/volume_cb/volume_cb.c b/src/daemon/executor/volume_cb/volume_cb.c
+index 2148922e..ff5973b8 100644
+--- a/src/daemon/executor/volume_cb/volume_cb.c
++++ b/src/daemon/executor/volume_cb/volume_cb.c
+@@ -52,7 +52,7 @@ static int volume_list_cb(const volume_list_volume_request *request, volume_list
+ goto err_out;
+ }
+
+- EVENT("Volume Event: {Object: list volumes, Type: listing}");
++ INFO("Volume Event: {Object: list volumes, Type: listing}");
+
+ list = volume_list();
+ if (list == NULL) {
+@@ -85,7 +85,7 @@ static int volume_list_cb(const volume_list_volume_request *request, volume_list
+ }
+
+ out:
+- EVENT("Volume Event: {Object: list volumes, Type: listed");
++ INFO("Volume Event: {Object: list volumes, Type: listed");
+
+ err_out:
+ if (*response != NULL) {
+diff --git a/src/daemon/modules/network/native/adaptor_native.c b/src/daemon/modules/network/native/adaptor_native.c
+index 45288d7e..baaecc32 100644
+--- a/src/daemon/modules/network/native/adaptor_native.c
++++ b/src/daemon/modules/network/native/adaptor_native.c
+@@ -1510,7 +1510,7 @@ int native_config_inspect(const char *name, char **network_json)
+ return -1;
+ }
+
+- EVENT("Event: {Object: network, Type: inspecting, Target: %s}", name);
++ INFO("Event: {Object: network, Type: inspecting, Target: %s}", name);
+
+ if (!native_store_lock(SHARED)) {
+ return -1;
+@@ -1538,7 +1538,7 @@ int native_config_inspect(const char *name, char **network_json)
+
+ // TODO: inspect the linked containers ip info
+
+- EVENT("Event: {Object: network, Type: inspected, Target: %s}", name);
++ INFO("Event: {Object: network, Type: inspected, Target: %s}", name);
+ goto out;
+ }
+
+@@ -1635,7 +1635,7 @@ int native_config_list(const struct filters_args *filters, network_network_info
+ return -1;
+ }
+
+- EVENT("Event: {Object: network, Type: listing}");
++ INFO("Event: {Object: network, Type: listing}");
+
+ if (!native_store_lock(SHARED)) {
+ return -1;
+@@ -1693,7 +1693,7 @@ int native_config_list(const struct filters_args *filters, network_network_info
+ *networks_len = nets_len;
+ nets_len = 0;
+
+- EVENT("Event: {Object: network, Type: listed}");
++ INFO("Event: {Object: network, Type: listed}");
+
+ out:
+ map_itor_free(itor);
+--
+2.42.0
+