diff options
| author | Raghavendra Bhat <raghavendra@redhat.com> | 2013-10-24 18:55:27 +0530 |
|---|---|---|
| committer | Raghavendra Bhat <raghavendra@redhat.com> | 2013-10-29 18:27:04 +0530 |
| commit | 07422ad21fd23db212f83777b1022350c5560876 (patch) | |
| tree | e10ac187da02ef24b073f63a472909dcd00cd49c /xlators/mgmt/glusterd/src/glusterd-jarvis.c | |
| parent | 5ce3051ca7bfb86e8ab1784c85d4064d5042c491 (diff) | |
mgmt/glusterd: changes to create consistency group out of volumes
* Also send the proper error back to cli incase of any failure
* Before taking the snap check whether a snap with the requested name
already exists.
Change-Id: I0830b31b1f095dd1d3d968c4f8b3cf46dc32d259
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-jarvis.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-jarvis.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-jarvis.c b/xlators/mgmt/glusterd/src/glusterd-jarvis.c index 40fb74c03..57512636d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-jarvis.c +++ b/xlators/mgmt/glusterd/src/glusterd-jarvis.c @@ -1375,6 +1375,7 @@ glusterd_jarvis_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); @@ -1456,6 +1457,13 @@ glusterd_jarvis_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; } @@ -1469,6 +1477,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 */ @@ -1486,6 +1495,22 @@ out: (void) glusterd_jarvis_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); |
