887953
From 81b19743a97ebecc188d87fbe04dce59260824f8 Mon Sep 17 00:00:00 2001
887953
From: Atin Mukherjee <amukherj@redhat.com>
887953
Date: Tue, 6 Nov 2018 21:35:36 +0530
887953
Subject: [PATCH 460/493] cli: add a warning/confirmation message in peer
887953
 detach code path
887953
887953
On a multi node cluster if one of the node is detached which had active
887953
clients mounted through the same server address, this can cause all the
887953
clients to loose any volfile changes. This is due to the lack of infra
887953
in glusterd to let client know the list of IPs and attempt to connect to
887953
other active nodes as failback. Such framework does exist in GD2 but not
887953
in GD1.
887953
887953
This patch ensures to take a preventive measure to have a warning
887953
message thrown to user to ensure all such connected clients are
887953
remounted through a different IP.
887953
887953
> Change-Id: I740b01868abbd75bf0a609cfaf00114d4d78aa96
887953
> Fixes: bz#1647074
887953
> Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
887953
887953
upstream patch: https://review.gluster.org/#/c/glusterfs/+/21572/
887953
887953
Change-Id: I740b01868abbd75bf0a609cfaf00114d4d78aa96
887953
BUG: 1639568
887953
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
887953
Reviewed-on: https://code.engineering.redhat.com/gerrit/158630
887953
Tested-by: RHGS Build Bot <nigelb@redhat.com>
887953
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
887953
---
887953
 cli/src/cli-cmd-peer.c | 14 +++++++++++++-
887953
 1 file changed, 13 insertions(+), 1 deletion(-)
887953
887953
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c
887953
index 7df60bc..6f3b744 100644
887953
--- a/cli/src/cli-cmd-peer.c
887953
+++ b/cli/src/cli-cmd-peer.c
887953
@@ -111,13 +111,20 @@ cli_cmd_peer_deprobe_cbk (struct cli_state *state, struct cli_cmd_word *word,
887953
         int                  sent = 0;
887953
         int                  parse_error = 0;
887953
         cli_local_t          *local = NULL;
887953
+        gf_answer_t          answer = GF_ANSWER_NO;
887953
+        const char           *question = NULL;
887953
 
887953
         if ((wordcount < 3) || (wordcount > 4)) {
887953
                 cli_usage_out (word->pattern);
887953
                 parse_error = 1;
887953
                 goto out;
887953
         }
887953
-
887953
+        question =
887953
+                "All clients mounted through the peer which is getting detached"
887953
+                " need to be remounted using one of the other active peers in "
887953
+                "the trusted storage pool to ensure client gets notification on"
887953
+                " any changes done on the gluster configuration and if the "
887953
+                "same has been done do you want to proceed?";
887953
         proc = &cli_rpc_prog->proctable[GLUSTER_CLI_DEPROBE];
887953
 
887953
         frame = create_frame (THIS, THIS->ctx->pool);
887953
@@ -149,6 +156,11 @@ cli_cmd_peer_deprobe_cbk (struct cli_state *state, struct cli_cmd_word *word,
887953
         ret = dict_set_int32 (dict, "flags", flags);
887953
         if (ret)
887953
                 goto out;
887953
+        answer = cli_cmd_get_confirmation(state, question);
887953
+        if (GF_ANSWER_NO == answer) {
887953
+                ret = 0;
887953
+                goto out;
887953
+        }
887953
 
887953
         CLI_LOCAL_INIT (local, words, frame, dict);
887953
 
887953
-- 
887953
1.8.3.1
887953