summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-08-11 00:33:03 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-11 23:46:49 -0700
commite17db5e4f67779f2e5095018bfda6f3b477e38ba (patch)
tree8fbbe814e37a39de9f7315ec0bab10ee2254414a /cli
parentd30f7058780477239dc8fe1ad691f4661a4988e6 (diff)
cli: Do not await connection for miscellaneous cmds
Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1262 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1262
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c8
-rw-r--r--cli/src/cli-cmd.c26
2 files changed, 24 insertions, 10 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index ddb376bcbdc..c3bfc5f5434 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -162,7 +162,7 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options)
char *value = NULL;
int i = 0;
char str[50] = {0,};
-
+
GF_ASSERT (words);
GF_ASSERT (options);
@@ -388,7 +388,7 @@ out:
int32_t
-cli_cmd_volume_replace_brick_parse (const char **words, int wordcount,
+cli_cmd_volume_replace_brick_parse (const char **words, int wordcount,
dict_t **options)
{
dict_t *dict = NULL;
@@ -397,7 +397,7 @@ cli_cmd_volume_replace_brick_parse (const char **words, int wordcount,
char *op = NULL;
int op_index = 0;
gf1_cli_replace_op replace_op = GF_REPLACE_OP_NONE;
-
+
GF_ASSERT (words);
GF_ASSERT (options);
@@ -458,7 +458,7 @@ cli_cmd_volume_replace_brick_parse (const char **words, int wordcount,
if (ret)
goto out;
-
+
*options = dict;
out:
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index b61fc819f37..4353cb6e7b6 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -44,6 +44,15 @@ static pthread_mutex_t conn_mutex = PTHREAD_MUTEX_INITIALIZER;
int cli_op_ret = 0;
int connected = 0;
+static gf_boolean_t
+cli_cmd_needs_connection (struct cli_cmd_word *word)
+{
+ if (!strcasecmp ("quit", word->word))
+ return _gf_false;
+
+ return _gf_true;
+}
+
int
cli_cmd_process (struct cli_state *state, int argc, char **argv)
{
@@ -51,6 +60,7 @@ cli_cmd_process (struct cli_state *state, int argc, char **argv)
struct cli_cmd_word *word = NULL;
struct cli_cmd_word *next = NULL;
int i = 0;
+ gf_boolean_t await_conn = _gf_false;
word = &state->tree.root;
@@ -79,12 +89,16 @@ cli_cmd_process (struct cli_state *state, int argc, char **argv)
return -1;
}
- ret = cli_cmd_await_connected ();
- if (ret) {
- cli_out ("Connection failed. Please check if gluster daemon"
- " is operational.");
- gf_log ("", GF_LOG_NORMAL, "Exiting with: %d", ret);
- exit (ret);
+ await_conn = cli_cmd_needs_connection (word);
+
+ if (await_conn) {
+ ret = cli_cmd_await_connected ();
+ if (ret) {
+ cli_out ("Connection failed. Please check if gluster "
+ "daemon is operational.");
+ gf_log ("", GF_LOG_NORMAL, "Exiting with: %d", ret);
+ exit (ret);
+ }
}