From 89ea4b291245c25f473c69f009852985b22a60f3 Mon Sep 17 00:00:00 2001 From: songbuhuang <544824346@qq.com> Date: Wed, 3 Aug 2022 16:47:26 +0800 Subject: [PATCH] sync patches from openeuler stable Signed-off-by: songbuhuang <544824346@qq.com> --- 0001-do-not-use-tmpfile.patch | 2 +- 0002-use-only-TLS-v1.2-or-later.patch | 2 +- ...eable-dirs-if-user-set-mount-for-dev.patch | 2 +- ...te-arch-unspecified-seccomp-profiles.patch | 2 +- ...CI-test-case-checking-seccomp-option.patch | 2 +- ...ach-when-stdout-and-stderr-are-false.patch | 2 +- ...-quota-out-of-range-when-update-to-1.patch | 49 ++++++ ...ck-monitor-before-stopping-container.patch | 146 ++++++++++++++++++ iSulad.spec | 10 +- 9 files changed, 210 insertions(+), 7 deletions(-) create mode 100644 0007-fix-cpu-quota-out-of-range-when-update-to-1.patch create mode 100644 0008-stop-health-check-monitor-before-stopping-container.patch diff --git a/0001-do-not-use-tmpfile.patch b/0001-do-not-use-tmpfile.patch index 4a35bc9..f66fc7c 100644 --- a/0001-do-not-use-tmpfile.patch +++ b/0001-do-not-use-tmpfile.patch @@ -1,7 +1,7 @@ From 2e404b3aa5fcea87a905fbd7ff3465b6135b701e Mon Sep 17 00:00:00 2001 From: WangFengTu Date: Wed, 20 Jul 2022 14:26:58 +0800 -Subject: [PATCH 1/6] do not use tmpfile() +Subject: [PATCH 1/8] do not use tmpfile() Signed-off-by: WangFengTu --- diff --git a/0002-use-only-TLS-v1.2-or-later.patch b/0002-use-only-TLS-v1.2-or-later.patch index 85eb719..ab1ec56 100644 --- a/0002-use-only-TLS-v1.2-or-later.patch +++ b/0002-use-only-TLS-v1.2-or-later.patch @@ -1,7 +1,7 @@ From 025d2c2dad2786eda40f2367cdd727a36b8249df Mon Sep 17 00:00:00 2001 From: WangFengTu Date: Thu, 21 Jul 2022 15:37:07 +0800 -Subject: [PATCH 2/6] use only TLS v1.2 or later +Subject: [PATCH 2/8] use only TLS v1.2 or later Signed-off-by: WangFengTu --- diff --git a/0003-don-t-mount-shareable-dirs-if-user-set-mount-for-dev.patch b/0003-don-t-mount-shareable-dirs-if-user-set-mount-for-dev.patch index 9452843..b2c814a 100644 --- a/0003-don-t-mount-shareable-dirs-if-user-set-mount-for-dev.patch +++ b/0003-don-t-mount-shareable-dirs-if-user-set-mount-for-dev.patch @@ -1,7 +1,7 @@ From a475d8da1122af712dbc79dc5d92f1cb95d519f9 Mon Sep 17 00:00:00 2001 From: zhangxiaoyu Date: Mon, 25 Jul 2022 20:31:15 +0800 -Subject: [PATCH 3/6] don't mount shareable dirs if user set mount for dev shm +Subject: [PATCH 3/8] don't mount shareable dirs if user set mount for dev shm Signed-off-by: zhangxiaoyu --- diff --git a/0004-tolerate-arch-unspecified-seccomp-profiles.patch b/0004-tolerate-arch-unspecified-seccomp-profiles.patch index 27dfced..9e10b24 100644 --- a/0004-tolerate-arch-unspecified-seccomp-profiles.patch +++ b/0004-tolerate-arch-unspecified-seccomp-profiles.patch @@ -1,7 +1,7 @@ From 73e02e66102b3e066d5d6424624461c3024cabe4 Mon Sep 17 00:00:00 2001 From: chengzrz Date: Fri, 29 Jul 2022 14:44:55 +0800 -Subject: [PATCH 4/6] tolerate arch unspecified seccomp profiles +Subject: [PATCH 4/8] tolerate arch unspecified seccomp profiles Signed-off-by: chengzrz --- diff --git a/0005-add-a-CI-test-case-checking-seccomp-option.patch b/0005-add-a-CI-test-case-checking-seccomp-option.patch index 82f3d65..3e5f370 100644 --- a/0005-add-a-CI-test-case-checking-seccomp-option.patch +++ b/0005-add-a-CI-test-case-checking-seccomp-option.patch @@ -1,7 +1,7 @@ From c9c2bb6bfbe2060bdc6af53ca0d752572b21594d Mon Sep 17 00:00:00 2001 From: chengzrz Date: Fri, 29 Jul 2022 14:45:20 +0800 -Subject: [PATCH 5/6] add a CI test case, checking seccomp option +Subject: [PATCH 5/8] add a CI test case, checking seccomp option Signed-off-by: chengzrz --- diff --git a/0006-fix-cri-attach-when-stdout-and-stderr-are-false.patch b/0006-fix-cri-attach-when-stdout-and-stderr-are-false.patch index e5447be..74ec17e 100644 --- a/0006-fix-cri-attach-when-stdout-and-stderr-are-false.patch +++ b/0006-fix-cri-attach-when-stdout-and-stderr-are-false.patch @@ -1,7 +1,7 @@ From 9498a8df59f69acbf75f9aa69fef465350288bb8 Mon Sep 17 00:00:00 2001 From: zhangxiaoyu Date: Mon, 1 Aug 2022 11:20:31 +0800 -Subject: [PATCH 6/6] fix cri attach when stdout and stderr are false +Subject: [PATCH 6/8] fix cri attach when stdout and stderr are false Signed-off-by: zhangxiaoyu --- diff --git a/0007-fix-cpu-quota-out-of-range-when-update-to-1.patch b/0007-fix-cpu-quota-out-of-range-when-update-to-1.patch new file mode 100644 index 0000000..846dd84 --- /dev/null +++ b/0007-fix-cpu-quota-out-of-range-when-update-to-1.patch @@ -0,0 +1,49 @@ +From 5174fd2608a25a8f7f4b61be79d125b19fb420f9 Mon Sep 17 00:00:00 2001 +From: "Neil.wrz" +Date: Tue, 26 Jul 2022 02:08:43 -0700 +Subject: [PATCH 7/8] fix cpu-quota out of range when update to -1 + +Signed-off-by: Neil.wrz +--- + src/daemon/modules/runtime/engines/engine.h | 2 +- + src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/daemon/modules/runtime/engines/engine.h b/src/daemon/modules/runtime/engines/engine.h +index 8935f845..95428e0f 100644 +--- a/src/daemon/modules/runtime/engines/engine.h ++++ b/src/daemon/modules/runtime/engines/engine.h +@@ -33,7 +33,7 @@ struct engine_cgroup_resources { + uint64_t blkio_weight; + uint64_t cpu_shares; + uint64_t cpu_period; +- uint64_t cpu_quota; ++ int64_t cpu_quota; + char *cpuset_cpus; + char *cpuset_mems; + uint64_t memory_limit; +diff --git a/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c b/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c +index dd310091..a2b93b72 100644 +--- a/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c ++++ b/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c +@@ -518,7 +518,7 @@ static void to_engine_resources(const host_config *hostconfig, struct engine_cgr + cr->blkio_weight = hostconfig->blkio_weight; + cr->cpu_shares = (uint64_t)hostconfig->cpu_shares; + cr->cpu_period = (uint64_t)hostconfig->cpu_period; +- cr->cpu_quota = (uint64_t)hostconfig->cpu_quota; ++ cr->cpu_quota = hostconfig->cpu_quota; + cr->cpuset_cpus = hostconfig->cpuset_cpus; + cr->cpuset_mems = hostconfig->cpuset_mems; + cr->memory_limit = (uint64_t)hostconfig->memory; +@@ -532,7 +532,7 @@ static void to_engine_resources(const host_config *hostconfig, struct engine_cgr + period = (uint64_t)(100 * Time_Milli / Time_Micro); + quota = hostconfig->nano_cpus * (int64_t)period / 1e9; + cr->cpu_period = period; +- cr->cpu_quota = (uint64_t)quota; ++ cr->cpu_quota = quota; + } + } + +-- +2.25.1 + diff --git a/0008-stop-health-check-monitor-before-stopping-container.patch b/0008-stop-health-check-monitor-before-stopping-container.patch new file mode 100644 index 0000000..6d267b1 --- /dev/null +++ b/0008-stop-health-check-monitor-before-stopping-container.patch @@ -0,0 +1,146 @@ +From b8fd21e636b643fe9f257a77808d53b067f3d105 Mon Sep 17 00:00:00 2001 +From: songbuhuang <544824346@qq.com> +Date: Wed, 3 Aug 2022 16:06:16 +0800 +Subject: [PATCH 8/8] stop health check monitor before stopping container + +Signed-off-by: songbuhuang <544824346@qq.com> +--- + src/daemon/executor/container_cb/execution.c | 2 -- + src/daemon/executor/container_cb/execution_extend.c | 2 +- + src/daemon/modules/api/container_api.h | 2 +- + .../modules/container/health_check/health_check.c | 12 ++---------- + src/daemon/modules/service/service_container.c | 3 +++ + test/mocks/health_check_mock.cc | 4 ++-- + test/mocks/health_check_mock.h | 2 +- + .../execute/execution_extend/execution_extend_ut.cc | 2 +- + 8 files changed, 11 insertions(+), 18 deletions(-) + +diff --git a/src/daemon/executor/container_cb/execution.c b/src/daemon/executor/container_cb/execution.c +index edc8b42e..68d0d8d6 100644 +--- a/src/daemon/executor/container_cb/execution.c ++++ b/src/daemon/executor/container_cb/execution.c +@@ -676,8 +676,6 @@ static int container_stop_cb(const container_stop_request *request, container_st + goto pack_response; + } + +- container_stop_health_checks(id); +- + if (stop_container(cont, timeout, force, false)) { + cc = ISULAD_ERR_EXEC; + container_state_set_error(cont->state, (const char *)g_isulad_errmsg); +diff --git a/src/daemon/executor/container_cb/execution_extend.c b/src/daemon/executor/container_cb/execution_extend.c +index 9c2a213b..b0da705e 100644 +--- a/src/daemon/executor/container_cb/execution_extend.c ++++ b/src/daemon/executor/container_cb/execution_extend.c +@@ -715,7 +715,7 @@ static int do_pause_container(container_t *cont) + params.rootpath = cont->root_path; + params.state = cont->state_path; + +- container_stop_health_checks(cont->common_config->id); ++ container_stop_health_checks(cont); + + if (runtime_pause(id, cont->runtime, ¶ms)) { + container_update_health_monitor(cont->common_config->id); +diff --git a/src/daemon/modules/api/container_api.h b/src/daemon/modules/api/container_api.h +index 1140d4d5..ed97633f 100644 +--- a/src/daemon/modules/api/container_api.h ++++ b/src/daemon/modules/api/container_api.h +@@ -254,7 +254,7 @@ extern char *container_exit_fifo_create(const char *cont_state_path); + extern int container_exit_fifo_open(const char *cont_exit_fifo); + + void container_init_health_monitor(const char *id); +-void container_stop_health_checks(const char *container_id); ++void container_stop_health_checks(container_t *cont); + + bool container_is_in_gc_progress(const char *id); + +diff --git a/src/daemon/modules/container/health_check/health_check.c b/src/daemon/modules/container/health_check/health_check.c +index b2feee91..273d3531 100644 +--- a/src/daemon/modules/container/health_check/health_check.c ++++ b/src/daemon/modules/container/health_check/health_check.c +@@ -182,23 +182,15 @@ static void close_health_check_monitor(container_t *cont) + + // Called when the container is being stopped (whether because the health check is + // failing or for any other reason). +-void container_stop_health_checks(const char *container_id) ++void container_stop_health_checks(container_t *cont) + { +- container_t *cont = NULL; +- +- if (container_id == NULL) { +- return; +- } +- +- cont = containers_store_get(container_id); + if (cont == NULL) { +- ERROR("Failed to get container info"); + return; + } ++ + if (cont->state != NULL && cont->state->state != NULL && cont->state->state->health != NULL) { + close_health_check_monitor(cont); + } +- container_unref(cont); + } + + /* health check manager free */ +diff --git a/src/daemon/modules/service/service_container.c b/src/daemon/modules/service/service_container.c +index a9b14043..2f688f57 100644 +--- a/src/daemon/modules/service/service_container.c ++++ b/src/daemon/modules/service/service_container.c +@@ -1401,6 +1401,9 @@ int stop_container(container_t *cont, int timeout, bool force, bool restart) + ret = -1; + goto out; + } ++ ++ container_stop_health_checks(cont); ++ + // set AutoRemove flag to false before stop so the container won't be + // removed during restart process + if (restart) { +diff --git a/test/mocks/health_check_mock.cc b/test/mocks/health_check_mock.cc +index eab18be7..5e2f210b 100644 +--- a/test/mocks/health_check_mock.cc ++++ b/test/mocks/health_check_mock.cc +@@ -32,10 +32,10 @@ void container_update_health_monitor(const char *container_id) + return; + } + +-void container_stop_health_checks(const char *container_id) ++void container_stop_health_checks(container_t *cont) + { + if (g_health_check_mock != nullptr) { +- return g_health_check_mock->ContainerStopHealthCheck(container_id); ++ return g_health_check_mock->ContainerStopHealthCheck(cont); + } + return; + } +diff --git a/test/mocks/health_check_mock.h b/test/mocks/health_check_mock.h +index ab8e20b0..29dad8ca 100644 +--- a/test/mocks/health_check_mock.h ++++ b/test/mocks/health_check_mock.h +@@ -22,7 +22,7 @@ + class MockHealthCheck { + public: + MOCK_METHOD1(UpdateHealthMonitor, void(const char *container_id)); +- MOCK_METHOD1(ContainerStopHealthCheck, void(const char *container_id)); ++ MOCK_METHOD1(ContainerStopHealthCheck, void(container_t *cont)); + }; + + void MockHealthCheck_SetMock(MockHealthCheck* mock); +diff --git a/test/services/execution/execute/execution_extend/execution_extend_ut.cc b/test/services/execution/execute/execution_extend/execution_extend_ut.cc +index 03872340..e4e6d8d4 100644 +--- a/test/services/execution/execute/execution_extend/execution_extend_ut.cc ++++ b/test/services/execution/execute/execution_extend/execution_extend_ut.cc +@@ -204,7 +204,7 @@ void invokeStateSetPaused(container_state_t *s) + return; + } + +-void invokeContainerStopHealthCheck(const char *container_id) ++void invokeContainerStopHealthCheck(container_t *cont) + { + return; + } +-- +2.25.1 + diff --git a/iSulad.spec b/iSulad.spec index f0706b3..adfe6df 100644 --- a/iSulad.spec +++ b/iSulad.spec @@ -1,5 +1,5 @@ %global _version 2.0.15 -%global _release 2 +%global _release 3 %global is_systemd 1 %global enable_shimv2 1 %global is_embedded 1 @@ -19,6 +19,8 @@ Patch6002: 0003-don-t-mount-shareable-dirs-if-user-set-mount-for-dev.patch Patch6003: 0004-tolerate-arch-unspecified-seccomp-profiles.patch Patch6004: 0005-add-a-CI-test-case-checking-seccomp-option.patch Patch6005: 0006-fix-cri-attach-when-stdout-and-stderr-are-false.patch +Patch6006: 0007-fix-cpu-quota-out-of-range-when-update-to-1.patch +Patch6007: 0008-stop-health-check-monitor-before-stopping-container.patch %ifarch x86_64 aarch64 Provides: libhttpclient.so()(64bit) @@ -246,6 +248,12 @@ fi %endif %changelog +* Wed Aug 3 2022 ger202 - 2.0.15-3 +- Type: enhancement +- ID: NA +- SUG: NA +- DESC: sycn patches from openeuler branch + * Mon Aug 1 2022 chengzeruizhi - 2.0.15-2 - Type: enhancement - ID: NA -- Gitee