diff options
author | Gaurav Kumar Garg <ggarg@redhat.com> | 2015-03-10 15:04:59 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-18 18:34:07 -0700 |
commit | d236b01a8bf68b83c76ea1cfa8351833e19695f7 (patch) | |
tree | ee088fec3111b70dbf90c2af7fa7b43d6e97e019 /cli/src/cli-cmd-volume.c | |
parent | 7c4461329bba38b72536ee71a8172bc861ddf890 (diff) |
cli/glusterd: cli command implementation for bitrot features
CLI command for bitrot features.
volume bitrot <volname> enable|disable
Above command will enable/disable bitrot feature for particular volume.
BUG: 1170075
Change-Id: Ie84002ef7f479a285688fdae99c7afa3e91b8b99
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
Signed-off-by: Anand nekkunti <anekkunt@redhat.com>
Signed-off-by: Dominic P Geevarghese <dgeevarg@redhat.com>
Reviewed-on: http://review.gluster.org/9866
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'cli/src/cli-cmd-volume.c')
-rw-r--r-- | cli/src/cli-cmd-volume.c | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 5632a9798bb..6c950da4e97 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1300,6 +1300,58 @@ out: } int +cli_cmd_bitrot_cbk (struct cli_state *state, struct cli_cmd_word *word, + const char **words, int wordcount) +{ + + int ret = -1; + int parse_err = 0; + call_frame_t *frame = NULL; + dict_t *options = NULL; + cli_local_t *local = NULL; + rpc_clnt_procedure_t *proc = NULL; + int sent = 0; + + ret = cli_cmd_bitrot_parse (words, wordcount, &options); + if (ret < 0) { + cli_usage_out (word->pattern); + parse_err = 1; + goto out; + } + + frame = create_frame (THIS, THIS->ctx->pool); + if (!frame) { + ret = -1; + goto out; + } + + proc = &cli_rpc_prog->proctable[GLUSTER_CLI_BITROT]; + if (proc == NULL) { + ret = -1; + goto out; + } + + CLI_LOCAL_INIT (local, words, frame, options); + + if (proc->fn) { + ret = proc->fn (frame, THIS, options); + } + +out: + if (ret) { + cli_cmd_sent_status_get (&sent); + if ((sent == 0) && (parse_err == 0)) + cli_err ("Bit rot command failed. Please check the cli " + "logs for more details"); + + } + + CLI_STACK_DESTROY (frame); + + return ret; +} + +int cli_cmd_quota_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { @@ -2492,7 +2544,17 @@ struct cli_cmd volume_cmds[] = { }, {"volume get <VOLNAME> <key|all>", cli_cmd_volume_getopt_cbk, - "Get the value of the all options or given option for volume <VOLNAME>"}, + "Get the value of the all options or given option for volume <VOLNAME>" + }, + { "volume bitrot <volname> {enable|disable} |\n" + "volume bitrot <volname> {scrub-throttle frozen|lazy|normal" + "|aggressive} |\n" + "volume bitrot <volname> {scrub-frequency daily|weekly|biweekly" + "|monthly} |\n" + "volume bitrot <volname> {scrub pause|resume}", + cli_cmd_bitrot_cbk, + "Bitrot translator specific operations." + }, { NULL, NULL, NULL } }; |