summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-volume.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-09-20 09:54:12 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-20 10:33:38 -0700
commitad234382336a6f2dafb4cb698dfabbf7957b498b (patch)
tree8cb8c47abb63ea4a5647a5524b688f298017aae9 /cli/src/cli-cmd-volume.c
parente71b50e49612af4e76510b0c2a6f0519adfd852d (diff)
cli, mgmt/glusterd: volume sync command
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1310 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1310
Diffstat (limited to 'cli/src/cli-cmd-volume.c')
-rw-r--r--cli/src/cli-cmd-volume.c50
1 files changed, 50 insertions, 0 deletions
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 <HOSTNAME> [all|<VOLNAME>]");
+}
+
+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 <HOSTNAME> [all|<VOLNAME>]",
+ cli_cmd_sync_volume_cbk,
+ "sync the volume information from a peer"},
+
{ NULL, NULL, NULL }
};