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