summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-08-16 13:10:41 +0530
committerAnand Avati <avati@gluster.com>2011-08-18 22:42:48 -0700
commitce0aaba383b97dca52d11c18846a8154d529bf8a (patch)
tree494673947140ddded481e4532ce6c340eac09446 /cli/src
parentb7596882b3ceba77bd812d2e5757d9fa3aa0fa17 (diff)
mgmt/Glusterd: Implementation volume set help/help-xml
Change-Id: I0c54fd1c15550e5e5551e95ed32adb14d8029fab Reviewed-on: http://review.gluster.com/238 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c10
-rw-r--r--cli/src/cli-rpc-ops.c19
2 files changed, 27 insertions, 2 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index a005c8f88a3..346baeed87d 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -570,7 +570,7 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options)
if (!dict)
goto out;
- if (wordcount < 4)
+ if (wordcount < 3)
goto out;
volname = (char *)words[2];
@@ -582,6 +582,14 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options)
if (ret)
goto out;
+ if (!strcmp (volname, "help") && !words[3] && !words[4])
+ ret = dict_set_str (dict, "help", volname);
+
+ if (!strcmp (volname, "help-xml") && !words[3] && !words[4])
+ ret = dict_set_str (dict, "help-xml", volname);
+
+ if (ret)
+ goto out;
for (i = 3; i < wordcount; i+=2) {
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index b15cc4b2e59..61e1dcef273 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -963,6 +963,8 @@ gf_cli3_1_set_volume_cbk (struct rpc_req *req, struct iovec *iov,
{
gf1_cli_set_vol_rsp rsp = {0,};
int ret = 0;
+ dict_t *dict = NULL;
+ char *help_str = NULL;
if (-1 == req->rpc_status) {
goto out;
@@ -978,9 +980,24 @@ gf_cli3_1_set_volume_cbk (struct rpc_req *req, struct iovec *iov,
if (rsp.op_ret && strcmp (rsp.op_errstr, ""))
cli_out ("%s", rsp.op_errstr);
- else
+
+ dict = dict_new ();
+
+ if (!dict) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = dict_unserialize (rsp.dict.dict_val, rsp.dict.dict_len, &dict);
+
+ if (ret)
+ goto out;
+
+ if (dict_get_str (dict, "help-str", &help_str))
cli_out ("Set volume %s", (rsp.op_ret) ? "unsuccessful":
"successful");
+ else
+ cli_out ("%s", help_str);
ret = rsp.op_ret;