summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-mgmt.c
diff options
context:
space:
mode:
authorRajesh Joseph <rjoseph@redhat.com>2013-10-30 10:50:45 +0530
committershishir gowda <sgowda@redhat.com>2013-11-15 14:45:13 +0530
commit944e5529078cff3fd0ecbc30f037eddcc9bb63ae (patch)
treeda5d6c2037fe555a25246b384cdc693589058381 /xlators/mgmt/glusterd/src/glusterd-mgmt.c
parente9b9b38caabe778fad4b6f2fd9ba9d8cc100c7df (diff)
snapshot: Snapshot restore
GL-31: Ability to restore snapshot Implemented snapshot restore for thin logical volume. As of now snapshot restore for CG is not tested. Testing for snapshot restore of a volume is done by changing the snapshot create process to create a thick snapshot. This is done because --merge option to restore thin volume is not working in the latest kernel. Change-Id: Ia3ded7e6c4da5957a74e269a25ba3200e6fb2d8b Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index e6f341ada..8e2c0c689 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -1389,6 +1389,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
gf_boolean_t is_acquired = _gf_false;
uuid_t *originator_uuid = NULL;
gf_boolean_t success = _gf_false;
+ char *tmp_errstr = NULL;
this = THIS;
GF_ASSERT (this);
@@ -1470,6 +1471,13 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
&op_errstr, npeers);
if (ret) {
gf_log ("", GF_LOG_ERROR, "Commit Op Failed");
+ /* If the main op fails, we should save the error string.
+ Because, op_errstr will be used for unbarrier and
+ unlock ops also. We might lose the actual error that
+ caused the failure.
+ */
+ tmp_errstr = op_errstr;
+ op_errstr = NULL;
goto unbarrier;
}
@@ -1483,6 +1491,7 @@ unbarrier:
&op_errstr, npeers);
if (ret || (success == _gf_false)) {
gf_log ("", GF_LOG_ERROR, "Brick Ops Failed");
+ ret = -1;
goto out;
}
/* POST-COMMIT VALIDATE PHASE */
@@ -1500,6 +1509,22 @@ out:
(void) glusterd_mgmt_v3_release_peer_locks (conf, op, dict, &op_errstr,
npeers, is_acquired);
+ /* If the commit op (snapshot taking) failed, then the error is stored
+ in tmp_errstr and unbarrier is called. Suppose, if unbarrier also
+ fails, then the error happened in unbarrier is logged and freed.
+ The error happened in commit op, which is stored in tmp_errstr
+ is sent to cli.
+ */
+ if (tmp_errstr) {
+ if (ret && op_errstr) {
+ gf_log (this->name, GF_LOG_ERROR, "unbarrier brick op"
+ "failed with the error %s", op_errstr);
+ GF_FREE (op_errstr);
+ op_errstr = NULL;
+ }
+ op_errstr = tmp_errstr;
+ }
+
/* SEND CLI RESPONSE */
glusterd_op_send_cli_response (op, ret, 0, req, dict, op_errstr);