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