99 lines
3.6 KiB
Diff
99 lines
3.6 KiB
Diff
|
|
From 3e51dc0746c5e0692f54cf54d7aa6beb3b13d799 Mon Sep 17 00:00:00 2001
|
||
|
|
From: ger202 <huangsong14@huawei.com>
|
||
|
|
Date: Wed, 7 Dec 2022 03:21:17 +0000
|
||
|
|
Subject: [PATCH 57/65] !1749 set inspect_container timeout * update function
|
||
|
|
inspect_container timeout
|
||
|
|
|
||
|
|
---
|
||
|
|
src/cmd/isula/information/top.c | 4 +++-
|
||
|
|
src/cmd/isula/stream/attach.c | 5 ++++-
|
||
|
|
src/cmd/isula/stream/exec.c | 4 +++-
|
||
|
|
src/daemon/entry/cri/cri_helpers.cc | 3 +--
|
||
|
|
src/utils/cutils/utils.h | 3 +++
|
||
|
|
5 files changed, 14 insertions(+), 5 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/cmd/isula/information/top.c b/src/cmd/isula/information/top.c
|
||
|
|
index 603f97ba..e55ec43b 100644
|
||
|
|
--- a/src/cmd/isula/information/top.c
|
||
|
|
+++ b/src/cmd/isula/information/top.c
|
||
|
|
@@ -29,7 +29,9 @@
|
||
|
|
const char g_cmd_top_desc[] = "Display the running processes of a container";
|
||
|
|
const char g_cmd_top_usage[] = "top [OPTIONS] CONTAINER [ps OPTIONS]";
|
||
|
|
|
||
|
|
-struct client_arguments g_cmd_top_args = {};
|
||
|
|
+struct client_arguments g_cmd_top_args = {
|
||
|
|
+ .time = INSPECT_TIMEOUT_SEC,
|
||
|
|
+};
|
||
|
|
static void client_top_info_server(const struct isula_top_response *response)
|
||
|
|
{
|
||
|
|
size_t i;
|
||
|
|
diff --git a/src/cmd/isula/stream/attach.c b/src/cmd/isula/stream/attach.c
|
||
|
|
index f260a76e..7fb1046a 100644
|
||
|
|
--- a/src/cmd/isula/stream/attach.c
|
||
|
|
+++ b/src/cmd/isula/stream/attach.c
|
||
|
|
@@ -48,7 +48,9 @@ sem_t g_attach_waitopen_sem;
|
||
|
|
sem_t g_attach_waitexit_sem;
|
||
|
|
#endif
|
||
|
|
|
||
|
|
-struct client_arguments g_cmd_attach_args = { 0 };
|
||
|
|
+struct client_arguments g_cmd_attach_args = {
|
||
|
|
+ .time = INSPECT_TIMEOUT_SEC,
|
||
|
|
+};
|
||
|
|
|
||
|
|
|
||
|
|
static int check_tty(bool tty, struct termios *oldtios, bool *reset_tty)
|
||
|
|
@@ -116,6 +118,7 @@ int inspect_container(const struct client_arguments *args, container_inspect **i
|
||
|
|
}
|
||
|
|
|
||
|
|
inspect_request.name = args->name;
|
||
|
|
+ inspect_request.timeout = args->time;
|
||
|
|
ops = get_connect_client_ops();
|
||
|
|
if (ops == NULL || !ops->container.inspect) {
|
||
|
|
COMMAND_ERROR("Unimplemented ops");
|
||
|
|
diff --git a/src/cmd/isula/stream/exec.c b/src/cmd/isula/stream/exec.c
|
||
|
|
index 2d0d37da..bd8bd49a 100644
|
||
|
|
--- a/src/cmd/isula/stream/exec.c
|
||
|
|
+++ b/src/cmd/isula/stream/exec.c
|
||
|
|
@@ -42,7 +42,9 @@ const char g_cmd_exec_usage[] = "exec [OPTIONS] CONTAINER COMMAND [ARG...]";
|
||
|
|
sem_t g_command_waitopen_sem;
|
||
|
|
sem_t g_command_waitexit_sem;
|
||
|
|
|
||
|
|
-struct client_arguments g_cmd_exec_args = {};
|
||
|
|
+struct client_arguments g_cmd_exec_args = {
|
||
|
|
+ .time = INSPECT_TIMEOUT_SEC,
|
||
|
|
+};
|
||
|
|
|
||
|
|
static int fill_exec_request(const struct client_arguments *args, const struct command_fifo_config *fifos,
|
||
|
|
struct isula_exec_request *request)
|
||
|
|
diff --git a/src/daemon/entry/cri/cri_helpers.cc b/src/daemon/entry/cri/cri_helpers.cc
|
||
|
|
index 7df759e1..64cea7ba 100644
|
||
|
|
--- a/src/daemon/entry/cri/cri_helpers.cc
|
||
|
|
+++ b/src/daemon/entry/cri/cri_helpers.cc
|
||
|
|
@@ -720,8 +720,7 @@ out:
|
||
|
|
auto InspectContainer(const std::string &Id, Errors &err, bool with_host_config) -> container_inspect *
|
||
|
|
{
|
||
|
|
container_inspect *inspect_data { nullptr };
|
||
|
|
-
|
||
|
|
- inspect_data = inspect_container((const char *)Id.c_str(), 0, with_host_config);
|
||
|
|
+ inspect_data = inspect_container((const char *)Id.c_str(), INSPECT_TIMEOUT_SEC, with_host_config);
|
||
|
|
if (inspect_data == nullptr) {
|
||
|
|
err.Errorf("Failed to call inspect service %s", Id.c_str());
|
||
|
|
}
|
||
|
|
diff --git a/src/utils/cutils/utils.h b/src/utils/cutils/utils.h
|
||
|
|
index 0a9535a1..4518e3ac 100644
|
||
|
|
--- a/src/utils/cutils/utils.h
|
||
|
|
+++ b/src/utils/cutils/utils.h
|
||
|
|
@@ -123,6 +123,9 @@ int malloc_trim(size_t pad);
|
||
|
|
|
||
|
|
#define TIME_STR_SIZE 512
|
||
|
|
|
||
|
|
+// client inspect container timeout
|
||
|
|
+#define INSPECT_TIMEOUT_SEC 120
|
||
|
|
+
|
||
|
|
// native umask value
|
||
|
|
#define ANNOTATION_UMAKE_KEY "native.umask"
|
||
|
|
#define UMASK_NORMAL "normal"
|
||
|
|
--
|
||
|
|
2.25.1
|
||
|
|
|