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