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