summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2018-11-06 21:35:36 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-11-09 07:18:25 +0000
commit185106a574646bdc2d4ec50756c52db61ad14d98 (patch)
treebf0ad6721415abcfb3557369c8c030e0ca8fc6d8
parent6d4cd8ce6c0d88d331ffed97c51d3061a3900561 (diff)
cli: add a warning/confirmation message in peer detach code path
On a multi node cluster if one of the node is detached which had active clients mounted through the same server address, this can cause all the clients to loose any volfile changes. This is due to the lack of infra in glusterd to let client know the list of IPs and attempt to connect to other active nodes as failback. Such framework does exist in GD2 but not in GD1. This patch ensures to take a preventive measure to have a warning message thrown to user to ensure all such connected clients are remounted through a different IP. Change-Id: I740b01868abbd75bf0a609cfaf00114d4d78aa96 Fixes: bz#1647074 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r--cli/src/cli-cmd-peer.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c
index e0a38904a81..ccbd2edde20 100644
--- a/cli/src/cli-cmd-peer.c
+++ b/cli/src/cli-cmd-peer.c
@@ -111,13 +111,20 @@ 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);
@@ -149,6 +156,11 @@ 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;
+ }
CLI_LOCAL_INIT(local, words, frame, dict);