d1681e
From 472aebd90fb081db85b00491ce7034a9b971f4e1 Mon Sep 17 00:00:00 2001
d1681e
From: Samikshan Bairagya <sbairagy@redhat.com>
d1681e
Date: Wed, 9 Aug 2017 14:32:59 +0530
d1681e
Subject: [PATCH 32/74] cli: Add message for user before modifying
d1681e
 brick-multiplex option
d1681e
d1681e
Users should ne notified that brick-multiplexing feature is
d1681e
supported only for container workloads (CNS/CRS). It should also be
d1681e
made known to users that it is advisable to either have all volumes
d1681e
in stopped state or have no bricks running before modifying the
d1681e
"brick-multiplex" option. This commit makes sure these messages
d1681e
are displayed to the user before brick-multiplexing is enabled or
d1681e
disabled.
d1681e
d1681e
Label: DOWNSTREAM ONLY
d1681e
d1681e
Change-Id: Ic40294b26c691ea03185c4d1fce840ef23f95718
d1681e
Signed-off-by: Samikshan Bairagya <sbairagy@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/114793
d1681e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
d1681e
---
d1681e
 cli/src/cli-cmd-parser.c | 18 ++++++++++++++++++
d1681e
 1 file changed, 18 insertions(+)
d1681e
d1681e
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
d1681e
index ca4d906..216e050 100644
d1681e
--- a/cli/src/cli-cmd-parser.c
d1681e
+++ b/cli/src/cli-cmd-parser.c
d1681e
@@ -1621,6 +1621,24 @@ cli_cmd_volume_set_parse (struct cli_state *state, const char **words,
d1681e
                                 goto out;
d1681e
                         }
d1681e
                 }
d1681e
+
d1681e
+                if ((strcmp (key, "cluster.brick-multiplex") == 0)) {
d1681e
+                        question = "Brick-multiplexing is supported only for "
d1681e
+                                   "container workloads (CNS/CRS). Also it is "
d1681e
+                                   "advised to make sure that either all "
d1681e
+                                   "volumes are in stopped state or no bricks "
d1681e
+                                   "are running before this option is modified."
d1681e
+                                   "Do you still want to continue?";
d1681e
+
d1681e
+                        answer = cli_cmd_get_confirmation (state, question);
d1681e
+                        if (GF_ANSWER_NO == answer) {
d1681e
+                                gf_log ("cli", GF_LOG_ERROR, "Operation "
d1681e
+                                        "cancelled, exiting");
d1681e
+                                *op_errstr = gf_strdup ("Aborted by user.");
d1681e
+                                ret = -1;
d1681e
+                                goto out;
d1681e
+                        }
d1681e
+                }
d1681e
         }
d1681e
 
d1681e
         ret = dict_set_int32 (dict, "count", wordcount-3);
d1681e
-- 
d1681e
1.8.3.1
d1681e