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