14f8ab
From 3fc74ce6c282f0f43fdcfeda47b71a1b19945b6d Mon Sep 17 00:00:00 2001
14f8ab
From: srijan-sivakumar <ssivakum@redhat.com>
14f8ab
Date: Wed, 3 Feb 2021 10:11:04 +0530
14f8ab
Subject: [PATCH 528/532] Extras: Removing xattr_analysis script
14f8ab
14f8ab
The xattr_analysis.py script is used rarely for
14f8ab
debugging and seeing that it has some dependencies,
14f8ab
removing it from the release.
14f8ab
14f8ab
If need be, it would be directly shared with the cu.
14f8ab
14f8ab
Label: DOWNSTREAM ONLY
14f8ab
BUG: 1719171
14f8ab
14f8ab
Change-Id: I4bb0df3ebfa7e43e13858b4b6e3efbb02ea79d5f
14f8ab
Signed-off-by: srijan-sivakumar <ssivakum@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/226301
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 extras/quota/Makefile.am       |  4 +--
14f8ab
 extras/quota/xattr_analysis.py | 73 ------------------------------------------
14f8ab
 glusterfs.spec.in              |  1 -
14f8ab
 3 files changed, 2 insertions(+), 76 deletions(-)
14f8ab
 delete mode 100755 extras/quota/xattr_analysis.py
14f8ab
14f8ab
diff --git a/extras/quota/Makefile.am b/extras/quota/Makefile.am
14f8ab
index cdb6be1..e4d9322 100644
14f8ab
--- a/extras/quota/Makefile.am
14f8ab
+++ b/extras/quota/Makefile.am
14f8ab
@@ -2,7 +2,7 @@ scriptsdir = $(datadir)/glusterfs/scripts
14f8ab
 scripts_SCRIPTS =  log_accounting.sh
14f8ab
 
14f8ab
 if WITH_SERVER
14f8ab
-scripts_SCRIPTS += xattr_analysis.py quota_fsck.py
14f8ab
+scripts_SCRIPTS += quota_fsck.py
14f8ab
 endif
14f8ab
 
14f8ab
-EXTRA_DIST = log_accounting.sh xattr_analysis.py quota_fsck.py
14f8ab
+EXTRA_DIST = log_accounting.sh quota_fsck.py
14f8ab
diff --git a/extras/quota/xattr_analysis.py b/extras/quota/xattr_analysis.py
14f8ab
deleted file mode 100755
14f8ab
index 7bd7d96..0000000
14f8ab
--- a/extras/quota/xattr_analysis.py
14f8ab
+++ /dev/null
14f8ab
@@ -1,73 +0,0 @@
14f8ab
-#!/usr/bin/python3
14f8ab
-# Below script has two purposes
14f8ab
-#  1. Display xattr of entire FS tree in a human readable form
14f8ab
-#  2. Display all the directory where contri and size mismatch.
14f8ab
-#      (If there are any directory with contri and size mismatch that are not dirty
14f8ab
-#       then that highlights a propagation issue)
14f8ab
-#  The script takes only one input LOG _FILE generated from the command,
14f8ab
-#  find <brick_path> | xargs  getfattr -d -m. -e hex  > log_gluster_xattr
14f8ab
-
14f8ab
-from __future__ import print_function
14f8ab
-import re
14f8ab
-import subprocess
14f8ab
-import sys
14f8ab
-from hurry.filesize import size
14f8ab
-
14f8ab
-if len(sys.argv) < 2:
14f8ab
-    sys.exit('Usage: %s log_gluster_xattr \n'
14f8ab
-              'to generate log_gluster_xattr use: \n'
14f8ab
-              'find <brick_path> | xargs  getfattr -d -m. -e hex  > log_gluster_xattr'
14f8ab
-              % sys.argv[0])
14f8ab
-LOG_FILE=sys.argv[1]
14f8ab
-
14f8ab
-def get_quota_xattr_brick():
14f8ab
-    out = subprocess.check_output (["/usr/bin/cat", LOG_FILE])
14f8ab
-    pairs = out.splitlines()
14f8ab
-
14f8ab
-    xdict = {}
14f8ab
-    mismatch_size = [('====contri_size===', '====size====')]
14f8ab
-    for xattr in pairs:
14f8ab
-        k = xattr.split("=")[0]
14f8ab
-        if re.search("# file:", k):
14f8ab
-            print(xdict)
14f8ab
-            filename=k
14f8ab
-            print("=====" + filename + "=======")
14f8ab
-            xdict = {}
14f8ab
-        elif k is "":
14f8ab
-            pass
14f8ab
-        else:
14f8ab
-            print(xattr)
14f8ab
-            v = xattr.split("=")[1]
14f8ab
-            if re.search("contri", k):
14f8ab
-                if len(v) == 34:
14f8ab
-                    # for files size is obtained in iatt, file count should be 1, dir count=0
14f8ab
-                    xdict['contri_file_count'] = int(v[18:34], 16)
14f8ab
-                    xdict['contri_dir_count'] = 0
14f8ab
-                else:
14f8ab
-                    xdict['contri_size'] = size(int(v[2:18], 16))
14f8ab
-                    xdict['contri_file_count'] = int(v[18:34], 16)
14f8ab
-                    xdict['contri_dir_count'] = int(v[34:], 16)
14f8ab
-            elif re.search("size", k):
14f8ab
-                xdict['size'] = size(int(v[2:18], 16))
14f8ab
-                xdict['file_count'] = int(v[18:34], 16)
14f8ab
-                xdict['dir_count'] = int(v[34:], 16)
14f8ab
-            elif re.search("dirty", k):
14f8ab
-                if v == '0x3000':
14f8ab
-                    xdict['dirty'] = False
14f8ab
-                elif v == '0x3100':
14f8ab
-                    xdict['dirty'] = True
14f8ab
-            elif re.search("limit_objects", k):
14f8ab
-                xdict['limit_objects'] = int(v[2:18], 16)
14f8ab
-            elif re.search("limit_set", k):
14f8ab
-                xdict['limit_set'] = size(int(v[2:18], 16))
14f8ab
-
14f8ab
-            if 'size' in xdict and 'contri_size' in xdict and xdict['size'] != xdict['contri_size']:
14f8ab
-                mismatch_size.append((xdict['contri_size'], xdict['size'], filename))
14f8ab
-
14f8ab
-    for values in mismatch_size:
14f8ab
-        print(values)
14f8ab
-
14f8ab
-
14f8ab
-if __name__ == '__main__':
14f8ab
-    get_quota_xattr_brick()
14f8ab
-
14f8ab
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
14f8ab
index 30d7162..2be7677 100644
14f8ab
--- a/glusterfs.spec.in
14f8ab
+++ b/glusterfs.spec.in
14f8ab
@@ -1380,7 +1380,6 @@ exit 0
14f8ab
 %if ( 0%{!?_without_server:1} )
14f8ab
 %files server
14f8ab
 %doc extras/clear_xattrs.sh
14f8ab
-%{_datadir}/glusterfs/scripts/xattr_analysis.py*
14f8ab
 %{_datadir}/glusterfs/scripts/quota_fsck.py*
14f8ab
 # sysconf
14f8ab
 %config(noreplace) %{_sysconfdir}/glusterfs
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab