a3470f
From 0652899ce703542fc7fd676f3fd80748395d7094 Mon Sep 17 00:00:00 2001
a3470f
From: Sanoj Unnikrishnan <sunnikri@redhat.com>
a3470f
Date: Wed, 9 May 2018 13:43:48 +0530
a3470f
Subject: [PATCH 259/260] Quota: Turn on ssl for crawler clients if needed
a3470f
a3470f
Problem: Quota uses per brick client generated by
a3470f
glusterd_generate_client_per_brick_volfile to crawl the
a3470f
individual bricks. These clients were not being configured
a3470f
with ssl if volume has client.ssl turned on.
a3470f
a3470f
Solution: turn on client.ssl if the volume has client.ssl
a3470f
option set to on.
a3470f
a3470f
Upstream Reference:
a3470f
> Change-Id: Id3a13d5110c4376d734480c42da1ce6844cc8240
a3470f
> fixes: bz#1575858
a3470f
> Reviewed on: https://review.gluster.org/#/c/19978/
a3470f
a3470f
BUG: 1557551
a3470f
Change-Id: Id3a13d5110c4376d734480c42da1ce6844cc8240
a3470f
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/138158
a3470f
Reviewed-by: Hari Gowtham Gopal <hgowtham@redhat.com>
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
a3470f
---
a3470f
 xlators/mgmt/glusterd/src/glusterd-volgen.c | 21 ++++++++++++++++++++-
a3470f
 1 file changed, 20 insertions(+), 1 deletion(-)
a3470f
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
a3470f
index 3926bd3..3d8ad77 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
a3470f
@@ -5726,6 +5726,8 @@ glusterd_generate_client_per_brick_volfile (glusterd_volinfo_t *volinfo)
a3470f
         dict_t                *dict                 = NULL;
a3470f
         xlator_t              *xl                   = NULL;
a3470f
         int                    ret                  = -1;
a3470f
+        char                  *ssl_str              = NULL;
a3470f
+        gf_boolean_t           ssl_bool             = _gf_false;
a3470f
 
a3470f
         dict = dict_new ();
a3470f
         if (!dict)
a3470f
@@ -5733,7 +5735,22 @@ glusterd_generate_client_per_brick_volfile (glusterd_volinfo_t *volinfo)
a3470f
 
a3470f
         ret = dict_set_uint32 (dict, "trusted-client", GF_CLIENT_TRUSTED);
a3470f
         if (ret)
a3470f
-                goto out;
a3470f
+                goto free_dict;
a3470f
+
a3470f
+        if (dict_get_str(volinfo->dict, "client.ssl", &ssl_str) == 0) {
a3470f
+                if (gf_string2boolean(ssl_str, &ssl_bool) == 0) {
a3470f
+                        if (ssl_bool) {
a3470f
+                               if (dict_set_dynstr_with_alloc(dict,
a3470f
+                                                "client.ssl", "on") != 0) {
a3470f
+                                        ret = -1;
a3470f
+                                        goto free_dict;
a3470f
+                                }
a3470f
+                        }
a3470f
+                } else {
a3470f
+                        ret = -1;
a3470f
+                        goto free_dict;
a3470f
+                }
a3470f
+        }
a3470f
 
a3470f
         cds_list_for_each_entry (brick, &volinfo->bricks, brick_list) {
a3470f
                 xl = volgen_graph_build_client (&graph, volinfo,
a3470f
@@ -5760,6 +5777,8 @@ out:
a3470f
         if (ret)
a3470f
                 volgen_graph_free (&graph);
a3470f
 
a3470f
+free_dict:
a3470f
+
a3470f
         if (dict)
a3470f
                 dict_unref (dict);
a3470f
 
a3470f
-- 
a3470f
1.8.3.1
a3470f