summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c33
-rw-r--r--cli/src/cli-cmd-volume.c1
-rw-r--r--cli/src/cli-rpc-ops.c1
3 files changed, 26 insertions, 9 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 1d4d6cf89c7..68c407d5b4f 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1701,9 +1701,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);
@@ -1713,7 +1713,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;
@@ -1735,11 +1735,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;
}
@@ -3661,7 +3678,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 92edc356705..3707e130183 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -2662,6 +2662,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 6dcf0f37e3f..b7e0aedbcbb 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1780,7 +1780,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 "