Blob Blame History Raw
From 81b19743a97ebecc188d87fbe04dce59260824f8 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Tue, 6 Nov 2018 21:35:36 +0530
Subject: [PATCH 460/493] 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>

upstream patch: https://review.gluster.org/#/c/glusterfs/+/21572/

Change-Id: I740b01868abbd75bf0a609cfaf00114d4d78aa96
BUG: 1639568
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/158630
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 cli/src/cli-cmd-peer.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c
index 7df60bc..6f3b744 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);
 
-- 
1.8.3.1