Patchwork [v2,BUG:1750,2/4] volgen: fix up replace-brick + pump generation

login
register
Submitter Csaba Henk
Date 2010-10-03 00:14:14
Message ID <1286064856-4044-2-git-send-email-csaba@gluster.com>
Download mbox | patch
Permalink /patch/5202/
State Accepted
Headers show

Comments

Csaba Henk - 2010-10-03 00:14:14
Signed-off-by: Csaba Henk <csaba@gluster.com>
---
 xlators/mgmt/glusterd/src/glusterd-volgen.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 9ef9a73..59f20a8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -533,6 +533,7 @@  server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
         int       pump = 0;
         xlator_t *xl = NULL;
         xlator_t *txl = NULL;
+        xlator_t *rbxl = NULL;
         char     *aaa = NULL;
         int       ret = 0;
         char      transt[16] = {0,};
@@ -559,28 +560,33 @@  server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
 
         ret = dict_get_int32 (volinfo->dict, "enable-pump", &pump);
         if (ret == -ENOENT)
-                pump = 0;
+                ret = pump = 0;
+        if (ret)
+                return -1;
         if (pump) {
                 txl = first_of (graph);
 
-                xl = volgen_graph_add_as (graph, "protocol/client", "%s-%s",
-                                          volname, "replace-brick");
-                if (!xl)
+                rbxl = volgen_graph_add_nolink (graph, "protocol/client",
+                                                "%s-replace-brick", volname);
+                if (!rbxl)
                         return -1;
-                ret = xlator_set_option (xl, "transport-type", transt);
+                ret = xlator_set_option (rbxl, "transport-type", transt);
                 if (ret)
                         return -1;
-                ret = xlator_set_option (xl, "remote-port", "34034");
+                ret = xlator_set_option (rbxl, "remote-port", "34034");
                 if (ret)
                         return -1;
 
-                xl = volgen_graph_add (graph, "cluster/pump", volname);
+                xl = volgen_graph_add_nolink (graph, "cluster/pump", "%s-pump",
+                                              volname);
                 if (!xl)
                         return -1;
-
                 ret = volgen_xlator_link (xl, txl);
                 if (ret)
                         return -1;
+                ret = volgen_xlator_link (xl, rbxl);
+                if (ret)
+                        return -1;
         }
 
         xl = volgen_graph_add (graph, "performance/io-threads", volname);