!44 sync with upstream clibcni

From: @zh_xiaoyu
Reviewed-by: @duguhaotian
Signed-off-by: @duguhaotian
This commit is contained in:
openeuler-ci-bot 2021-05-08 15:20:36 +08:00 committed by Gitee
commit 61ae9f6b80
3 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From 2888c4de723200b85888cc7c2cf8b5c0b9a3c59e Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Thu, 4 Feb 2021 10:49:43 +0800
Subject: [PATCH 1/2] fix CNI_ARGS value when there is no args
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
src/invoke/args.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/invoke/args.c b/src/invoke/args.c
index dae484e..2b357ed 100644
--- a/src/invoke/args.c
+++ b/src/invoke/args.c
@@ -126,7 +126,7 @@ static int add_cni_envs(const struct cni_args *cniargs, size_t *pos, char **resu
}
result[i++] = buffer;
buffer = NULL;
- nret = asprintf(&buffer, "%s=%s", ENV_CNI_ARGS, plugin_args_str);
+ nret = asprintf(&buffer, "%s=%s", ENV_CNI_ARGS, plugin_args_str == NULL ? "" : plugin_args_str);
if (nret < 0) {
ERROR("Sprintf failed");
goto free_out;
--
2.25.1

View File

@ -0,0 +1,27 @@
From 70b8a1516207cb9af774c6742d0973e022f3265b Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Fri, 26 Mar 2021 17:42:02 +0800
Subject: [PATCH 2/2] add error info for failed run cni plugin
Signed-off-by: haozi007 <liuhao27@huawei.com>
---
src/api.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/api.c b/src/api.c
index 97d166d..52d193f 100644
--- a/src/api.c
+++ b/src/api.c
@@ -348,6 +348,9 @@ static int run_cni_plugin(const struct network_config_list *list, size_t i, cons
*pret = NULL;
ret = exec_plugin_with_result(plugin_path, net.bytes, cargs, pret, err);
}
+ if (ret != 0) {
+ ERROR("pod %s CNI op failed with %s", rc->container_id, net.bytes);
+ }
free_out:
free_cni_args(cargs);
free(plugin_path);
--
2.25.1

View File

@ -1,5 +1,5 @@
%global _version 2.0.4
%global _release 20201230.152647.gitf9277cd7
%global _release 20210508.150021.git73679d5d
Name: clibcni
Version: %{_version}
Release: %{_release}
@ -10,6 +10,9 @@ URL: https://gitee.com/openeuler/clibcni
Source0: https://gitee.com/openeuler/clibcni/repository/archive/v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}
Patch0001: 0001-fix-CNI_ARGS-value-when-there-is-no-args.patch
Patch0002: 0002-add-error-info-for-failed-run-cni-plugin.patch
BuildRequires: gcc
BuildRequires: cmake
BuildRequires: lcr-devel yajl-devel
@ -85,6 +88,12 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Sat May 8 2021 zhangxiaoyu <zhangxiaoyu58@huawei.com> - 2.0.4-20210508.150021.git73679d5d
- Type: sync from upstream
- ID: NA
- SUG: NA
- DESC: update from master
* Wed Dec 30 2020 lifeng <lifeng68@huawei.com> - 2.0.4-20201230.152647.gitf9277cd7
- Type: update version to v2.0.4
- ID:NA