Blob Blame History Raw
From 3fc74ce6c282f0f43fdcfeda47b71a1b19945b6d Mon Sep 17 00:00:00 2001
From: srijan-sivakumar <ssivakum@redhat.com>
Date: Wed, 3 Feb 2021 10:11:04 +0530
Subject: [PATCH 528/532] Extras: Removing xattr_analysis script

The xattr_analysis.py script is used rarely for
debugging and seeing that it has some dependencies,
removing it from the release.

If need be, it would be directly shared with the cu.

Label: DOWNSTREAM ONLY
BUG: 1719171

Change-Id: I4bb0df3ebfa7e43e13858b4b6e3efbb02ea79d5f
Signed-off-by: srijan-sivakumar <ssivakum@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/226301
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 extras/quota/Makefile.am       |  4 +--
 extras/quota/xattr_analysis.py | 73 ------------------------------------------
 glusterfs.spec.in              |  1 -
 3 files changed, 2 insertions(+), 76 deletions(-)
 delete mode 100755 extras/quota/xattr_analysis.py

diff --git a/extras/quota/Makefile.am b/extras/quota/Makefile.am
index cdb6be1..e4d9322 100644
--- a/extras/quota/Makefile.am
+++ b/extras/quota/Makefile.am
@@ -2,7 +2,7 @@ scriptsdir = $(datadir)/glusterfs/scripts
 scripts_SCRIPTS =  log_accounting.sh
 
 if WITH_SERVER
-scripts_SCRIPTS += xattr_analysis.py quota_fsck.py
+scripts_SCRIPTS += quota_fsck.py
 endif
 
-EXTRA_DIST = log_accounting.sh xattr_analysis.py quota_fsck.py
+EXTRA_DIST = log_accounting.sh quota_fsck.py
diff --git a/extras/quota/xattr_analysis.py b/extras/quota/xattr_analysis.py
deleted file mode 100755
index 7bd7d96..0000000
--- a/extras/quota/xattr_analysis.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/python3
-# Below script has two purposes
-#  1. Display xattr of entire FS tree in a human readable form
-#  2. Display all the directory where contri and size mismatch.
-#      (If there are any directory with contri and size mismatch that are not dirty
-#       then that highlights a propagation issue)
-#  The script takes only one input LOG _FILE generated from the command,
-#  find <brick_path> | xargs  getfattr -d -m. -e hex  > log_gluster_xattr
-
-from __future__ import print_function
-import re
-import subprocess
-import sys
-from hurry.filesize import size
-
-if len(sys.argv) < 2:
-    sys.exit('Usage: %s log_gluster_xattr \n'
-              'to generate log_gluster_xattr use: \n'
-              'find <brick_path> | xargs  getfattr -d -m. -e hex  > log_gluster_xattr'
-              % sys.argv[0])
-LOG_FILE=sys.argv[1]
-
-def get_quota_xattr_brick():
-    out = subprocess.check_output (["/usr/bin/cat", LOG_FILE])
-    pairs = out.splitlines()
-
-    xdict = {}
-    mismatch_size = [('====contri_size===', '====size====')]
-    for xattr in pairs:
-        k = xattr.split("=")[0]
-        if re.search("# file:", k):
-            print(xdict)
-            filename=k
-            print("=====" + filename + "=======")
-            xdict = {}
-        elif k is "":
-            pass
-        else:
-            print(xattr)
-            v = xattr.split("=")[1]
-            if re.search("contri", k):
-                if len(v) == 34:
-                    # for files size is obtained in iatt, file count should be 1, dir count=0
-                    xdict['contri_file_count'] = int(v[18:34], 16)
-                    xdict['contri_dir_count'] = 0
-                else:
-                    xdict['contri_size'] = size(int(v[2:18], 16))
-                    xdict['contri_file_count'] = int(v[18:34], 16)
-                    xdict['contri_dir_count'] = int(v[34:], 16)
-            elif re.search("size", k):
-                xdict['size'] = size(int(v[2:18], 16))
-                xdict['file_count'] = int(v[18:34], 16)
-                xdict['dir_count'] = int(v[34:], 16)
-            elif re.search("dirty", k):
-                if v == '0x3000':
-                    xdict['dirty'] = False
-                elif v == '0x3100':
-                    xdict['dirty'] = True
-            elif re.search("limit_objects", k):
-                xdict['limit_objects'] = int(v[2:18], 16)
-            elif re.search("limit_set", k):
-                xdict['limit_set'] = size(int(v[2:18], 16))
-
-            if 'size' in xdict and 'contri_size' in xdict and xdict['size'] != xdict['contri_size']:
-                mismatch_size.append((xdict['contri_size'], xdict['size'], filename))
-
-    for values in mismatch_size:
-        print(values)
-
-
-if __name__ == '__main__':
-    get_quota_xattr_brick()
-
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 30d7162..2be7677 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1380,7 +1380,6 @@ exit 0
 %if ( 0%{!?_without_server:1} )
 %files server
 %doc extras/clear_xattrs.sh
-%{_datadir}/glusterfs/scripts/xattr_analysis.py*
 %{_datadir}/glusterfs/scripts/quota_fsck.py*
 # sysconf
 %config(noreplace) %{_sysconfdir}/glusterfs
-- 
1.8.3.1