summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rebalance.c
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2012-04-09 17:20:10 +0530
committerVijay Bellur <vijay@gluster.com>2012-04-13 00:24:09 -0700
commitecfe2d0a94dd6626e2e6c1e7707549adf550a5af (patch)
treeeb222f526d14e2b913d22c7470b2f330e59c2315 /xlators/mgmt/glusterd/src/glusterd-rebalance.c
parentd2a73be6d94d108673e3427e534c1abbe71ccbff (diff)
glusterd/rebalance: re-establish conn between rebalance process
Signed-off-by: shishir gowda <shishirng@gluster.com> Change-Id: Ib13b4b9beebf18632027e4dd7c68f627c311781c BUG: 810688 Reviewed-on: http://review.gluster.com/3110 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rebalance.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index b25fc598b1f..e8e75c24077 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -374,6 +374,46 @@ out:
return ret;
}
+
+int
+glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo,
+ glusterd_conf_t *priv, int cmd)
+{
+ dict_t *options = NULL;
+ char sockfile[PATH_MAX] = {0,};
+ int ret = -1;
+ glusterd_defrag_info_t *defrag = NULL;
+
+ if (!volinfo->defrag)
+ volinfo->defrag = GF_CALLOC (1, sizeof (glusterd_defrag_info_t),
+ gf_gld_mt_defrag_info);
+ if (!volinfo->defrag)
+ goto out;
+
+ defrag = volinfo->defrag;
+
+ defrag->cmd = cmd;
+
+ LOCK_INIT (&defrag->lock);
+
+ GLUSTERD_GET_DEFRAG_SOCK_FILE (sockfile, volinfo, priv);
+ ret = rpc_clnt_transport_unix_options_build (&options, sockfile);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_ERROR, "Unix options build failed");
+ goto out;
+ }
+
+ ret = glusterd_rpc_create (&defrag->rpc, options,
+ glusterd_defrag_notify, volinfo);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_ERROR, "RPC create failed");
+ goto out;
+ }
+ ret = 0;
+out:
+ return ret;
+}
+
int
glusterd_rebalance_cmd_validate (int cmd, char *volname,
glusterd_volinfo_t **volinfo,