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