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