bugfix for nri
Signed-off-by: zhongtao <zhongtao17@huawei.com> (cherry picked from commit 2b0d5a6513507eeece64da43cde77e9e92e21b51)
This commit is contained in:
parent
dd4ef73cde
commit
25daf1f442
80
0157-bugfix-for-nri-init.patch
Normal file
80
0157-bugfix-for-nri-init.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From 08b996a54c6330e704cbc9271f348a62e24fe880 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Wed, 18 Dec 2024 22:43:26 +1400
|
||||
Subject: [PATCH 157/158] bugfix for nri init
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
src/daemon/common/nri/nri_convert.cc | 7 ++++---
|
||||
src/daemon/nri/nri_plugin_ops.cc | 28 +++++++++++++---------------
|
||||
2 files changed, 17 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/common/nri/nri_convert.cc b/src/daemon/common/nri/nri_convert.cc
|
||||
index d862d992..6e571d9a 100644
|
||||
--- a/src/daemon/common/nri/nri_convert.cc
|
||||
+++ b/src/daemon/common/nri/nri_convert.cc
|
||||
@@ -196,7 +196,6 @@ auto PodSandboxToNRI(const std::shared_ptr<const sandbox::Sandbox> &sandbox, nri
|
||||
pod._namespace = util_strdup_s(sandbox->GetSandboxConfig().metadata().namespace_().c_str());
|
||||
}
|
||||
|
||||
-
|
||||
pod.labels = Transform::ProtobufMapToJsonMapForString(sandbox->GetSandboxConfig().labels(), tmpError);
|
||||
if (pod.labels == nullptr) {
|
||||
ERROR("Failed to transform labels to nri for pod : %s, : %s", pod.name, tmpError.GetMessage().c_str());
|
||||
@@ -971,9 +970,11 @@ auto ContainerToNRIByID(const std::string &id, nri_container &con) -> bool
|
||||
goto out;
|
||||
}
|
||||
|
||||
- con.pod_sandbox_id = util_strdup_s(cont->common_config->sandbox_info->id);
|
||||
- ret = true;
|
||||
+ if (cont->common_config->sandbox_info!= nullptr && cont->common_config->sandbox_info->id != nullptr) {
|
||||
+ con.pod_sandbox_id = util_strdup_s(cont->common_config->sandbox_info->id);
|
||||
+ }
|
||||
|
||||
+ ret = true;
|
||||
out:
|
||||
container_unref(cont);
|
||||
return ret;
|
||||
diff --git a/src/daemon/nri/nri_plugin_ops.cc b/src/daemon/nri/nri_plugin_ops.cc
|
||||
index e2f88b63..7953f7de 100644
|
||||
--- a/src/daemon/nri/nri_plugin_ops.cc
|
||||
+++ b/src/daemon/nri/nri_plugin_ops.cc
|
||||
@@ -42,22 +42,20 @@ bool nri_adaption_init(void)
|
||||
{
|
||||
Errors error;
|
||||
|
||||
- if (!conf_get_nri_support()) {
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- nri_runtime_callbacks callbacks;
|
||||
- callbacks.register_plugin = nri_registry_containers;
|
||||
- callbacks.update_containers = nri_update_containers;
|
||||
- if (nri_runtime_service_init(callbacks) != 0) {
|
||||
- ERROR("Failed to init runtime service\n");
|
||||
- return false;
|
||||
- }
|
||||
+ if (conf_get_nri_support()) {
|
||||
+ nri_runtime_callbacks callbacks;
|
||||
+ callbacks.register_plugin = nri_registry_containers;
|
||||
+ callbacks.update_containers = nri_update_containers;
|
||||
+ if (nri_runtime_service_init(callbacks) != 0) {
|
||||
+ ERROR("Failed to init runtime service\n");
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
- if (conf_get_nri_external_support()) {
|
||||
- if (!start_external_listener()) {
|
||||
- ERROR("Failed to start external listener\n");
|
||||
- goto clean_out;
|
||||
+ if (conf_get_nri_external_support()) {
|
||||
+ if (!start_external_listener()) {
|
||||
+ ERROR("Failed to start external listener\n");
|
||||
+ goto clean_out;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
87
0158-Revert-move-nri-call-in-stop-and-remove-con.patch
Normal file
87
0158-Revert-move-nri-call-in-stop-and-remove-con.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From e160e82c1a7eff3c9cca9794a4db04508e9ffb05 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Wed, 18 Dec 2024 22:54:32 +1400
|
||||
Subject: [PATCH 158/158] Revert "move nri call in stop and remove con"
|
||||
|
||||
This reverts commit db60c64138b45539fe70282c853ac2dae5954924.
|
||||
---
|
||||
src/daemon/common/cri/cri_helpers.cc | 18 ------------------
|
||||
.../cri/v1/v1_cri_container_manager_service.cc | 14 ++++++++++++++
|
||||
2 files changed, 14 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/common/cri/cri_helpers.cc b/src/daemon/common/cri/cri_helpers.cc
|
||||
index aa8e3c19..a8cbd996 100644
|
||||
--- a/src/daemon/common/cri/cri_helpers.cc
|
||||
+++ b/src/daemon/common/cri/cri_helpers.cc
|
||||
@@ -32,10 +32,6 @@
|
||||
#include "isulad_config.h"
|
||||
#include "sha256.h"
|
||||
|
||||
-#ifdef ENABLE_NRI
|
||||
-#include "nri_adaption.h"
|
||||
-#endif
|
||||
-
|
||||
namespace CRIHelpers {
|
||||
const std::string Constants::POD_NETWORK_ANNOTATION_KEY { "network.alpha.kubernetes.io/network" };
|
||||
const std::string Constants::CONTAINER_TYPE_LABEL_KEY { "cri.isulad.type" };
|
||||
@@ -664,13 +660,6 @@ void RemoveContainerHelper(service_executor_t *cb, const std::string &containerI
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
-#ifdef ENABLE_NRI
|
||||
- if (!NRIAdaptation::GetInstance()->RemoveContainer(containerID, error)) {
|
||||
- ERROR("NRI RemoveContainer notification failed: %s", error.GetCMessage());
|
||||
- }
|
||||
- error.Clear();
|
||||
-#endif
|
||||
-
|
||||
if (cb->container.remove(request, &response) != 0) {
|
||||
if (response != nullptr && response->errmsg != nullptr) {
|
||||
error.SetError(response->errmsg);
|
||||
@@ -730,13 +719,6 @@ void StopContainerHelper(service_executor_t *cb, const std::string &containerID,
|
||||
error.SetError(msg);
|
||||
}
|
||||
|
||||
-#ifdef ENABLE_NRI
|
||||
- if (!NRIAdaptation::GetInstance()->StopContainer(containerID, error)) {
|
||||
- ERROR("NRI StopContainer notification failed: %s", error.GetCMessage());
|
||||
- }
|
||||
- error.Clear();
|
||||
-#endif
|
||||
-
|
||||
free_container_stop_request(request);
|
||||
free_container_stop_response(response);
|
||||
}
|
||||
diff --git a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||||
index b585b49c..1e84d14c 100644
|
||||
--- a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||||
+++ b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||||
@@ -618,11 +618,25 @@ cleanup:
|
||||
|
||||
void ContainerManagerService::StopContainer(const std::string &containerID, int64_t timeout, Errors &error)
|
||||
{
|
||||
+#ifdef ENABLE_NRI
|
||||
+ Errors nriErr;
|
||||
+#endif
|
||||
CRIHelpers::StopContainer(m_cb, containerID, timeout, error);
|
||||
+#ifdef ENABLE_NRI
|
||||
+ if (!NRIAdaptation::GetInstance()->StopContainer(containerID, nriErr)) {
|
||||
+ ERROR("NRI StopContainer notification failed: %s", nriErr.GetCMessage());
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
|
||||
void ContainerManagerService::RemoveContainer(const std::string &containerID, Errors &error)
|
||||
{
|
||||
+#ifdef ENABLE_NRI
|
||||
+ Errors nriErr;
|
||||
+ if (!NRIAdaptation::GetInstance()->RemoveContainer(containerID, nriErr)) {
|
||||
+ ERROR("NRI RemoveContainer notification failed: %s", nriErr.GetCMessage());
|
||||
+ }
|
||||
+#endif
|
||||
CRIHelpers::RemoveContainer(m_cb, containerID, error);
|
||||
if (error.NotEmpty()) {
|
||||
WARN("Failed to remove container %s", containerID.c_str());
|
||||
--
|
||||
2.25.1
|
||||
|
||||
10
iSulad.spec
10
iSulad.spec
@ -1,5 +1,5 @@
|
||||
%global _version 2.1.5
|
||||
%global _release 15
|
||||
%global _release 16
|
||||
%global is_systemd 1
|
||||
%global enable_criv1 1
|
||||
%global enable_cdi 1
|
||||
@ -177,6 +177,8 @@ Patch0153: 0153-sandbox-sandbox-api-adapt-rust-interface.patch
|
||||
Patch0154: 0154-add-linux-capability.h-head-file.patch
|
||||
Patch0155: 0155-sandbox-fix-unused-variables.patch
|
||||
Patch0156: 0156-sandbox-sandbox-api-adapt-rust-interface-UT.patch
|
||||
Patch0157: 0157-bugfix-for-nri-init.patch
|
||||
Patch0158: 0158-Revert-move-nri-call-in-stop-and-remove-con.patch
|
||||
|
||||
%ifarch x86_64 aarch64
|
||||
Provides: libhttpclient.so()(64bit)
|
||||
@ -444,6 +446,12 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Dec 18 2024 zhongtao <zhongtao17@huawei.com> - 2.1.5-16
|
||||
- Type: bugfix
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
- DESC: bugfix for nri
|
||||
|
||||
* Thu Nov 28 2024 liuxu <liuxu156@huawei.com> - 2.1.5-15
|
||||
- Type: update
|
||||
- ID: NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user