!64 iSulad:fix list containers filter bug

From: @gaohuatao
Reviewed-by: @lifeng2221dd1
Signed-off-by: @lifeng2221dd1
This commit is contained in:
openeuler-ci-bot 2020-11-11 15:01:29 +08:00 committed by Gitee
commit 68c8fe3fa8
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From 1a01070d00c9bf9ff65308522486edcfe16ed46c Mon Sep 17 00:00:00 2001
From: gaohuatao <gaohuatao@huawei.com>
Date: Wed, 11 Nov 2020 11:10:36 +0800
Subject: [PATCH] add filter to get only non-sandbox containers
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
---
src/daemon/entry/cri/cri_container.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/daemon/entry/cri/cri_container.cc b/src/daemon/entry/cri/cri_container.cc
index c6d95998..e23e59ef 100644
--- a/src/daemon/entry/cri/cri_container.cc
+++ b/src/daemon/entry/cri/cri_container.cc
@@ -788,6 +788,12 @@ void CRIRuntimeServiceImpl::ListContainersFromGRPC(const runtime::v1alpha2::Cont
error.SetError("Out of memory");
return;
}
+ // Add filter to get only non-sandbox containers
+ if (CRIHelpers::FiltersAddLabel((*request)->filters, CRIHelpers::Constants::CONTAINER_TYPE_LABEL_KEY,
+ CRIHelpers::Constants::CONTAINER_TYPE_LABEL_CONTAINER) != 0) {
+ error.SetError("Failed to add filter");
+ return;
+ }
if (filter != nullptr) {
if (!filter->id().empty()) {
@@ -811,12 +817,6 @@ void CRIRuntimeServiceImpl::ListContainersFromGRPC(const runtime::v1alpha2::Cont
}
}
- // Add some label
- if (CRIHelpers::FiltersAddLabel((*request)->filters, CRIHelpers::Constants::CONTAINER_TYPE_LABEL_KEY,
- CRIHelpers::Constants::CONTAINER_TYPE_LABEL_CONTAINER) != 0) {
- error.SetError("Failed to add filter");
- return;
- }
for (auto &iter : filter->label_selector()) {
if (CRIHelpers::FiltersAddLabel((*request)->filters, iter.first, iter.second) != 0) {
error.SetError("Failed to add filter");
--
2.26.2

View File

@ -1,5 +1,5 @@
%global _version 2.0.5
%global _release 20200923.100941.git261ebe8f
%global _release 20201111.024530.git760a1366
%global is_systemd 1
Name: iSulad
@ -25,6 +25,7 @@ Patch6009: 0009-fix-coredump-when-pull-image-with-lock-driver-image-.patch
Patch6010: 0010-fix-bad-formatting-placeholder-in-http-parse-module.patch
Patch6011: 0011-iSulad-fix-memory-leak.patch
Patch6012: 0012-fix-coredump-when-load-image-with-uid.patch
Patch6013: 0013-add-filter-to-get-only-non-sandbox-containers.patch
%ifarch x86_64 aarch64
Provides: libhttpclient.so()(64bit)
@ -229,6 +230,12 @@ fi
%endif
%changelog
+* Wed Nov 11 2020 <gaohuatao@huawei.com> - 2.0.5-20201111.024530.git760a1366
+- Type:bugfix
+- ID:NA
+- SUG:NA
+- DESC: fix list containers filter bug
+* Fri Sep 23 2020 <wujing50@huawei.com> - 2.0.5-20200923.100941.git261ebe8f
+- Type:bugfix
+- ID:NA