summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-rpc-ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r--cli/src/cli-rpc-ops.c60
1 files changed, 20 insertions, 40 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index ee26e7d..0447e5b 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -8028,9 +8028,7 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
gf_cli_rsp rsp = {0, };
dict_t *dict = NULL;
char *snap_name = NULL;
- char *cg_name = NULL;
int32_t type = 0;
- int64_t volcount = -1;
call_frame_t *frame = NULL;
gf_boolean_t snap_driven = _gf_false;
@@ -8076,31 +8074,16 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- ret = dict_get_int64 (dict, "volcount", &volcount);
+ ret = dict_get_str (dict, "snapname", &snap_name);
if (ret) {
- gf_log (frame->this->name, GF_LOG_ERROR,
- "failed to get volcount");
+ gf_log ("cli", GF_LOG_ERROR,
+ "Failed to get snap name");
goto out;
}
-
- if (volcount > 1) {
- if (dict_get_str (dict, "cg-name",
- &cg_name) != 0)
- cg_name = "???";
-
- cli_out ("snapshot create: %s: consistency "
- "group created successfully",
- cg_name);
- } else {
- if (dict_get_str (dict, "snapname",
- &snap_name) != 0)
- snap_name = "???";
-
- cli_out ("snapshot create: %s: "
- "snap created successfully",
- snap_name);
- }
+ cli_out ("snapshot create: %s: snap created successfully",
+ snap_name);
break;
+
case GF_SNAP_OPTION_TYPE_RESTORE:
/* TODO: Check if rsp.op_ret needs to be checked here. Or is
* it ok to check this in the start of the function where we
@@ -8113,23 +8096,15 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- ret = dict_get_str (dict, "cgname", &cg_name);
+ ret = dict_get_str (dict, "snapname", &snap_name);
if (ret) {
- ret = dict_get_str (dict, "snapname", &snap_name);
- if (ret) {
- gf_log (frame->this->name, GF_LOG_ERROR,
- "Failed to get CG name or snap name");
- goto out;
- }
+ gf_log ("cli", GF_LOG_ERROR,
+ "Failed to get snap name");
+ goto out;
}
- if (NULL != snap_name) {
- cli_out ("Snapshot restore: %s: Snap restored "
+ cli_out ("Snapshot restore: %s: Snap restored "
"successfully", snap_name);
- } else {
- cli_out ("Snapshot restore: %s: Consistency group "
- "restored successfully", cg_name);
- }
ret = 0;
break;
@@ -8165,8 +8140,8 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
case GF_SNAP_OPTION_TYPE_CONFIG:
ret = cli_snapshot_config_display (dict, &rsp);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to display snapshot "
- "config output.");
+ gf_log ("cli", GF_LOG_ERROR, "Failed to display "
+ "snapshot config output.");
goto out;
}
break;
@@ -8174,14 +8149,19 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
case GF_SNAP_OPTION_TYPE_LIST:
ret = cli_snapshot_list (dict);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to display snapshot"
- " list");
+ gf_log ("cli", GF_LOG_ERROR, "Failed to display "
+ "snapshot list");
goto out;
}
break;
case GF_SNAP_OPTION_TYPE_DELETE:
ret = cli_snapshot_remove_reply (&rsp, dict, frame);
+ if (ret) {
+ gf_log ("cli", GF_LOG_ERROR,
+ "Failed to delete snap");
+ goto out;
+ }
break;
default: