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.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 830bd76..1a90e19 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -7838,6 +7838,63 @@ out :
return ret;
}
+int32_t
+cli_snapshot_remove_reply (gf_cli_rsp *rsp, dict_t *dict, call_frame_t *frame)
+{
+ int32_t ret = -1;
+ char *snap_name = NULL;
+ char *cg_name = NULL;
+ int64_t volcount = -1;
+ char *volname = NULL;
+ gf_boolean_t is_cg = _gf_false;
+
+ GF_ASSERT (rsp);
+ GF_ASSERT (dict);
+ GF_ASSERT (frame);
+
+ if (rsp->op_ret) {
+ cli_err("snapshot remove: failed: %s",
+ rsp->op_errstr ? rsp->op_errstr :
+ "Please check log file for details");
+ ret = rsp->op_ret;
+ goto out;
+ }
+
+ ret = dict_get_int64 (dict, "volcount", &volcount);
+ if (!ret) {
+ if (volcount == 1) {
+ ret = dict_get_str (dict, "volname1", &volname);
+ if (ret)
+ gf_log ("", GF_LOG_WARNING, "getting volume name"
+ " failed");
+ } else
+ is_cg = _gf_true;
+ }
+
+ if (is_cg) {
+ if (dict_get_str (dict, "cgname",
+ &cg_name) != 0)
+ cg_name = "???";
+
+ cli_out ("snapshot delete: %s: consistency "
+ "group removed successfully",
+ cg_name);
+ } else {
+ if (dict_get_str (dict, "snapname",
+ &snap_name) != 0)
+ snap_name = "???";
+
+ cli_out ("snapshot delete: %s: "
+ "snap removed successfully",
+ snap_name);
+ }
+
+ ret = 0;
+
+out:
+ return ret;
+}
+
int
gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
int count, void *myframe)
@@ -8045,6 +8102,10 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
}
break;
+ case GF_SNAP_OPTION_TYPE_DELETE:
+ ret = cli_snapshot_remove_reply (&rsp, dict, frame);
+ break;
+
default:
cli_err ("Unknown command executed");
ret = -1;