a3470f
From ab7ff0b569aea5284108fc07dce78f30ac342b1d Mon Sep 17 00:00:00 2001
a3470f
From: Atin Mukherjee <amukherj@redhat.com>
a3470f
Date: Tue, 23 Jan 2018 08:23:11 +0530
a3470f
Subject: [PATCH 172/180] glusterd: add profile_enabled flag in get-state
a3470f
a3470f
>upstream mainline patch : https://review.gluster.org/#/c/19286
a3470f
a3470f
Change-Id: I09f348ed7ae6cd481f8c4d8b4f65f2f2f6aad84e
a3470f
BUG: 1537357
a3470f
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/131835
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
---
a3470f
 xlators/mgmt/glusterd/src/glusterd-handler.c |  2 ++
a3470f
 xlators/mgmt/glusterd/src/glusterd-op-sm.c   | 22 ----------------------
a3470f
 xlators/mgmt/glusterd/src/glusterd-utils.c   | 22 ++++++++++++++++++++++
a3470f
 xlators/mgmt/glusterd/src/glusterd-utils.h   |  3 +++
a3470f
 4 files changed, 27 insertions(+), 22 deletions(-)
a3470f
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
a3470f
index a3e1fdc..8fc665d 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
a3470f
@@ -5650,6 +5650,8 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
a3470f
                 fprintf (fp, "Volume%d.transport_type: %s\n", count,
a3470f
                          transport_type_str);
a3470f
                 fprintf (fp, "Volume%d.status: %s\n", count, vol_status_str);
a3470f
+                fprintf (fp, "Volume%d.profile_enabled: %d\n", count,
a3470f
+                         glusterd_is_profile_on (volinfo));
a3470f
                 fprintf (fp, "Volume%d.brickcount: %d\n", count,
a3470f
                          volinfo->brick_count);
a3470f
 
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
a3470f
index 81cde21..0cf76dd 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
a3470f
@@ -1978,28 +1978,6 @@ glusterd_op_stage_status_volume (dict_t *dict, char **op_errstr)
a3470f
         return ret;
a3470f
 }
a3470f
 
a3470f
-
a3470f
-static gf_boolean_t
a3470f
-glusterd_is_profile_on (glusterd_volinfo_t *volinfo)
a3470f
-{
a3470f
-        int                                     ret = -1;
a3470f
-        gf_boolean_t                            is_latency_on = _gf_false;
a3470f
-        gf_boolean_t                            is_fd_stats_on = _gf_false;
a3470f
-
a3470f
-        GF_ASSERT (volinfo);
a3470f
-
a3470f
-        ret = glusterd_volinfo_get_boolean (volinfo, VKEY_DIAG_CNT_FOP_HITS);
a3470f
-        if (ret != -1)
a3470f
-                is_fd_stats_on = ret;
a3470f
-        ret = glusterd_volinfo_get_boolean (volinfo, VKEY_DIAG_LAT_MEASUREMENT);
a3470f
-        if (ret != -1)
a3470f
-                is_latency_on = ret;
a3470f
-        if ((_gf_true == is_latency_on) &&
a3470f
-            (_gf_true == is_fd_stats_on))
a3470f
-                return _gf_true;
a3470f
-        return _gf_false;
a3470f
-}
a3470f
-
a3470f
 static int
a3470f
 glusterd_op_stage_stats_volume (dict_t *dict, char **op_errstr)
a3470f
 {
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
a3470f
index 9ccd718..9a67cfd 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
a3470f
@@ -13988,3 +13988,25 @@ gd_rb_op_to_str (char *op)
a3470f
                 return "replace-brick commit force";
a3470f
         return NULL;
a3470f
 }
a3470f
+
a3470f
+gf_boolean_t
a3470f
+glusterd_is_profile_on (glusterd_volinfo_t *volinfo)
a3470f
+{
a3470f
+        int                                     ret = -1;
a3470f
+        gf_boolean_t                            is_latency_on = _gf_false;
a3470f
+        gf_boolean_t                            is_fd_stats_on = _gf_false;
a3470f
+
a3470f
+        GF_ASSERT (volinfo);
a3470f
+
a3470f
+        ret = glusterd_volinfo_get_boolean (volinfo, VKEY_DIAG_CNT_FOP_HITS);
a3470f
+        if (ret != -1)
a3470f
+                is_fd_stats_on = ret;
a3470f
+        ret = glusterd_volinfo_get_boolean (volinfo, VKEY_DIAG_LAT_MEASUREMENT);
a3470f
+        if (ret != -1)
a3470f
+                is_latency_on = ret;
a3470f
+        if ((_gf_true == is_latency_on) &&
a3470f
+            (_gf_true == is_fd_stats_on))
a3470f
+                return _gf_true;
a3470f
+        return _gf_false;
a3470f
+}
a3470f
+
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
a3470f
index 3b82b1e..6c525e5 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
a3470f
@@ -892,4 +892,7 @@ glusterd_get_index_basepath (glusterd_brickinfo_t *brickinfo, char *buffer,
a3470f
 
a3470f
 }
a3470f
 
a3470f
+gf_boolean_t
a3470f
+glusterd_is_profile_on (glusterd_volinfo_t *volinfo);
a3470f
+
a3470f
 #endif
a3470f
-- 
a3470f
1.8.3.1
a3470f