summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2014-03-07 05:16:02 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-03-10 06:21:06 -0700
commit9fe1f24e42fa54b58616cd846fce76ab60d7e4e8 (patch)
treeb1089265bb7dfea9c03351a419ac05d0c7a01b22 /cli
parent3a7fdc198ada9621333b560c8911a05844413751 (diff)
glusterd/snapshot : Introduced a macro for snapshot info command.
Also populated the error message in case of snapshot create, list, info and delete failure. When snapshot list, info or delete is issued, if the entered snapname/volname does not exist then populate error string along with logging. Change-Id: I632d25110bc63ff0e4ac98b27e2f410f7ccbb990 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/7203 Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c12
-rw-r--r--cli/src/cli-rpc-ops.c8
2 files changed, 19 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index adfb85e..2ad5d43 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -2780,7 +2780,7 @@ cli_snap_create_desc_parse (dict_t *dict, const char **words,
desc[desc_len] = '\0';
/* Calculating the size of the description as given by the user */
- ret = dict_set_dynstr (dict, "snap-description", desc);
+ ret = dict_set_dynstr (dict, "description", desc);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Unable to save snap "
"description");
@@ -3008,6 +3008,7 @@ cli_snap_info_parse (dict_t *dict, const char **words, int wordcount,
unsigned int cmdi) {
int ret = -1;
+ int32_t cmd = GF_SNAP_INFO_TYPE_ALL;
GF_ASSERT (words);
GF_ASSERT (dict);
@@ -3044,6 +3045,7 @@ cli_snap_info_parse (dict_t *dict, const char **words, int wordcount,
goto out;
}
+ cmd = GF_SNAP_INFO_TYPE_SNAP;
ret = 0;
goto out;
/* No need to continue the parsing once we
@@ -3067,7 +3069,15 @@ cli_snap_info_parse (dict_t *dict, const char **words, int wordcount,
"volume name %s", words[wordcount - 1]);
goto out;
}
+ cmd = GF_SNAP_INFO_TYPE_VOL;
out :
+ if (ret == 0) {
+ ret = dict_set_int32 (dict, "cmd", cmd);
+ if (ret) {
+ gf_log ("cli", GF_LOG_ERROR, "Could not save "
+ "type of snapshot info");
+ }
+ }
return ret;
}
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 0447e5b..60abfc1 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -8147,6 +8147,14 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
break;
case GF_SNAP_OPTION_TYPE_LIST:
+ if (rsp.op_ret) {
+ cli_err ("Snapshot list : failed: %s",
+ rsp.op_errstr ? rsp.op_errstr :
+ "Please check log file for details");
+ ret = rsp.op_ret;
+ goto out;
+ }
+
ret = cli_snapshot_list (dict);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Failed to display "