summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2013-11-19 04:48:37 +0000
committerAvra Sengupta <asengupt@redhat.com>2013-11-20 01:51:23 +0000
commitce5e67d497c036ffd0dd89a6ad2245a19ba47694 (patch)
treee55fc63bb7a135b437241db105826f83ca9dbe61
parentde39983493ce747c6696f1523db59bb67865b22a (diff)
glusterd/snapshot: Added trace statements and handled snapshot create commit failure.
Also handles empty string(not NULL) in gd_syncop_mgmt_brick_op() and adds "Snapshot" in operation list used for printing op during logging. Change-Id: Icac9dce6bf1c087ab2aace9953e2af3a0fb81be6 Signed-off-by: Avra Sengupta <asengupt@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c24
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c22
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c10
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c1
7 files changed, 56 insertions, 30 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
index 63bbc66..236d9b7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
@@ -88,7 +88,7 @@ glusterd_syctasked_volume_lock (rpcsvc_request_t *req,
out:
glusterd_mgmt_v3_vol_lock_send_resp (req, ret);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -126,7 +126,7 @@ out:
glusterd_friend_sm ();
glusterd_op_sm ();
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -202,7 +202,7 @@ out:
GF_FREE (ctx);
}
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -326,7 +326,7 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -450,7 +450,7 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -573,7 +573,7 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -698,7 +698,7 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -764,7 +764,7 @@ glusterd_syctasked_volume_unlock (rpcsvc_request_t *req,
out:
glusterd_mgmt_v3_vol_unlock_send_resp (req, ret);
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -790,7 +790,7 @@ glusterd_op_state_machine_volume_unlock (rpcsvc_request_t *req,
glusterd_friend_sm ();
glusterd_op_sm ();
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -866,7 +866,7 @@ out:
GF_FREE (ctx);
}
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index 1faafc5..066b1de 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -303,7 +303,7 @@ gd_mgmt_v3_vol_lock (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_vol_lock_req);
synclock_lock (&conf->big_lock);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -476,7 +476,7 @@ gd_mgmt_v3_pre_validate (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_pre_val_req);
synclock_lock (&conf->big_lock);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -516,7 +516,8 @@ glusterd_mgmt_v3_pre_validate (glusterd_conf_t *conf, glusterd_op_t op,
if (*op_errstr == NULL) {
ret = gf_asprintf (op_errstr,
"Pre-validation failed "
- "on localhost");
+ "on localhost. Please "
+ "check log file for details");
if (ret == -1)
*op_errstr = NULL;
@@ -676,7 +677,7 @@ gd_mgmt_v3_brick_op (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_brick_op_req);
synclock_lock (&conf->big_lock);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -716,7 +717,8 @@ glusterd_mgmt_v3_brick_op (glusterd_conf_t *conf, glusterd_op_t op,
if (*op_errstr == NULL) {
ret = gf_asprintf (op_errstr,
"Brick ops failed "
- "on localhost");
+ "on localhost. Please "
+ "check log file for details");
if (ret == -1)
*op_errstr = NULL;
@@ -869,7 +871,7 @@ gd_mgmt_v3_commit (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_commit_req);
synclock_lock (&conf->big_lock);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -910,7 +912,8 @@ glusterd_mgmt_v3_commit (glusterd_conf_t *conf, glusterd_op_t op,
if (*op_errstr == NULL) {
ret = gf_asprintf (op_errstr,
"Commit failed "
- "on localhost");
+ "on localhost. Please "
+ "check log file for details.");
if (ret == -1)
*op_errstr = NULL;
@@ -1046,7 +1049,7 @@ gd_mgmt_v3_post_validate (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_post_val_req);
synclock_lock (&conf->big_lock);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -1086,7 +1089,8 @@ glusterd_mgmt_v3_post_validate (glusterd_conf_t *conf, glusterd_op_t op,
if (*op_errstr == NULL) {
ret = gf_asprintf (op_errstr,
"Post-validation failed "
- "on localhost");
+ "on localhost. Please check "
+ "log file for details");
if (ret == -1)
*op_errstr = NULL;
@@ -1213,7 +1217,7 @@ gd_mgmt_v3_vol_unlock (glusterd_op_t op, dict_t *op_ctx,
(xdrproc_t) xdr_gd1_mgmt_v3_vol_unlock_req);
synclock_lock (&conf->big_lock);
out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index be910f7..8309038 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -715,6 +715,7 @@ glusterd_add_snap (glusterd_volinfo_t *volinfo, glusterd_snap_t *snap)
unlock:
UNLOCK (&volinfo->lock);
out:
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -876,12 +877,13 @@ glusterd_add_snap_cg (glusterd_conf_t *conf, glusterd_snap_cg_t *cg)
last = entry;
}
list_add_tail (&cg->cg_list, &conf->snap_cg);
+
gf_log (THIS->name, GF_LOG_DEBUG, "Added CG %s (%s) @ %"PRIu64,
cg->cg_name, uuid_utoa(cg->cg_id), count);
ret = 0;
out:
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
-
}
glusterd_snap_cg_t*
@@ -2276,7 +2278,6 @@ glusterd_snap_create (glusterd_volinfo_t *volinfo,
}
snap->snap_status = GD_SNAP_STATUS_IN_USE;
-
out:
if (ret) {
if (snap) {
@@ -2287,6 +2288,8 @@ out:
GF_FREE (snap);
}
}
+
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -2519,6 +2522,7 @@ glusterd_take_snapshot (glusterd_brickinfo_t *brickinfo, char *volname,
}
out:
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -2623,6 +2627,8 @@ out:
}
if (mtab)
endmntent (mtab);
+
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -2767,6 +2773,8 @@ glusterd_do_snap (glusterd_volinfo_t *volinfo, char *name, dict_t *dict,
out:
if (ret)
glusterd_volinfo_delete (snap_volume);
+
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -3029,6 +3037,7 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
}
}
out:
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -3180,7 +3189,7 @@ glusterd_snapshot_config_commit (dict_t *dict, char **op_errstr,
goto out;
}
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -3213,6 +3222,11 @@ glusterd_snapshot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
case (GF_SNAP_OPTION_TYPE_CREATE):
ret = glusterd_snapshot_create_commit (dict, op_errstr,
rsp_dict);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ "create snapshot");
+ goto out;
+ }
break;
case GF_SNAP_OPTION_TYPE_CONFIG:
@@ -3238,7 +3252,7 @@ glusterd_snapshot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
ret = 0;
out:
- gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 7ad63bd..8a673cc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1455,9 +1455,11 @@ out:
gf_store_unlink_tmppath (volinfo->snap_list_shandle);
if (fd > 0)
close (fd);
- gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
+
+ gf_log (THIS->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
+
int32_t
glusterd_store_perform_snap_store (glusterd_volinfo_t *volinfo)
{
@@ -1513,7 +1515,8 @@ out:
gf_store_unlink_tmppath (volinfo->snap_list_shandle);
if (fd > 0)
close (fd);
- gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
+
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 74ce06b..2b2a2ec 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -882,10 +882,12 @@ gd_syncop_mgmt_brick_op (struct rpc_clnt *rpc, glusterd_pending_node_t *pnode,
GD_SYNCOP (rpc, (&args), NULL, gd_syncop_brick_op_cbk, req,
&gd_brick_prog, req->op, xdr_gd1_mgmt_brick_op_req);
- if (args.errstr && errstr)
- *errstr = args.errstr;
- else
- GF_FREE (args.errstr);
+ if (args.errstr) {
+ if ((strlen(args.errstr) > 0) && errstr)
+ *errstr = args.errstr;
+ else
+ GF_FREE (args.errstr);
+ }
if (GD_OP_STATUS_VOLUME == op) {
ret = dict_set_int32 (args.dict, "index", pnode->index);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index fc32675..50beb23 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -3463,6 +3463,8 @@ generate_snap_client_volfiles (glusterd_volinfo_t *actual_volinfo,
out:
if (dict)
dict_unref (dict);
+
+ gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 60f6719..268acc7 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -110,6 +110,7 @@ const char *gd_op_list[GD_OP_MAX + 1] = {
[GD_OP_COPY_FILE] = "Copy File",
[GD_OP_SYS_EXEC] = "Execute system commands",
[GD_OP_GSYNC_CREATE] = "Geo-replication Create",
+ [GD_OP_SNAP] = "Snapshot",
[GD_OP_MAX] = "Invalid op"
};