diff options
author | hari gowtham <hgowtham@redhat.com> | 2015-12-16 16:18:29 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-22 16:24:11 -0800 |
commit | 7f61095ddd118d4475df070fbf1f4117bf651ece (patch) | |
tree | abf8bc54f26c6f4b5e5d668f3bcb9ad31ba101d9 /cli | |
parent | 430ad405294993ebb16387232281cc5a4f854c75 (diff) |
Tier: "tier start force" command implementation
The start command doesnt restart the tier deamon if the deamon
is running at one node. hence to bring up the tierd on the nodes
where the deamon is down, the force command is implemented.
It skips the check for tierd running.
Change-Id: I0037d3e5ecfe56637d0da201a97903c435d26436
BUG: 1292112
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: http://review.gluster.org/12983
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 33 | ||||
-rw-r--r-- | cli/src/cli-cmd-volume.c | 1 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 1 |
3 files changed, 26 insertions, 9 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index c72f99db194..9254a3e34bd 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1696,9 +1696,9 @@ cli_cmd_volume_tier_parse (const char **words, int wordcount, { dict_t *dict = NULL; char *volname = NULL; - char *word = NULL; int ret = -1; int32_t command = GF_OP_CMD_NONE; + int32_t is_force = 0; GF_ASSERT (words); GF_ASSERT (options); @@ -1708,7 +1708,7 @@ cli_cmd_volume_tier_parse (const char **words, int wordcount, if (!dict) goto out; - if (wordcount != 4) { + if (!(wordcount == 4 || wordcount == 5)) { gf_log ("cli", GF_LOG_ERROR, "Invalid Syntax"); ret = -1; goto out; @@ -1730,11 +1730,28 @@ cli_cmd_volume_tier_parse (const char **words, int wordcount, goto out; volname = (char *)words[2]; - - word = (char *)words[3]; - if (!strcmp(word, "status")) - command = GF_DEFRAG_CMD_STATUS_TIER; - else { + if (wordcount == 4) { + if (!strcmp(words[3], "status")) + command = GF_DEFRAG_CMD_STATUS_TIER; + else if (!strcmp(words[3], "start")) + command = GF_DEFRAG_CMD_START_TIER; + else { + ret = -1; + goto out; + } + } else if (wordcount == 5) { + if ((!strcmp (words[3], "start")) && + (!strcmp (words[4], "force"))) { + command = GF_DEFRAG_CMD_START_TIER; + is_force = 1; + ret = dict_set_int32 (dict, "force", is_force); + if (ret) + goto out; + } else { + ret = -1; + goto out; + } + } else { ret = -1; goto out; } @@ -3656,7 +3673,7 @@ cli_cmd_volume_defrag_parse (const char **words, int wordcount, strcmp (words[3], "status")) goto out; } else if ((strcmp (words[3], "tier") == 0) && - (strcmp (words[4], "start") == 0)) { + (strcmp (words[4], "start") == 0)) { volname = (char *) words[2]; cmd = GF_DEFRAG_CMD_START_TIER; goto done; diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index bc292864cb0..16e1d1b1e98 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -2659,6 +2659,7 @@ struct cli_cmd volume_cmds[] = { "rename volume <VOLNAME> to <NEW-VOLNAME>"},*/ { "volume tier <VOLNAME> status\n" + "volume tier <VOLNAME> start [force]" "volume tier <VOLNAME> attach [<replica COUNT>] <NEW-BRICK>...\n" "volume tier <VOLNAME> detach <start|stop|status|commit|[force]>\n", cli_cmd_volume_tier_cbk, diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 666d44ff831..6288b01a6af 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1775,7 +1775,6 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov, * case since unlock failures can be highlighted * event though rebalance command was successful */ - if (cmd == GF_DEFRAG_CMD_START_TIER) { snprintf (msg, sizeof (msg), "Attach tier is successful " |