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