提交 554450a5 编写于 作者: J jingrui

isulad: call runtime kill before delete

Signed-off-by: Njingrui <jingrui@huawei.com>
上级 c1432368
...@@ -357,6 +357,9 @@ static void runtime_exec_param_init(runtime_exec_info *rei) ...@@ -357,6 +357,9 @@ static void runtime_exec_param_init(runtime_exec_info *rei)
if (rei->id) { if (rei->id) {
*params++ = rei->id; *params++ = rei->id;
} }
if (strcmp(rei->subcmd, "kill") == 0) {
*params++ = "9";
}
} }
static void runtime_exec_info_init(runtime_exec_info *rei, static void runtime_exec_info_init(runtime_exec_info *rei,
...@@ -473,7 +476,7 @@ static int runtime_call_simple(const char *workdir, const char *runtime, ...@@ -473,7 +476,7 @@ static int runtime_call_simple(const char *workdir, const char *runtime,
runtime_exec_info_init(&rei, workdir, runtime, subcmd, opts, opts_len, id, params, PARAM_NUM); runtime_exec_info_init(&rei, workdir, runtime, subcmd, opts, opts_len, id, params, PARAM_NUM);
if (!util_exec_cmd(runtime_exec_func, &rei, NULL, &stdout, &stderr)) { if (!util_exec_cmd(runtime_exec_func, &rei, NULL, &stdout, &stderr)) {
ERROR("call runtime %s failed stderr %s", subcmd, stderr); WARN("call runtime %s failed stderr %s", subcmd, stderr);
goto out; goto out;
} }
...@@ -483,6 +486,11 @@ out: ...@@ -483,6 +486,11 @@ out:
return ret; return ret;
} }
static int runtime_call_kill_force(const char *workdir, const char *runtime, const char *id)
{
return runtime_call_simple(workdir, runtime, "kill", NULL, 0, id);
}
static int runtime_call_delete_force(const char *workdir, const char *runtime, const char *id) static int runtime_call_delete_force(const char *workdir, const char *runtime, const char *id)
{ {
const char *opts[1] = {"--force"}; const char *opts[1] = {"--force"};
...@@ -806,6 +814,7 @@ int rt_isula_clean_resource(const char *id, const char *runtime, ...@@ -806,6 +814,7 @@ int rt_isula_clean_resource(const char *id, const char *runtime,
shim_kill_force(workdir); shim_kill_force(workdir);
} }
(void)runtime_call_kill_force(workdir, runtime, id);
(void)runtime_call_delete_force(workdir, runtime, id); (void)runtime_call_delete_force(workdir, runtime, id);
if (util_recursive_rmdir(workdir, 0) != 0) { if (util_recursive_rmdir(workdir, 0) != 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册