256ebe
From 0cd08d9e89f5ee86d5f4f90f0ca5c07bd290636c Mon Sep 17 00:00:00 2001
256ebe
From: Sanju Rakonde <srakonde@redhat.com>
256ebe
Date: Fri, 26 Apr 2019 22:28:53 +0530
256ebe
Subject: [PATCH 125/141] glusterd: define dumpops in the xlator_api of
256ebe
 glusterd
256ebe
256ebe
Problem: statedump is not capturing information related to glusterd
256ebe
256ebe
Solution: statdump is not capturing glusterd info because
256ebe
trav->dumpops is null in gf_proc_dump_single_xlator_info ()
256ebe
where trav is glusterd xlator object. trav->dumpops is null
256ebe
because we missed to define dumpops in xlator_api of glusterd.
256ebe
defining dumpops in xlator_api of glusterd fixes the issue.
256ebe
256ebe
> fixes: bz#1703629
256ebe
> Change-Id: If85429ecb1ef580aced8d5b88d09fc15258bfc4c
256ebe
> Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
256ebe
256ebe
upstream patch: https://review.gluster.org/#/c/glusterfs/+/22640/
256ebe
256ebe
BUG: 1703753
256ebe
Change-Id: If85429ecb1ef580aced8d5b88d09fc15258bfc4c
256ebe
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
256ebe
Reviewed-on: https://code.engineering.redhat.com/gerrit/169207
256ebe
Tested-by: RHGS Build Bot <nigelb@redhat.com>
256ebe
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
256ebe
---
256ebe
 tests/bugs/glusterd/optimized-basic-testcases.t | 13 +++++++++++++
256ebe
 xlators/mgmt/glusterd/src/glusterd.c            |  1 +
256ebe
 2 files changed, 14 insertions(+)
256ebe
256ebe
diff --git a/tests/bugs/glusterd/optimized-basic-testcases.t b/tests/bugs/glusterd/optimized-basic-testcases.t
256ebe
index dd98a65..d700b5e 100644
256ebe
--- a/tests/bugs/glusterd/optimized-basic-testcases.t
256ebe
+++ b/tests/bugs/glusterd/optimized-basic-testcases.t
256ebe
@@ -32,6 +32,16 @@ function get_brick_host_uuid()
256ebe
     echo $host_uuid_list | awk '{print $1}'
256ebe
 }
256ebe
 
256ebe
+function generate_statedump_and_check_for_glusterd_info {
256ebe
+        pid=`pidof glusterd`
256ebe
+        #remove old stale statedumps
256ebe
+        cleanup_statedump $pid
256ebe
+        kill -USR1 $pid
256ebe
+        #Wait till the statedump is generated
256ebe
+        sleep 1
256ebe
+        fname=$(ls $statedumpdir | grep -E "\.$pid\.dump\.")
256ebe
+        cat $statedumpdir/$fname | grep "xlator.glusterd.priv" | wc -l
256ebe
+}
256ebe
 
256ebe
 cleanup;
256ebe
 
256ebe
@@ -279,4 +289,7 @@ mkdir -p /xyz/var/lib/glusterd/abc
256ebe
 TEST  $CLI volume create "test" $H0:/xyz/var/lib/glusterd/abc
256ebe
 EXPECT 'Created' volinfo_field "test" 'Status';
256ebe
 
256ebe
+EXPECT "1" generate_statedump_and_check_for_glusterd_info
256ebe
+
256ebe
+cleanup_statedump `pidof glusterd`
256ebe
 cleanup
256ebe
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
256ebe
index d4ab630..c0973cb 100644
256ebe
--- a/xlators/mgmt/glusterd/src/glusterd.c
256ebe
+++ b/xlators/mgmt/glusterd/src/glusterd.c
256ebe
@@ -2231,6 +2231,7 @@ xlator_api_t xlator_api = {
256ebe
     .fini = fini,
256ebe
     .mem_acct_init = mem_acct_init,
256ebe
     .op_version = {1}, /* Present from the initial version */
256ebe
+    .dumpops = &dumpops,
256ebe
     .fops = &fops,
256ebe
     .cbks = &cbks,
256ebe
     .options = options,
256ebe
-- 
256ebe
1.8.3.1
256ebe