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