summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c27
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c4
2 files changed, 23 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 8fe0b31a6cb..80ca1f32551 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -298,8 +298,11 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
dict_t *volumes, int count)
{
- int ret = -1;
- char key[256] = {0, };
+ int ret = -1;
+ char key[256] = {0, };
+ glusterd_brickinfo_t *brickinfo = NULL;
+ char *buf = NULL;
+ int i = 1;
GF_ASSERT (volinfo);
GF_ASSERT (volumes);
@@ -324,6 +327,17 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
if (ret)
goto out;
+ list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ char brick[1024] = {0,};
+ snprintf (key, 256, "volume%d.brick%d", count, i);
+ snprintf (brick, 1024, "%s:%s", brickinfo->hostname,
+ brickinfo->path);
+ buf = gf_strdup (brick);
+ ret = dict_set_dynstr (volumes, key, buf);
+ if (ret)
+ goto out;
+ i++;
+ }
out:
return ret;
}
@@ -1753,16 +1767,17 @@ glusterd_get_volumes (rpcsvc_request_t *req, dict_t *dict, int32_t flags)
ret = 0;
out:
- if (ret) {
- if (volumes)
- dict_destroy (volumes);
- }
rsp.op_ret = ret;
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
gf_xdr_serialize_cli_peer_list_rsp);
+ if (volumes)
+ dict_destroy (volumes);
+
+ if (rsp.volumes.volumes_val)
+ GF_FREE (rsp.volumes.volumes_val);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 1a954cce2e8..8016f93db2c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2025,9 +2025,9 @@ glusterd_op_clear_ctx (glusterd_op_t op)
ctx = opinfo.op_ctx[op];
- if (ctx)
- GF_FREE (ctx);
+ opinfo.op_ctx[op] = NULL;
+ //Cleanup to be done here
return 0;
}