From ad234382336a6f2dafb4cb698dfabbf7957b498b Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 20 Sep 2010 09:54:12 +0000 Subject: cli, mgmt/glusterd: volume sync command Signed-off-by: Pranith Kumar K Signed-off-by: Vijay Bellur BUG: 1310 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1310 --- cli/src/cli-cmd-volume.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'cli/src/cli-cmd-volume.c') diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index fc7fda9df..28104c187 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -131,6 +131,52 @@ out: } + +void +cli_cmd_sync_volume_usage () +{ + cli_out ("Usage: volume sync [all|]"); +} + +int +cli_cmd_sync_volume_cbk (struct cli_state *state, struct cli_cmd_word *word, + const char **words, int wordcount) +{ + int ret = -1; + rpc_clnt_procedure_t *proc = NULL; + call_frame_t *frame = NULL; + gf1_cli_sync_volume_req req = {0,}; + + if ((wordcount < 3) || (wordcount > 4)) { + cli_cmd_sync_volume_usage (); + goto out; + } + + if ((wordcount == 3) || !strcmp(words[3], "all")) { + req.flags = GF_CLI_SYNC_ALL; + req.volname = ""; + } else { + req.volname = (char *)words[3]; + } + + req.hostname = (char *)words[2]; + + proc = &cli_rpc_prog->proctable[GF1_CLI_SYNC_VOLUME]; + + frame = create_frame (THIS, THIS->ctx->pool); + if (!frame) + goto out; + + if (proc->fn) { + ret = proc->fn (frame, THIS, &req); + } + +out: + if (ret) + cli_out ("Volume sync failed"); + + return ret; +} void cli_cmd_volume_create_usage () { @@ -826,6 +872,10 @@ struct cli_cmd volume_cmds[] = { cli_cmd_log_rotate_cbk, "rotate the log file for corresponding volume/brick"}, + { "volume sync [all|]", + cli_cmd_sync_volume_cbk, + "sync the volume information from a peer"}, + { NULL, NULL, NULL } }; -- cgit