summaryrefslogtreecommitdiff
path: root/0049-distinguish-between-runtime-and-runtime_cmd-in-isula.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-09-03 03:24:28 +0000
committerCoprDistGit <infra@openeuler.org>2024-09-03 03:24:28 +0000
commite45819fcb4a96649a4030db7684f140d5ca46735 (patch)
tree544dac3e30a0448eabdc50add41aa3a18982d9f1 /0049-distinguish-between-runtime-and-runtime_cmd-in-isula.patch
parent1a71e3afebb4b43be63949dcc8e882fe7643f13b (diff)
automatic import of iSuladopeneuler24.03_LTS
Diffstat (limited to '0049-distinguish-between-runtime-and-runtime_cmd-in-isula.patch')
-rw-r--r--0049-distinguish-between-runtime-and-runtime_cmd-in-isula.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/0049-distinguish-between-runtime-and-runtime_cmd-in-isula.patch b/0049-distinguish-between-runtime-and-runtime_cmd-in-isula.patch
new file mode 100644
index 0000000..4366d7a
--- /dev/null
+++ b/0049-distinguish-between-runtime-and-runtime_cmd-in-isula.patch
@@ -0,0 +1,145 @@
+From 491baece02522128720b3bd992a76dc5148aa7b2 Mon Sep 17 00:00:00 2001
+From: zhongtao <zhongtao17@huawei.com>
+Date: Mon, 8 Apr 2024 11:37:13 +0800
+Subject: [PATCH 49/69] distinguish between runtime and runtime_cmd in
+ isulad-shim
+
+Signed-off-by: zhongtao <zhongtao17@huawei.com>
+---
+ src/cmd/isulad-shim/process.c | 20 +++++++++----------
+ src/cmd/isulad-shim/process.h | 4 ++--
+ .../modules/runtime/isula/isula_rt_ops.c | 2 ++
+ 3 files changed, 14 insertions(+), 12 deletions(-)
+
+diff --git a/src/cmd/isulad-shim/process.c b/src/cmd/isulad-shim/process.c
+index 8a4ca175..6b5f8f7f 100644
+--- a/src/cmd/isulad-shim/process.c
++++ b/src/cmd/isulad-shim/process.c
+@@ -1131,7 +1131,7 @@ static int init_root_path(process_t *p)
+ return SHIM_ERR;
+ }
+
+- if (buffer->nappend(buffer, PATH_MAX, "%s/%s", state_path, p->runtime) < 0) {
++ if (buffer->nappend(buffer, PATH_MAX, "%s/%s", state_path, p->state->runtime) < 0) {
+ ERROR("Failed to append state_path\n");
+ isula_buffer_free(buffer);
+ return SHIM_ERR;
+@@ -1146,7 +1146,7 @@ static int init_root_path(process_t *p)
+ return SHIM_OK;
+ }
+
+-process_t *new_process(char *id, char *bundle, char *runtime)
++process_t *new_process(char *id, char *bundle, char *runtime_cmd)
+ {
+ shim_client_process_state *p_state;
+ process_t *p = NULL;
+@@ -1174,7 +1174,7 @@ process_t *new_process(char *id, char *bundle, char *runtime)
+
+ p->id = id;
+ p->bundle = bundle;
+- p->runtime = runtime;
++ p->runtime_cmd = runtime_cmd;
+ p->state = p_state;
+ p->console_sock_path = NULL;
+ p->exit_fd = -1;
+@@ -1247,7 +1247,7 @@ static void set_common_params(process_t *p, const char *params[], int *index, co
+ {
+ int j;
+
+- params[(*index)++] = p->runtime;
++ params[(*index)++] = p->runtime_cmd;
+ for (j = 0; j < p->state->runtime_args_len; j++) {
+ params[(*index)++] = p->state->runtime_args[j];
+ }
+@@ -1261,7 +1261,7 @@ static void set_common_params(process_t *p, const char *params[], int *index, co
+
+ // In addition to kata, other commonly used oci runtimes (runc, crun, youki, gvisor)
+ // need to set the --root option
+- if (strcasecmp(p->runtime, "kata-runtime") != 0) {
++ if (strcasecmp(p->state->runtime, "kata-runtime") != 0) {
+ params[(*index)++] = "--root";
+ params[(*index)++] = p->root_path;
+ }
+@@ -1347,7 +1347,7 @@ static void process_kill_all(process_t *p)
+ params[i++] = p->id;
+ params[i++] = "SIGKILL";
+
+- (void)cmd_combined_output(p->runtime, params, output, &output_len);
++ (void)cmd_combined_output(p->runtime_cmd, params, output, &output_len);
+
+ return;
+ }
+@@ -1375,7 +1375,7 @@ static void process_delete(process_t *p)
+ params[i++] = "--force";
+ params[i++] = p->id;
+
+- (void)cmd_combined_output(p->runtime, params, output, &output_len);
++ (void)cmd_combined_output(p->runtime_cmd, params, output, &output_len);
+
+ return;
+ }
+@@ -1444,8 +1444,8 @@ static void exec_runtime_process(process_t *p, int exec_fd)
+
+ const char *params[MAX_RUNTIME_ARGS] = { 0 };
+ get_runtime_cmd(p, log_path, pid_path, process_desc, params);
+- execvp(p->runtime, (char * const *)params);
+- (void)dprintf(exec_fd, "run process: %s error: %s", p->runtime, strerror(errno));
++ execvp(p->runtime_cmd, (char * const *)params);
++ (void)dprintf(exec_fd, "run process: %s error: %s", p->runtime_cmd, strerror(errno));
+ _exit(EXIT_FAILURE);
+ }
+
+@@ -1586,7 +1586,7 @@ static int waitpid_with_timeout(int ctr_pid, int *status, const uint64_t timeou
+ static int wait_container_process_with_timeout(process_t *p, const uint64_t timeout, int *status)
+ {
+ // currently, kata runtime does not support setting timeout during exec
+- if (strcasecmp(p->runtime, "kata-runtime") != 0 && timeout > 0) {
++ if (strcasecmp(p->state->runtime, "kata-runtime") != 0 && timeout > 0) {
+ return waitpid_with_timeout(p->ctr_pid, status, timeout);
+ }
+
+diff --git a/src/cmd/isulad-shim/process.h b/src/cmd/isulad-shim/process.h
+index 32ba7366..05fd87b0 100644
+--- a/src/cmd/isulad-shim/process.h
++++ b/src/cmd/isulad-shim/process.h
+@@ -44,7 +44,7 @@ typedef struct {
+ typedef struct process {
+ char *id;
+ char *bundle;
+- char *runtime;
++ char *runtime_cmd;
+ char *console_sock_path; // pty socket path
+ char *workdir;
+ char *root_path;
+@@ -70,7 +70,7 @@ typedef struct {
+ int status;
+ } process_exit_t;
+
+-process_t* new_process(char *id, char *bundle, char *runtime);
++process_t* new_process(char *id, char *bundle, char *runtime_cmd);
+
+ int prepare_attach_socket(process_t *p);
+
+diff --git a/src/daemon/modules/runtime/isula/isula_rt_ops.c b/src/daemon/modules/runtime/isula/isula_rt_ops.c
+index b9aba3e3..bc3c36c8 100644
+--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c
++++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c
+@@ -1154,6 +1154,7 @@ int rt_isula_create(const char *id, const char *runtime, const rt_create_params_
+ p.isulad_stdin = (char *)params->stdin;
+ p.isulad_stdout = (char *)params->stdout;
+ p.isulad_stderr = (char *)params->stderr;
++ p.runtime = (char *)runtime;
+ p.runtime_args = (char **)runtime_args;
+ p.runtime_args_len = runtime_args_len;
+ p.attach_socket = attach_socket;
+@@ -1409,6 +1410,7 @@ static int preparation_exec(const char *id, const char *runtime, const char *wor
+ p.isulad_stdout = (char *)params->console_fifos[1];
+ p.isulad_stderr = (char *)params->console_fifos[2];
+ p.resize_fifo = resize_fifo_dir;
++ p.runtime = (char *)runtime;
+ p.runtime_args = (char **)runtime_args;
+ p.runtime_args_len = runtime_args_len;
+ copy_process(&p, process);
+--
+2.34.1
+