From f92633a4076c9e68006fdd0d29a946785069cbaf Mon Sep 17 00:00:00 2001 From: gaohuatao Date: Wed, 11 Nov 2020 02:48:42 -0500 Subject: [PATCH] iSulad:fix list containers filter bug Signed-off-by: gaohuatao --- ...r-to-get-only-non-sandbox-containers.patch | 43 +++++++++++++++++++ iSulad.spec | 9 +++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0013-add-filter-to-get-only-non-sandbox-containers.patch diff --git a/0013-add-filter-to-get-only-non-sandbox-containers.patch b/0013-add-filter-to-get-only-non-sandbox-containers.patch new file mode 100644 index 0000000..e92c0f8 --- /dev/null +++ b/0013-add-filter-to-get-only-non-sandbox-containers.patch @@ -0,0 +1,43 @@ +From 1a01070d00c9bf9ff65308522486edcfe16ed46c Mon Sep 17 00:00:00 2001 +From: gaohuatao +Date: Wed, 11 Nov 2020 11:10:36 +0800 +Subject: [PATCH] add filter to get only non-sandbox containers + +Signed-off-by: gaohuatao +--- + 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 + diff --git a/iSulad.spec b/iSulad.spec index 5d8257e..7a11f39 100644 --- a/iSulad.spec +++ b/iSulad.spec @@ -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 - 2.0.5-20201111.024530.git760a1366 ++- Type:bugfix ++- ID:NA ++- SUG:NA ++- DESC: fix list containers filter bug + +* Fri Sep 23 2020 - 2.0.5-20200923.100941.git261ebe8f +- Type:bugfix +- ID:NA