1 Star 0 Fork 43

zhongtao/src-iSulad

forked from src-openEuler/iSulad 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0119-skip-calling-cni-plugin-cleanup-when-network-namespa.patch 2.30 KB
一键复制 编辑 原始数据 按行查看 历史
From ee720f966fdf14a99b8ebc685f3948bb8b29ba73 Mon Sep 17 00:00:00 2001
From: zhongtao <[email protected]>
Date: Tue, 13 Aug 2024 10:56:44 +0800
Subject: [PATCH 118/121] skip calling cni plugin cleanup when network
namespace is not mounted
Signed-off-by: zhongtao <[email protected]>
---
.../entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc | 7 +++++++
.../entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
index 2a458a6d..77faf48a 100644
--- a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
+++ b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
@@ -435,6 +435,13 @@ void PodSandboxManagerService::ClearCniNetwork(const std::shared_ptr<sandbox::Sa
return;
}
+ // If the network namespace is not mounted, the network has been cleaned up
+ // and there is no need to call the cni plugin.
+ if (!util_detect_mounted(sandboxKey.c_str())) {
+ WARN("Network namespace %s not exist", sandboxKey.c_str());
+ return;
+ }
+
const auto config = sandbox->GetSandboxConfig();
std::map<std::string, std::string> stdAnnos;
CRIHelpers::ProtobufAnnoMapToStd(config.annotations(), stdAnnos);
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 bc3f4031..5590827e 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
@@ -848,6 +848,13 @@ auto PodSandboxManagerService::ClearCniNetwork(const std::string &realSandboxID,
goto cleanup;
}
+ // If the network namespace is not mounted, the network has been cleaned up
+ // and there is no need to call the cni plugin.
+ if (!util_detect_mounted(netnsPath.c_str())) {
+ WARN("Network namespace %s not exist", netnsPath.c_str());
+ goto cleanup;
+ }
+
stdAnnos.insert(std::pair<std::string, std::string>(CRIHelpers::Constants::POD_SANDBOX_KEY, netnsPath));
pluginErr.Clear();
m_pluginManager->TearDownPod(ns, name, Network::DEFAULT_NETWORK_INTERFACE_NAME, realSandboxID, stdAnnos,
--
2.25.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/taotao-sauce/src-iSulad.git
[email protected]:taotao-sauce/src-iSulad.git
taotao-sauce
src-iSulad
src-iSulad
master

搜索帮助