summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-09-18 03:31:56 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-18 07:02:03 -0700
commit5c297be9612f76dad6f970092fb6762b4ee4844a (patch)
treef65290e7f12e8d6913f3f3b8d3ffa8dc4cd06618 /cli/src
parentfaa817ea9cb119c7f65fce24f03a172fa4b4ada1 (diff)
Glusterd: gluster volume set <volume> <option> <value>
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c16
-rw-r--r--cli/src/cli-cmd-volume.c36
2 files changed, 44 insertions, 8 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index daec9c8d6e8..479df938677 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -322,12 +322,16 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options)
if (ret)
goto out;
- for (i = 3; i < wordcount; i++) {
- key = strtok ((char *)words[i], "=");
- value = strtok (NULL, "=");
-
- GF_ASSERT (key);
- GF_ASSERT (value);
+ for (i = 3; i < wordcount; i+=2) {
+
+ key = (char *) words[i];
+ value = (char *) words[i+1];
+
+ if ( !key || !value) {
+ ret = -1;
+ cli_out ("Usage: volume set <VOLNAME> <KEY> <VALUE>");
+ goto out;
+ }
count++;
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index b8a5df6d642..fc7fda9dfc2 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -71,6 +71,11 @@ cli_cmd_volume_info_usage ()
cli_out ("Usage: volume info [all|<VOLNAME>]");
}
+void
+cli_cmd_volume_set_usage ()
+{
+ cli_out ("Usage: volume set <VOLNAME> <KEY> <VALUE>");
+}
int
cli_cmd_volume_info_cbk (struct cli_state *state, struct cli_cmd_word *word,
const char **words, int wordcount)
@@ -424,8 +429,35 @@ int
cli_cmd_volume_set_cbk (struct cli_state *state, struct cli_cmd_word *word,
const char **words, int wordcount)
{
- cli_cmd_broadcast_response (0);
- return 0;
+
+ int ret = -1;
+ rpc_clnt_procedure_t *proc = NULL;
+ call_frame_t *frame = NULL;
+ dict_t *options = NULL;
+
+ proc = &cli_rpc_prog->proctable[GF1_CLI_SET_VOLUME];
+
+ frame = create_frame (THIS, THIS->ctx->pool);
+ if (!frame)
+ goto out;
+
+ ret = cli_cmd_volume_set_parse (words, wordcount, &options);
+
+ if (ret) {
+ cli_cmd_volume_set_usage ();
+ goto out;
+ }
+
+ if (proc->fn) {
+ ret = proc->fn (frame, THIS, options);
+ }
+
+out:
+ if (options)
+ dict_unref (options);
+
+ return ret;
+
}
void