From c56563a5cfb85fcba9f28dd1df9647037eb2931e Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Sat, 20 Jan 2024 09:57:05 +0000 Subject: automatic import of iSulad --- ...pdate-restart-policy-for-auto-remove-cont.patch | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 0021-bugfix-of-update-restart-policy-for-auto-remove-cont.patch (limited to '0021-bugfix-of-update-restart-policy-for-auto-remove-cont.patch') diff --git a/0021-bugfix-of-update-restart-policy-for-auto-remove-cont.patch b/0021-bugfix-of-update-restart-policy-for-auto-remove-cont.patch new file mode 100644 index 0000000..6d0ba03 --- /dev/null +++ b/0021-bugfix-of-update-restart-policy-for-auto-remove-cont.patch @@ -0,0 +1,58 @@ +From ea51fa836464660fcca245e7e36a2b4cdf1e5997 Mon Sep 17 00:00:00 2001 +From: zhangxiaoyu +Date: Tue, 21 Nov 2023 10:23:26 +0800 +Subject: [PATCH 21/64] bugfix of update restart policy for auto remove + container + +Signed-off-by: zhangxiaoyu +--- + .../executor/container_cb/execution_extend.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/src/daemon/executor/container_cb/execution_extend.c b/src/daemon/executor/container_cb/execution_extend.c +index 6759a4fc..de017b4e 100644 +--- a/src/daemon/executor/container_cb/execution_extend.c ++++ b/src/daemon/executor/container_cb/execution_extend.c +@@ -1113,15 +1113,14 @@ static int update_host_config_check(container_t *cont, host_config *hostconfig) + + ret = verify_host_config_settings(hostconfig, true); + if (ret != 0) { +- goto out; ++ return -1; + } + + if (container_is_removal_in_progress(cont->state) || container_is_dead(cont->state)) { + ERROR("Container is marked for removal and cannot be \"update\"."); + isulad_set_error_message( + "Cannot update container %s: Container is marked for removal and cannot be \"update\".", id); +- ret = -1; +- goto out; ++ return -1; + } + + if (container_is_running(cont->state) && hostconfig->kernel_memory) { +@@ -1129,12 +1128,17 @@ static int update_host_config_check(container_t *cont, host_config *hostconfig) + isulad_set_error_message("Cannot update container %s: Can not update kernel memory to a running container," + " please stop it first.", + id); +- ret = -1; +- goto out; ++ return -1; + } + +-out: +- return ret; ++ if (cont->hostconfig->auto_remove && hostconfig->restart_policy != NULL && ++ hostconfig->restart_policy->name != NULL && strcmp("no", hostconfig->restart_policy->name) != 0) { ++ ERROR("Cannot update restart policy for the auto remove container %s", id); ++ isulad_set_error_message("Cannot update restart policy for the auto remove container %s", id); ++ return -1; ++ } ++ ++ return 0; + } + + static int do_update_resources(const container_update_request *request, container_t *cont) +-- +2.42.0 + -- cgit v1.2.3