diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-07-12 05:33:29 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-12 09:03:03 -0700 |
commit | 1d0cb953bb117689fb8381d65932ead486d13b05 (patch) | |
tree | 50e87fcca9bcbac92e116c53dd7bb918ee6b031c /cli/src | |
parent | f9e0638b7597f4b1a4245f63c94d3d6bd3158136 (diff) |
mgmt/Glusterd: Implementation volume set help/help-xml
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2041 (volume set help option)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2041
Diffstat (limited to 'cli/src')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 8 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 19 |
2 files changed, 25 insertions, 2 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 2c1897550ec..a8aebaeb03c 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -657,7 +657,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]; @@ -666,6 +666,12 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options) ret = dict_set_str (dict, "volname", volname); + 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; diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 5b1f7f62993..92e5a32cc44 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -984,6 +984,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; @@ -999,9 +1001,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 (help_str); ret = rsp.op_ret; |