diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-global.c | 3 | ||||
-rw-r--r-- | cli/src/cli-cmd-parser.c | 36 |
2 files changed, 33 insertions, 6 deletions
diff --git a/cli/src/cli-cmd-global.c b/cli/src/cli-cmd-global.c index 2f9d24501d4..0f08985318e 100644 --- a/cli/src/cli-cmd-global.c +++ b/cli/src/cli-cmd-global.c @@ -41,7 +41,8 @@ struct cli_cmd global_cmds[] = { cli_cmd_global_help_cbk, "list global commands", }, - { "get-state [<daemon>] [odir </path/to/output/dir/>] [file <filename>]", + { "get-state [<daemon>] [[odir </path/to/output/dir/>] " + "[file <filename>]] [detail]", cli_cmd_get_state_cbk, "Get local state representation of mentioned daemon", }, diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index be53cd2ed40..c43b52b63a2 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -829,6 +829,7 @@ cli_cmd_get_state_parse (struct cli_state *state, char *filename = NULL; char *daemon_name = NULL; int count = 0; + uint32_t cmd = 0; GF_VALIDATE_OR_GOTO ("cli", options, out); GF_VALIDATE_OR_GOTO ("cli", words, out); @@ -837,7 +838,7 @@ cli_cmd_get_state_parse (struct cli_state *state, if (!dict) goto out; - if (wordcount < 1 || wordcount > 6) { + if (wordcount < 1 || wordcount > 7) { *op_errstr = gf_strdup ("Problem parsing arguments." " Check usage."); goto out; @@ -868,16 +869,28 @@ cli_cmd_get_state_parse (struct cli_state *state, } } else { if (count > 1) { - *op_errstr = gf_strdup ("Problem " - "parsing arguments. " + if (count == wordcount-1 && + !strcmp (words[count], "detail")) { + cmd = GF_CLI_GET_STATE_DETAIL; + continue; + } else { + *op_errstr = gf_strdup ("Problem" + " parsing arguments. " "Check usage."); - ret = -1; - goto out; + ret = -1; + goto out; + } } if (strcmp (words[count], "glusterd") == 0) { continue; } else { + if (count == wordcount-1 && + !strcmp (words[count], "detail")) { + cmd = GF_CLI_GET_STATE_DETAIL; + continue; + } + *op_errstr = gf_strdup ("glusterd is " "the only supported daemon."); ret = -1; @@ -919,6 +932,19 @@ cli_cmd_get_state_parse (struct cli_state *state, goto out; } } + + if (cmd) { + ret = dict_set_uint32 (dict, "getstate-cmd", cmd); + if (ret) { + *op_errstr = gf_strdup ("Command failed. Please" + " check log file for" + " more details."); + gf_log (THIS->name, GF_LOG_ERROR, "Setting " + "get-state command type to dictionary " + "failed"); + goto out; + } + } } out: |