diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 60 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 12 | ||||
-rw-r--r-- | cli/src/cli.h | 4 |
3 files changed, 59 insertions, 17 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index d93af0e79d3..d234ad09c4e 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -3989,6 +3989,56 @@ out: } int +cli_cmd_volume_old_tier_parse (const char **words, int wordcount, + dict_t **options) +{ + dict_t *dict = NULL; + int ret = -1; + char *volname = NULL; + gf_cli_defrag_type cmd = 0; + + GF_ASSERT (words); + GF_ASSERT (options); + + dict = dict_new (); + if (!dict) + goto out; + + if (wordcount != 4) + goto out; + + if ((strcmp (words[1], "tier") == 0) && + (strcmp (words[3], "start") == 0)) { + cmd = GF_DEFRAG_CMD_START_TIER; + } else + goto out; + + volname = (char *) words[2]; + + ret = dict_set_str (dict, "volname", volname); + + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, "failed to set dict"); + goto out; + } + + ret = dict_set_int32 (dict, "rebalance-command", (int32_t) cmd); + + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, "failed to set dict"); + goto out; + } + + *options = dict; + +out: + if (ret && dict) + dict_unref (dict); + + return ret; +} + +int cli_cmd_volume_defrag_parse (const char **words, int wordcount, dict_t **options) { @@ -4013,16 +4063,6 @@ cli_cmd_volume_defrag_parse (const char **words, int wordcount, if (strcmp (words[3], "start") && strcmp (words[3], "stop") && strcmp (words[3], "status")) goto out; - } else if ((strcmp (words[3], "tier") == 0) && - (strcmp (words[4], "start") == 0)) { - volname = (char *) words[2]; - cmd = GF_DEFRAG_CMD_START_TIER; - goto done; - } else if ((strcmp (words[3], "tier") == 0) && - (strcmp (words[4], "status") == 0)) { - volname = (char *) words[2]; - cmd = GF_DEFRAG_CMD_STATUS_TIER; - goto done; } else { if (strcmp (words[3], "fix-layout") && strcmp (words[3], "start")) diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 7cdbaf0cad9..879c6c40aa1 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -4911,10 +4911,9 @@ gf_cli_attach_tier (call_frame_t *frame, xlator_t *this, int ret = 0; dict_t *dict = NULL; dict_t *newdict = NULL; - char *tierwords[] = {"volume", "rebalance", "", - "tier", "start", NULL}; + char *tierwords[] = {"volume", "tier", "", + "start", NULL}; const char **words = (const char **)tierwords; - int wordcount = 5; char *volname = NULL; cli_local_t *local = NULL; cli_local_t *oldlocal = NULL; @@ -4942,8 +4941,8 @@ gf_cli_attach_tier (call_frame_t *frame, xlator_t *this, } words[2] = volname; - ret = cli_cmd_volume_defrag_parse ((const char **)words, - wordcount, &newdict); + ret = cli_cmd_volume_old_tier_parse ((const char **)words, + 4, &newdict); if (ret) { gf_log ("cli", GF_LOG_ERROR, "Failed to parse tier start " "command"); @@ -4962,8 +4961,7 @@ notify_cli: if (ret) { cli_out ("Failed to run tier start. Please execute tier start " "command explicitly"); - cli_out ("Usage : gluster volume rebalance <volname> tier " - "start"); + cli_out ("Usage : gluster volume tier <volname> start"); } out: diff --git a/cli/src/cli.h b/cli/src/cli.h index dad3ce4e3a8..27a3f3cc136 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -274,6 +274,10 @@ cli_cmd_volume_tier_parse (const char **words, int wordcount, dict_t **options); int32_t +cli_cmd_volume_old_tier_parse (const char **words, int wordcount, + dict_t **options); + +int32_t cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, dict_t **options, int *question); |