diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-08-21 06:45:46 -0400 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-09-09 14:56:36 -0700 |
commit | d55a6fee5cdda8be9dd555b4f3b5c0cc005117ef (patch) | |
tree | c747e6137038d69b0050fbe1c983c044e97c7b6b /cli/src/cli-cmd-volume.c | |
parent | d35b8b60d7f436c5929dfa8d647f1d41aecfc237 (diff) | |
download | glusterfs-d55a6fee5cdda8be9dd555b4f3b5c0cc005117ef.tar.gz glusterfs-d55a6fee5cdda8be9dd555b4f3b5c0cc005117ef.tar.xz glusterfs-d55a6fee5cdda8be9dd555b4f3b5c0cc005117ef.zip |
cluster/tier: add gluster v tier <vol>
Currently the tier feature piggy backs off the rebalance command
syntax to obtain status and this is clumsy. Introduce a new
tier command that can do tier specific operations, starting
with volume status to display counters.
Old commands:
gluster volume attach-tier <vol> [replica count] {bricklist..}
gluster volume detach-tier <vol> {start|stop|commit}
New commands:
gluster volume tier <vol> attach [replica count] {bricklist} |
detach {start|stop|commit} |
status
Change-Id: Ic07b3c6260588162de7d34380f8cbd3d8a7f35d3
BUG: 1255693
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/11984
Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli/src/cli-cmd-volume.c')
-rw-r--r-- | cli/src/cli-cmd-volume.c | 93 |
1 files changed, 87 insertions, 6 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 040e255f89..ee9a09af4b 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -893,7 +893,7 @@ out: } int -cli_cmd_volume_attach_tier_cbk (struct cli_state *state, +do_cli_cmd_volume_attach_tier (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { @@ -975,7 +975,7 @@ out: } int -cli_cmd_volume_detach_tier_cbk (struct cli_state *state, +do_cli_cmd_volume_detach_tier (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { @@ -1040,6 +1040,77 @@ out: return ret; } +int +cli_cmd_volume_tier_cbk (struct cli_state *state, + struct cli_cmd_word *word, const char **words, + int wordcount) +{ + int ret = -1; + call_frame_t *frame = NULL; + dict_t *options = NULL; + char *volname = NULL; + rpc_clnt_procedure_t *proc = NULL; + cli_local_t *local = NULL; + int i = 0; + + if (wordcount < 4) { + cli_usage_out (word->pattern); + goto out; + } + + if (!strcmp(words[1], "detach-tier")) { + ret = do_cli_cmd_volume_detach_tier (state, word, + words, wordcount); + goto out; + } else if (!strcmp(words[3], "detach")) { + for (i = 3; i < wordcount; i++) + words[i] = words[i+1]; + + ret = do_cli_cmd_volume_detach_tier (state, word, + words, wordcount-1); + goto out; + + } else if (!strcmp(words[1], "attach-tier")) { + ret = do_cli_cmd_volume_attach_tier (state, word, + words, wordcount); + goto out; + } else if (!strcmp(words[3], "attach")) { + for (i = 3; i < wordcount; i++) + words[i] = words[i+1]; + + ret = do_cli_cmd_volume_attach_tier (state, word, + words, wordcount-1); + goto out; + } + + ret = cli_cmd_volume_tier_parse (words, wordcount, &options); + if (ret) { + cli_usage_out (word->pattern); + goto out; + } + + proc = &cli_rpc_prog->proctable[GLUSTER_CLI_TIER]; + + frame = create_frame (THIS, THIS->ctx->pool); + if (!frame) + goto out; + + CLI_LOCAL_INIT (local, words, frame, options); + + if (proc->fn) { + ret = proc->fn (frame, THIS, options); + } + +out: + if (ret) { + cli_out ("Tier command failed"); + } + if (options) + dict_unref (options); + + return ret; +} + static int gf_cli_create_auxiliary_mount (char *volname) { @@ -2584,14 +2655,24 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_rename_cbk, "rename volume <VOLNAME> to <NEW-VOLNAME>"},*/ + { "volume tier <VOLNAME> status\n" + "volume tier <VOLNAME> attach [<replica COUNT>] <NEW-BRICK>...\n" + "volume tier <VOLNAME> detach <start|stop|status|commit|[force]>\n", + cli_cmd_volume_tier_cbk, + "Tier translator specific operations."}, + { "volume attach-tier <VOLNAME> [<replica COUNT>] <NEW-BRICK>...", - cli_cmd_volume_attach_tier_cbk, - "attach tier to volume <VOLNAME>"}, + cli_cmd_volume_tier_cbk, + "NOTE: this is old syntax, will be depreciated in next release. " + "Please use gluster volume tier <vol> attach " + "[<replica COUNT>] <NEW-BRICK>..."}, { "volume detach-tier <VOLNAME> " " <start|stop|status|commit|[force]>", - cli_cmd_volume_detach_tier_cbk, - "detach tier from volume <VOLNAME>"}, + cli_cmd_volume_tier_cbk, + "NOTE: this is old syntax, will be depreciated in next release. " + "Please use gluster volume tier <vol> detach " + "{start|stop|commit} [force]"}, { "volume add-brick <VOLNAME> [<stripe|replica> <COUNT>] <NEW-BRICK> ... [force]", cli_cmd_volume_add_brick_cbk, |