From 260a6943849f99227248a8fc852a8c8fc3d1e289 Mon Sep 17 00:00:00 2001 From: Mohammed Rafi KC Date: Mon, 23 Feb 2015 17:28:47 +0530 Subject: Snapshot/clone: clone of a snapshot that will act as a regular volume snapshot clone will allow us to take a snpahot of a snapshot. Newly created clone volume will be a regular volume with read/write permissions. CLI command snapshot clone Change-Id: Icadb993fa42fff787a330f8f49452da54e9db7de BUG: 1199894 Signed-off-by: Mohammed Rafi KC Reviewed-on: http://review.gluster.org/9750 Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Vijay Bellur --- cli/src/cli-rpc-ops.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'cli/src/cli-rpc-ops.c') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 8ea43f824bc..a02761d5e6e 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -8870,6 +8870,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 *clone_name = NULL; int32_t type = 0; call_frame_t *frame = NULL; gf_boolean_t snap_driven = _gf_false; @@ -8961,6 +8962,35 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov, ret = 0; break; + case GF_SNAP_OPTION_TYPE_CLONE: + if (rsp.op_ret) { + cli_err("snapshot clone: failed: %s", + rsp.op_errstr ? rsp.op_errstr : + "Please check log file for details"); + ret = rsp.op_ret; + goto out; + } + + ret = dict_get_str (dict, "clonename", &clone_name); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, + "Failed to get clone name"); + goto out; + } + + ret = dict_get_str (dict, "snapname", &snap_name); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, + "Failed to get snapname name"); + goto out; + } + + cli_out ("snapshot clone: success: Clone %s created " + "successfully", clone_name); + + ret = 0; + 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 -- cgit