7f4c2a
From 6c2db235183b1d1840dc94e9b47e98ebde422e0e Mon Sep 17 00:00:00 2001
7f4c2a
From: Nithya Balachandran <nbalacha@redhat.com>
7f4c2a
Date: Mon, 17 Aug 2015 14:18:43 +0530
7f4c2a
Subject: [PATCH 273/279] glusterd/rebalance: trusted rebalance volfile
7f4c2a
7f4c2a
Creating the client volfiles with GF_CLIENT_OTHER
7f4c2a
overwrites the trusted rebalance volfile and causes rebalance
7f4c2a
to fail if auth.allow is set.
7f4c2a
Now, we always set the value of trusted-client to GF_CLIENT_TRUSTED
7f4c2a
for rebalance volfiles.
7f4c2a
7f4c2a
backport: http://review.gluster.org/11819
7f4c2a
7f4c2a
Change-Id: I0c68937213f6d2bfe7221e0fb1210555226009b0
7f4c2a
BUG: 1213893
7f4c2a
Signed-off-by: Nithya Balachandran <nbalacha@redhat.com>
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/55319
7f4c2a
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
7f4c2a
Tested-by: Atin Mukherjee <amukherj@redhat.com>
7f4c2a
---
7f4c2a
 xlators/mgmt/glusterd/src/glusterd-volgen.c |   16 +++++++++-------
7f4c2a
 1 files changed, 9 insertions(+), 7 deletions(-)
7f4c2a
7f4c2a
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
7f4c2a
index 3d04e9f..d784d17 100644
7f4c2a
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
7f4c2a
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
7f4c2a
@@ -4224,16 +4224,19 @@ build_rebalance_volfile (glusterd_volinfo_t *volinfo, char *filepath,
7f4c2a
                 return 0;
7f4c2a
         }
7f4c2a
 
7f4c2a
+        set_dict = dict_copy (volinfo->dict, NULL);
7f4c2a
+        if (!set_dict)
7f4c2a
+                return -1;
7f4c2a
+
7f4c2a
         if (mod_dict) {
7f4c2a
-                set_dict = dict_copy (volinfo->dict, NULL);
7f4c2a
-                if (!set_dict)
7f4c2a
-                        return -1;
7f4c2a
                  dict_copy (mod_dict, set_dict);
7f4c2a
                  /* XXX dict_copy swallows errors */
7f4c2a
-        } else {
7f4c2a
-                set_dict = volinfo->dict;
7f4c2a
         }
7f4c2a
 
7f4c2a
+        /* Rebalance is always a trusted client*/
7f4c2a
+        ret = dict_set_uint32 (set_dict, "trusted-client", GF_CLIENT_TRUSTED);
7f4c2a
+        if (ret)
7f4c2a
+                return -1;
7f4c2a
 
7f4c2a
         ret = volgen_graph_build_clients (&graph, volinfo, set_dict, NULL);
7f4c2a
         if (volinfo->type == GF_CLUSTER_TYPE_TIER)
7f4c2a
@@ -4263,8 +4266,7 @@ build_rebalance_volfile (glusterd_volinfo_t *volinfo, char *filepath,
7f4c2a
 out:
7f4c2a
         volgen_graph_free (&graph);
7f4c2a
 
7f4c2a
-        if (mod_dict)
7f4c2a
-                dict_destroy (set_dict);
7f4c2a
+        dict_destroy (set_dict);
7f4c2a
 
7f4c2a
 
7f4c2a
         return ret;
7f4c2a
-- 
7f4c2a
1.7.1
7f4c2a