summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-cmd.c2
-rw-r--r--cli/src/cli.c6
-rw-r--r--cli/src/cli.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index 2b9aea191..26c155b50 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -132,6 +132,8 @@ cli_cmd_process (struct cli_state *state, int argc, char **argv)
await_conn = cli_cmd_needs_connection (word);
+ state->await_connected = await_conn;
+
if (await_conn) {
ret = cli_cmd_await_connected ();
if (ret) {
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 709110150..ac0d768e4 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -349,6 +349,12 @@ cli_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
{
gf_log (this->name, GF_LOG_TRACE, "got RPC_CLNT_DISCONNECT");
connected = 0;
+ if (!global_state->prompt && global_state->await_connected) {
+ ret = 1;
+ cli_out ("Connection failed. Please check if gluster "
+ "daemon is operational.");
+ exit (ret);
+ }
break;
}
diff --git a/cli/src/cli.h b/cli/src/cli.h
index 77bc249d9..ad8ed2682 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -101,6 +101,7 @@ struct cli_state {
char *remote_host;
int remote_port;
int mode;
+ int await_connected;
};
struct cli_local {