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