diff options
Diffstat (limited to 'cli/src')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 30 | ||||
-rw-r--r-- | cli/src/cli-cmd-volume.c | 2 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 4 | ||||
-rw-r--r-- | cli/src/cli-xml-output.c | 2 |
4 files changed, 28 insertions, 10 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 88fbf96ff9c..de980b27988 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1988,7 +1988,7 @@ cli_cmd_volume_profile_parse (const char **words, int wordcount, if (!dict) goto out; - if (wordcount < 4 || wordcount >5) + if (wordcount < 4) goto out; volname = (char *)words[2]; @@ -2002,12 +2002,30 @@ cli_cmd_volume_profile_parse (const char **words, int wordcount, ret = -1; goto out; } + + if ((strcmp (w, "start") == 0 || strcmp (w, "stop") == 0) && + wordcount > 5) + goto out; + + if (strcmp (w, "info") == 0 && wordcount > 6) + goto out; + if (strcmp (w, "start") == 0) { op = GF_CLI_STATS_START; } else if (strcmp (w, "stop") == 0) { op = GF_CLI_STATS_STOP; } else if (strcmp (w, "info") == 0) { op = GF_CLI_STATS_INFO; + if (wordcount > 4) { + if (strcmp (words[4], "incremental") == 0) { + op = GF_CLI_STATS_INFO_INCREMENTAL; + } else if (strcmp (words[4], "cumulative") == 0) { + op = GF_CLI_STATS_INFO_CUMULATIVE; + } + } + ret = dict_set_int32 (dict, "info-op", op); + if (ret) + goto out; } else GF_ASSERT (!"opword mismatch"); @@ -2015,12 +2033,10 @@ cli_cmd_volume_profile_parse (const char **words, int wordcount, if (ret) goto out; - if (wordcount == 5) { - if (!strcmp (words[4], "nfs")) { - ret = dict_set_int32 (dict, "nfs", _gf_true); - if (ret) - goto out; - } + if (!strcmp (words[wordcount - 1], "nfs")) { + ret = dict_set_int32 (dict, "nfs", _gf_true); + if (ret) + goto out; } *options = dict; diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 22bf66b4fb5..f11fa21db96 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -2299,7 +2299,7 @@ struct cli_cmd volume_cmds[] = { cli_cmd_check_gsync_exists_cbk}, #endif - { "volume profile <VOLNAME> {start|stop|info [nfs]}", + { "volume profile <VOLNAME> {start | info [incremental | cumulative] | stop} [nfs]", cli_cmd_volume_profile_cbk, "volume profile operations"}, diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 3d2f90c0436..2cb0ba3d470 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -4976,6 +4976,8 @@ gf_cli_profile_volume_cbk (struct rpc_req *req, struct iovec *iov, (rsp.op_ret) ? "unsuccessful": "successful"); break; case GF_CLI_STATS_INFO: + case GF_CLI_STATS_INFO_INCREMENTAL: + case GF_CLI_STATS_INFO_CUMULATIVE: break; default: cli_out ("volume profile on %s has been %s ", @@ -4990,7 +4992,7 @@ gf_cli_profile_volume_cbk (struct rpc_req *req, struct iovec *iov, goto out; } - if (op != GF_CLI_STATS_INFO) { + if (op < GF_CLI_STATS_INFO || GF_CLI_STATS_INFO_CUMULATIVE < op) { ret = 0; goto out; } diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 68d69111410..2927ab1e4fd 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2260,7 +2260,7 @@ cli_xml_output_vol_profile (dict_t *dict, int op_ret, int op_errno, "%d", op); XML_RET_CHECK_AND_GOTO (ret, out); - if (op != GF_CLI_STATS_INFO) + if (op < GF_CLI_STATS_INFO || GF_CLI_STATS_INFO_CUMULATIVE < op) goto cont; ret = dict_get_int32 (dict, "count", &brick_count); |