summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2016-10-19 23:53:12 +0530
committerDan Lambright <dlambrig@redhat.com>2016-10-20 12:05:26 -0700
commit8f8e23b0142a21779648802664db5b3d5253e4e0 (patch)
treef2a8e73db2e0ac70cca64e1f00f7af591fd2f557 /cli
parentd73ca4a5bfad1e46dfc4a3a12401d8720b05c298 (diff)
events: add TIER_START and TIER_START_FORCE events
Add TIER_START and TIER_START_FORCE events Conditionally generate DETACH events as per user confirmation. Change-Id: I205dc14884d707087edce42e8cf4208bd89d31dc BUG: 1386247 Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/15675 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-volume.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index d78ac0ee3af..7693a96e6e5 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1192,7 +1192,7 @@ out:
int
do_cli_cmd_volume_detach_tier (struct cli_state *state,
struct cli_cmd_word *word, const char **words,
- int wordcount)
+ int wordcount, gf_boolean_t *aborted)
{
int ret = -1;
rpc_clnt_procedure_t *proc = NULL;
@@ -1227,11 +1227,14 @@ do_cli_cmd_volume_detach_tier (struct cli_state *state,
if (ret)
goto out;
+ *aborted = _gf_false;
+
if (!(state->mode & GLUSTER_MODE_SCRIPT) && need_question) {
/* we need to ask question only in case of 'commit or force' */
answer = cli_cmd_get_confirmation (state, question);
if (GF_ANSWER_NO == answer) {
ret = 0;
+ *aborted = _gf_true;
goto out;
}
}
@@ -1268,6 +1271,7 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
cli_local_t *local = NULL;
int i = 0;
eventtypes_t event = EVENT_LAST;
+ gf_boolean_t aborted = _gf_false;
if (wordcount < 4) {
cli_usage_out (word->pattern);
@@ -1278,22 +1282,26 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
if (!strcmp(words[1], "detach-tier")) {
ret = do_cli_cmd_volume_detach_tier (state, word,
- words, wordcount);
+ words, wordcount,
+ &aborted);
goto out;
} else if (!strcmp(words[3], "detach")) {
for (i = 3; i < wordcount; i++)
words[i] = words[i+1];
ret = do_cli_cmd_volume_detach_tier (state, word,
- words, wordcount-1);
- if (!strcmp (words[wordcount-2], "commit")) {
- event = EVENT_TIER_DETACH_COMMIT;
- } else if (!strcmp (words[wordcount-2], "start")) {
- event = EVENT_TIER_DETACH_START;
- } else if (!strcmp (words[wordcount-2], "stop")) {
- event = EVENT_TIER_DETACH_STOP;
- } else if (!strcmp (words[wordcount-2], "force")) {
- event = EVENT_TIER_DETACH_FORCE;
+ words, wordcount-1,
+ &aborted);
+ if (!aborted) {
+ if (!strcmp (words[wordcount-2], "commit")) {
+ event = EVENT_TIER_DETACH_COMMIT;
+ } else if (!strcmp (words[wordcount-2], "start")) {
+ event = EVENT_TIER_DETACH_START;
+ } else if (!strcmp (words[wordcount-2], "stop")) {
+ event = EVENT_TIER_DETACH_STOP;
+ } else if (!strcmp (words[wordcount-2], "force")) {
+ event = EVENT_TIER_DETACH_FORCE;
+ }
}
goto out;
@@ -1321,6 +1329,15 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
goto out;
}
+ if (!strcmp (words[wordcount-1], "start")) {
+ event = EVENT_TIER_START;
+ } else {
+ if (!strcmp (words[wordcount-2], "start") &&
+ !strcmp (words[wordcount-1], "force")) {
+ event = EVENT_TIER_START_FORCE;
+ }
+ }
+
proc = &cli_rpc_prog->proctable[GLUSTER_CLI_TIER];
frame = create_frame (THIS, THIS->ctx->pool);