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