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