Blob Blame History Raw
From 0652899ce703542fc7fd676f3fd80748395d7094 Mon Sep 17 00:00:00 2001
From: Sanoj Unnikrishnan <sunnikri@redhat.com>
Date: Wed, 9 May 2018 13:43:48 +0530
Subject: [PATCH 259/260] Quota: Turn on ssl for crawler clients if needed

Problem: Quota uses per brick client generated by
glusterd_generate_client_per_brick_volfile to crawl the
individual bricks. These clients were not being configured
with ssl if volume has client.ssl turned on.

Solution: turn on client.ssl if the volume has client.ssl
option set to on.

Upstream Reference:
> Change-Id: Id3a13d5110c4376d734480c42da1ce6844cc8240
> fixes: bz#1575858
> Reviewed on: https://review.gluster.org/#/c/19978/

BUG: 1557551
Change-Id: Id3a13d5110c4376d734480c42da1ce6844cc8240
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/138158
Reviewed-by: Hari Gowtham Gopal <hgowtham@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-volgen.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 3926bd3..3d8ad77 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -5726,6 +5726,8 @@ glusterd_generate_client_per_brick_volfile (glusterd_volinfo_t *volinfo)
         dict_t                *dict                 = NULL;
         xlator_t              *xl                   = NULL;
         int                    ret                  = -1;
+        char                  *ssl_str              = NULL;
+        gf_boolean_t           ssl_bool             = _gf_false;
 
         dict = dict_new ();
         if (!dict)
@@ -5733,7 +5735,22 @@ glusterd_generate_client_per_brick_volfile (glusterd_volinfo_t *volinfo)
 
         ret = dict_set_uint32 (dict, "trusted-client", GF_CLIENT_TRUSTED);
         if (ret)
-                goto out;
+                goto free_dict;
+
+        if (dict_get_str(volinfo->dict, "client.ssl", &ssl_str) == 0) {
+                if (gf_string2boolean(ssl_str, &ssl_bool) == 0) {
+                        if (ssl_bool) {
+                               if (dict_set_dynstr_with_alloc(dict,
+                                                "client.ssl", "on") != 0) {
+                                        ret = -1;
+                                        goto free_dict;
+                                }
+                        }
+                } else {
+                        ret = -1;
+                        goto free_dict;
+                }
+        }
 
         cds_list_for_each_entry (brick, &volinfo->bricks, brick_list) {
                 xl = volgen_graph_build_client (&graph, volinfo,
@@ -5760,6 +5777,8 @@ out:
         if (ret)
                 volgen_graph_free (&graph);
 
+free_dict:
+
         if (dict)
                 dict_unref (dict);
 
-- 
1.8.3.1