summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2016-04-01 11:50:26 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-04-01 13:39:48 -0700
commitaa614a39c4281781cd77052c01f5747f1e5ad05e (patch)
tree8ab7cc1cf628ae477616a48d233b7038b2361d69 /cli/src
parent34899d71f21fd2b4c523b68ffb2d7c655c776641 (diff)
cli: Make CLI timeout configurable
When number of volumes go high in numbers command like gluster volume status may timeout from CLI since it follows a static timeout value of 120 secs. This patch introduces a flag '--timeout' which can pass a specific time out value for a particular command. Change-Id: I9795b709f27357fe5ee10ba19de8f4c11b63186f Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/13882 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd.c6
-rw-r--r--cli/src/cli.c8
-rw-r--r--cli/src/cli.h6
3 files changed, 14 insertions, 6 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index a1e4e909a0d..8a750414108 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -48,7 +48,7 @@ cli_cmd_needs_connection (struct cli_cmd_word *word)
if (!strcasecmp ("exit", word->word))
return 0;
- return CLI_DEFAULT_CONN_TIMEOUT;
+ return cli_default_conn_timeout;
}
int
@@ -371,9 +371,9 @@ cli_cmd_submit (struct rpc_clnt* rpc, void *req, call_frame_t *frame,
if ((GLUSTER_CLI_PROFILE_VOLUME == procnum) ||
(GLUSTER_CLI_HEAL_VOLUME == procnum) ||
(GLUSTER_CLI_GANESHA == procnum))
- timeout = CLI_TEN_MINUTES_TIMEOUT;
+ timeout = cli_ten_minutes_timeout;
else
- timeout = CLI_DEFAULT_CMD_TIMEOUT;
+ timeout = cli_default_conn_timeout;
cli_cmd_lock ();
cmd_sent = 0;
diff --git a/cli/src/cli.c b/cli/src/cli.c
index fbf3e89fb78..dfacd4bee0c 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -360,6 +360,11 @@ cli_opt_parse (char *opt, struct cli_state *state)
state->log_file = oarg;
return 0;
}
+ oarg = strtail (opt, "timeout=");
+ if (oarg) {
+ cli_default_conn_timeout = atoi(oarg);
+ return 0;
+ }
oarg = strtail (opt, "log-level=");
if (oarg) {
@@ -702,6 +707,9 @@ main (int argc, char *argv[])
if (ret)
goto out;
+ cli_default_conn_timeout = 120;
+ cli_ten_minutes_timeout = 600;
+
ret = cli_state_init (&state);
if (ret)
goto out;
diff --git a/cli/src/cli.h b/cli/src/cli.h
index 999772d4bc4..0776383fc9f 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -25,9 +25,6 @@
#define DEFAULT_EVENT_POOL_SIZE 16384
#define CLI_GLUSTERD_PORT 24007
-#define CLI_DEFAULT_CONN_TIMEOUT 120
-#define CLI_DEFAULT_CMD_TIMEOUT 120
-#define CLI_TEN_MINUTES_TIMEOUT 600 //Longer timeout for volume top
#define DEFAULT_CLI_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs"
#define CLI_VOL_STATUS_BRICK_LEN 43
#define CLI_TAB_LENGTH 8
@@ -42,6 +39,9 @@ enum argp_option_keys {
ARGP_PORT_KEY = 'p',
};
+int cli_default_conn_timeout;
+int cli_ten_minutes_timeout;
+
typedef enum {
COLD_BRICK_COUNT,
COLD_TYPE,