|
|
3604df |
From 7a723c0c971b13a3db39f210919a054e0ea8ec94 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Milind Changire <mchangir@redhat.com>
|
|
|
3604df |
Date: Wed, 26 Oct 2016 11:12:48 +0530
|
|
|
3604df |
Subject: [PATCH 144/157] events: add TIER_START and TIER_START_FORCE events
|
|
|
3604df |
|
|
|
3604df |
Add TIER_START and TIER_START_FORCE events
|
|
|
3604df |
Conditionally generate DETACH events as per user confirmation.
|
|
|
3604df |
|
|
|
3604df |
mainline:
|
|
|
3604df |
> > Reviewed-on: http://review.gluster.org/15675
|
|
|
3604df |
> > Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> > Reviewed-by: Dan Lambright <dlambrig@redhat.com>
|
|
|
3604df |
(cherry picked from commit 8f8e23b0142a21779648802664db5b3d5253e4e0)
|
|
|
3604df |
|
|
|
3604df |
release-3.9:
|
|
|
3604df |
> Reviewed-on: http://review.gluster.org/15708
|
|
|
3604df |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> Reviewed-by: Aravinda VK <avishwan@redhat.com>
|
|
|
3604df |
(cherry picked from commit 20408dcb5c7491894761fdd86499e038357bd95a)
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I205dc14884d707087edce42e8cf4208bd89d31dc
|
|
|
3604df |
BUG: 1386185
|
|
|
3604df |
Signed-off-by: Milind Changire <mchangir@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/88233
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
cli/src/cli-cmd-volume.c | 39 ++++++++++++++++++++++++++++-----------
|
|
|
3604df |
events/eventskeygen.py | 3 +++
|
|
|
3604df |
2 files changed, 31 insertions(+), 11 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
|
|
|
3604df |
index f2679d2..2d4f465 100644
|
|
|
3604df |
--- a/cli/src/cli-cmd-volume.c
|
|
|
3604df |
+++ b/cli/src/cli-cmd-volume.c
|
|
|
3604df |
@@ -1196,7 +1196,7 @@ out:
|
|
|
3604df |
int
|
|
|
3604df |
do_cli_cmd_volume_detach_tier (struct cli_state *state,
|
|
|
3604df |
struct cli_cmd_word *word, const char **words,
|
|
|
3604df |
- int wordcount)
|
|
|
3604df |
+ int wordcount, gf_boolean_t *aborted)
|
|
|
3604df |
{
|
|
|
3604df |
int ret = -1;
|
|
|
3604df |
rpc_clnt_procedure_t *proc = NULL;
|
|
|
3604df |
@@ -1231,11 +1231,14 @@ do_cli_cmd_volume_detach_tier (struct cli_state *state,
|
|
|
3604df |
if (ret)
|
|
|
3604df |
goto out;
|
|
|
3604df |
|
|
|
3604df |
+ *aborted = _gf_false;
|
|
|
3604df |
+
|
|
|
3604df |
if (!(state->mode & GLUSTER_MODE_SCRIPT) && need_question) {
|
|
|
3604df |
/* we need to ask question only in case of 'commit or force' */
|
|
|
3604df |
answer = cli_cmd_get_confirmation (state, question);
|
|
|
3604df |
if (GF_ANSWER_NO == answer) {
|
|
|
3604df |
ret = 0;
|
|
|
3604df |
+ *aborted = _gf_true;
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
}
|
|
|
3604df |
@@ -1273,6 +1276,7 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
|
|
|
3604df |
cli_local_t *local = NULL;
|
|
|
3604df |
int i = 0;
|
|
|
3604df |
eventtypes_t event = EVENT_LAST;
|
|
|
3604df |
+ gf_boolean_t aborted = _gf_false;
|
|
|
3604df |
|
|
|
3604df |
if (wordcount < 4) {
|
|
|
3604df |
cli_usage_out (word->pattern);
|
|
|
3604df |
@@ -1283,22 +1287,26 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
|
|
|
3604df |
|
|
|
3604df |
if (!strcmp(words[1], "detach-tier")) {
|
|
|
3604df |
ret = do_cli_cmd_volume_detach_tier (state, word,
|
|
|
3604df |
- words, wordcount);
|
|
|
3604df |
+ words, wordcount,
|
|
|
3604df |
+ &aborted);
|
|
|
3604df |
goto out;
|
|
|
3604df |
} else if (!strcmp(words[3], "detach")) {
|
|
|
3604df |
for (i = 3; i < wordcount; i++)
|
|
|
3604df |
words[i] = words[i+1];
|
|
|
3604df |
|
|
|
3604df |
ret = do_cli_cmd_volume_detach_tier (state, word,
|
|
|
3604df |
- words, wordcount-1);
|
|
|
3604df |
- if (!strcmp (words[wordcount-2], "commit")) {
|
|
|
3604df |
- event = EVENT_TIER_DETACH_COMMIT;
|
|
|
3604df |
- } else if (!strcmp (words[wordcount-2], "start")) {
|
|
|
3604df |
- event = EVENT_TIER_DETACH_START;
|
|
|
3604df |
- } else if (!strcmp (words[wordcount-2], "stop")) {
|
|
|
3604df |
- event = EVENT_TIER_DETACH_STOP;
|
|
|
3604df |
- } else if (!strcmp (words[wordcount-2], "force")) {
|
|
|
3604df |
- event = EVENT_TIER_DETACH_FORCE;
|
|
|
3604df |
+ words, wordcount-1,
|
|
|
3604df |
+ &aborted);
|
|
|
3604df |
+ if (!aborted) {
|
|
|
3604df |
+ if (!strcmp (words[wordcount-2], "commit")) {
|
|
|
3604df |
+ event = EVENT_TIER_DETACH_COMMIT;
|
|
|
3604df |
+ } else if (!strcmp (words[wordcount-2], "start")) {
|
|
|
3604df |
+ event = EVENT_TIER_DETACH_START;
|
|
|
3604df |
+ } else if (!strcmp (words[wordcount-2], "stop")) {
|
|
|
3604df |
+ event = EVENT_TIER_DETACH_STOP;
|
|
|
3604df |
+ } else if (!strcmp (words[wordcount-2], "force")) {
|
|
|
3604df |
+ event = EVENT_TIER_DETACH_FORCE;
|
|
|
3604df |
+ }
|
|
|
3604df |
}
|
|
|
3604df |
goto out;
|
|
|
3604df |
|
|
|
3604df |
@@ -1326,6 +1334,15 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
+ if (!strcmp (words[wordcount-1], "start")) {
|
|
|
3604df |
+ event = EVENT_TIER_START;
|
|
|
3604df |
+ } else {
|
|
|
3604df |
+ if (!strcmp (words[wordcount-2], "start") &&
|
|
|
3604df |
+ !strcmp (words[wordcount-1], "force")) {
|
|
|
3604df |
+ event = EVENT_TIER_START_FORCE;
|
|
|
3604df |
+ }
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
proc = &cli_rpc_prog->proctable[GLUSTER_CLI_TIER];
|
|
|
3604df |
|
|
|
3604df |
frame = create_frame (THIS, THIS->ctx->pool);
|
|
|
3604df |
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
|
|
|
3604df |
index 1b1c691..06953b2 100644
|
|
|
3604df |
--- a/events/eventskeygen.py
|
|
|
3604df |
+++ b/events/eventskeygen.py
|
|
|
3604df |
@@ -189,6 +189,9 @@ keys = (
|
|
|
3604df |
"EVENT_VOLUME_REBALANCE_FAILED",
|
|
|
3604df |
"EVENT_VOLUME_REBALANCE_COMPLETE",
|
|
|
3604df |
|
|
|
3604df |
+ #tier events
|
|
|
3604df |
+ "EVENT_TIER_START",
|
|
|
3604df |
+ "EVENT_TIER_START_FORCE",
|
|
|
3604df |
)
|
|
|
3604df |
|
|
|
3604df |
LAST_EVENT = "EVENT_LAST"
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|