diff options
Diffstat (limited to 'cli/src/cli-cmd-peer.c')
| -rw-r--r-- | cli/src/cli-cmd-peer.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c index e0a38904a81..084998701d8 100644 --- a/cli/src/cli-cmd-peer.c +++ b/cli/src/cli-cmd-peer.c @@ -18,11 +18,7 @@ #include "cli-mem-types.h" #include "cli1-xdr.h" #include "protocol-common.h" -#include "events.h" - -extern struct rpc_clnt *global_rpc; - -extern rpc_clnt_prog_t *cli_rpc_prog; +#include <glusterfs/events.h> int cli_cmd_peer_help_cbk(struct cli_state *state, struct cli_cmd_word *in_word, @@ -48,10 +44,6 @@ cli_cmd_peer_probe_cbk(struct cli_state *state, struct cli_cmd_word *word, proc = &cli_rpc_prog->proctable[GLUSTER_CLI_PROBE]; - frame = create_frame(THIS, THIS->ctx->pool); - if (!frame) - goto out; - dict = dict_new(); if (!dict) goto out; @@ -60,7 +52,7 @@ cli_cmd_peer_probe_cbk(struct cli_state *state, struct cli_cmd_word *word, if (ret) goto out; - ret = valid_internet_address((char *)words[2], _gf_false); + ret = valid_internet_address((char *)words[2], _gf_false, _gf_false); if (ret == 1) { ret = 0; } else { @@ -77,6 +69,12 @@ cli_cmd_peer_probe_cbk(struct cli_state *state, struct cli_cmd_word *word, } */ + frame = create_frame(THIS, THIS->ctx->pool); + if (!frame) { + ret = -1; + goto out; + } + CLI_LOCAL_INIT(local, words, frame, dict); if (proc->fn) { @@ -111,19 +109,22 @@ cli_cmd_peer_deprobe_cbk(struct cli_state *state, struct cli_cmd_word *word, int sent = 0; int parse_error = 0; cli_local_t *local = NULL; + gf_answer_t answer = GF_ANSWER_NO; + const char *question = NULL; if ((wordcount < 3) || (wordcount > 4)) { cli_usage_out(word->pattern); parse_error = 1; goto out; } - + question = + "All clients mounted through the peer which is getting detached need " + "to be remounted using one of the other active peers in the trusted " + "storage pool to ensure client gets notification on any changes done " + "on the gluster configuration and if the same has been done do you " + "want to proceed?"; proc = &cli_rpc_prog->proctable[GLUSTER_CLI_DEPROBE]; - frame = create_frame(THIS, THIS->ctx->pool); - if (!frame) - goto out; - dict = dict_new(); ret = dict_set_str(dict, "hostname", (char *)words[2]); @@ -149,6 +150,17 @@ cli_cmd_peer_deprobe_cbk(struct cli_state *state, struct cli_cmd_word *word, ret = dict_set_int32(dict, "flags", flags); if (ret) goto out; + answer = cli_cmd_get_confirmation(state, question); + if (GF_ANSWER_NO == answer) { + ret = 0; + goto out; + } + + frame = create_frame(THIS, THIS->ctx->pool); + if (!frame) { + ret = -1; + goto out; + } CLI_LOCAL_INIT(local, words, frame, dict); |
