Blob Blame History Raw
From ab7ff0b569aea5284108fc07dce78f30ac342b1d Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Tue, 23 Jan 2018 08:23:11 +0530
Subject: [PATCH 172/180] glusterd: add profile_enabled flag in get-state

>upstream mainline patch : https://review.gluster.org/#/c/19286

Change-Id: I09f348ed7ae6cd481f8c4d8b4f65f2f2f6aad84e
BUG: 1537357
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/131835
Tested-by: RHGS Build Bot <nigelb@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-handler.c |  2 ++
 xlators/mgmt/glusterd/src/glusterd-op-sm.c   | 22 ----------------------
 xlators/mgmt/glusterd/src/glusterd-utils.c   | 22 ++++++++++++++++++++++
 xlators/mgmt/glusterd/src/glusterd-utils.h   |  3 +++
 4 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index a3e1fdc..8fc665d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -5650,6 +5650,8 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
                 fprintf (fp, "Volume%d.transport_type: %s\n", count,
                          transport_type_str);
                 fprintf (fp, "Volume%d.status: %s\n", count, vol_status_str);
+                fprintf (fp, "Volume%d.profile_enabled: %d\n", count,
+                         glusterd_is_profile_on (volinfo));
                 fprintf (fp, "Volume%d.brickcount: %d\n", count,
                          volinfo->brick_count);
 
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 81cde21..0cf76dd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1978,28 +1978,6 @@ glusterd_op_stage_status_volume (dict_t *dict, char **op_errstr)
         return ret;
 }
 
-
-static gf_boolean_t
-glusterd_is_profile_on (glusterd_volinfo_t *volinfo)
-{
-        int                                     ret = -1;
-        gf_boolean_t                            is_latency_on = _gf_false;
-        gf_boolean_t                            is_fd_stats_on = _gf_false;
-
-        GF_ASSERT (volinfo);
-
-        ret = glusterd_volinfo_get_boolean (volinfo, VKEY_DIAG_CNT_FOP_HITS);
-        if (ret != -1)
-                is_fd_stats_on = ret;
-        ret = glusterd_volinfo_get_boolean (volinfo, VKEY_DIAG_LAT_MEASUREMENT);
-        if (ret != -1)
-                is_latency_on = ret;
-        if ((_gf_true == is_latency_on) &&
-            (_gf_true == is_fd_stats_on))
-                return _gf_true;
-        return _gf_false;
-}
-
 static int
 glusterd_op_stage_stats_volume (dict_t *dict, char **op_errstr)
 {
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 9ccd718..9a67cfd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -13988,3 +13988,25 @@ gd_rb_op_to_str (char *op)
                 return "replace-brick commit force";
         return NULL;
 }
+
+gf_boolean_t
+glusterd_is_profile_on (glusterd_volinfo_t *volinfo)
+{
+        int                                     ret = -1;
+        gf_boolean_t                            is_latency_on = _gf_false;
+        gf_boolean_t                            is_fd_stats_on = _gf_false;
+
+        GF_ASSERT (volinfo);
+
+        ret = glusterd_volinfo_get_boolean (volinfo, VKEY_DIAG_CNT_FOP_HITS);
+        if (ret != -1)
+                is_fd_stats_on = ret;
+        ret = glusterd_volinfo_get_boolean (volinfo, VKEY_DIAG_LAT_MEASUREMENT);
+        if (ret != -1)
+                is_latency_on = ret;
+        if ((_gf_true == is_latency_on) &&
+            (_gf_true == is_fd_stats_on))
+                return _gf_true;
+        return _gf_false;
+}
+
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 3b82b1e..6c525e5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -892,4 +892,7 @@ glusterd_get_index_basepath (glusterd_brickinfo_t *brickinfo, char *buffer,
 
 }
 
+gf_boolean_t
+glusterd_is_profile_on (glusterd_volinfo_t *volinfo);
+
 #endif
-- 
1.8.3.1