summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-01-02 06:52:08 +0000
committerAvra Sengupta <asengupt@redhat.com>2014-01-09 01:00:31 +0000
commit847e14ccbaddd5d1f06f9200cba063ee007199ad (patch)
tree36670d1337f2c0412fe6685335fb7a057f955837
parentade2e39f33c833dcf9811f46fca4c6f443b0f09b (diff)
glusterd: Pass generated snap-name/cg-name to cli.
Also block operation on response aggregation errors. Change-Id: I641ddc98d986fd44627d790ab84488a6b849f807 BUG: 1043792 Signed-off-by: Avra Sengupta <asengupt@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c35
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c27
2 files changed, 53 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index 852d60f..424bcca 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -448,12 +448,20 @@ gd_mgmt_v3_pre_validate_cbk_fn (struct rpc_req *req, struct iovec *iov,
}
pthread_mutex_unlock (&args->lock_dict);
- if (ret)
+ if (ret) {
gf_log ("", GF_LOG_ERROR, "%s",
"Failed to aggregate response from "
" node/brick");
- op_ret = rsp.op_ret;
- op_errno = rsp.op_errno;
+ if (!rsp.op_ret)
+ op_ret = ret;
+ else {
+ op_ret = rsp.op_ret;
+ op_errno = rsp.op_errno;
+ }
+ } else {
+ op_ret = rsp.op_ret;
+ op_errno = rsp.op_errno;
+ }
out:
if (rsp_dict)
dict_unref (rsp_dict);
@@ -852,15 +860,24 @@ gd_mgmt_v3_commit_cbk_fn (struct rpc_req *req, struct iovec *iov,
{
ret = glusterd_syncop_aggr_rsp_dict (rsp.op, args->dict,
rsp_dict);
- if (ret)
- gf_log ("", GF_LOG_ERROR, "%s",
- "Failed to aggregate response from "
- " node/brick");
}
pthread_mutex_unlock (&args->lock_dict);
- op_ret = rsp.op_ret;
- op_errno = rsp.op_errno;
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "%s",
+ "Failed to aggregate response from "
+ " node/brick");
+ if (!rsp.op_ret)
+ op_ret = ret;
+ else {
+ op_ret = rsp.op_ret;
+ op_errno = rsp.op_errno;
+ }
+ } else {
+ op_ret = rsp.op_ret;
+ op_errno = rsp.op_errno;
+ }
+
out:
gd_mgmt_v3_collate_errors (args, op_ret, op_errno, NULL,
GLUSTERD_MGMT_V3_COMMIT,
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 1f69307..8386b44 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -3999,13 +3999,40 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
gf_log (this->name, GF_LOG_ERROR, "Unable to fetch snap-name");
goto out;
}
+ tmp = gf_strdup (name);
+ if (!tmp) {
+ gf_log (this->name, GF_LOG_ERROR, "Out of memory");
+ goto out;
+ }
+
+ ret = dict_set_dynstr (rsp_dict, "snap-name", tmp);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to set snap-name in rsp_dict");
+ GF_FREE (tmp);
+ goto out;
+ }
} else {
ret = dict_get_str (dict, "cg-name", &name);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Unable to fetch cg-name");
goto out;
}
+ tmp = gf_strdup (name);
+ if (!tmp) {
+ gf_log (this->name, GF_LOG_ERROR, "Out of memory");
+ goto out;
+ }
+
+ ret = dict_set_str (rsp_dict, "cg-name", tmp);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to set cg-name in rsp_dict");
+ GF_FREE (tmp);
+ goto out;
+ }
}
+ tmp = NULL;
ret = dict_get_bin (dict, "cg-id", (void **)&cg_id);
if (ret)