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