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