From 6a3024fe5953f51b51a7b9c2867d59c9e54c6d03 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Thu, 19 Mar 2015 15:39:20 +0530 Subject: tools/glusterfind: Ignore .trashcan dir during Brick Crawl BUG: 1203650 Change-Id: Icf81726ad34bd5cfec6d8e06763b02a159e84c2e Signed-off-by: Aravinda VK Reviewed-on: http://review.gluster.org/10010 Reviewed-by: Kotresh HR Reviewed-by: Prashanth Pai Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY --- tools/glusterfind/src/brickfind.py | 8 ++++++-- tools/glusterfind/src/changelog.py | 11 +++++++++-- tools/glusterfind/src/tool.conf.in | 1 + tools/glusterfind/src/utils.py | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) (limited to 'tools/glusterfind') diff --git a/tools/glusterfind/src/brickfind.py b/tools/glusterfind/src/brickfind.py index 4aee225d22e..1090f408e28 100644 --- a/tools/glusterfind/src/brickfind.py +++ b/tools/glusterfind/src/brickfind.py @@ -55,13 +55,17 @@ def brickfind_crawl(brick, args): path = path[brick_path_len+1:] output_write(fout, path, args.output_prefix) + ignore_dirs = [os.path.join(brick, dirname) + for dirname in + conf.get_opt("brick_ignore_dirs").split(",")] + if args.full: find(brick, callback_func=output_callback, - ignore_dirs=[".glusterfs"]) + ignore_dirs=ignore_dirs) else: find(brick, callback_func=output_callback, filter_func=mtime_filter, - ignore_dirs=[".glusterfs"]) + ignore_dirs=ignore_dirs) fout.flush() os.fsync(fout.fileno()) diff --git a/tools/glusterfind/src/changelog.py b/tools/glusterfind/src/changelog.py index b7697ea5030..262cb696c78 100644 --- a/tools/glusterfind/src/changelog.py +++ b/tools/glusterfind/src/changelog.py @@ -85,10 +85,13 @@ def gfid_to_path_using_batchfind(brick, gfids_file, output_file): path = path[brick_path_len+1:] output_write(fout, path, args.output_prefix) + ignore_dirs = [os.path.join(brick, dirname) + for dirname in + conf.get_opt("brick_ignore_dirs").split(",")] # Length of brick path, to remove from output path find(brick, callback_func=output_callback, filter_func=inode_filter, - ignore_dirs=[".glusterfs"]) + ignore_dirs=ignore_dirs) fout.flush() os.fsync(fout.fileno()) @@ -166,12 +169,16 @@ def gfid_to_path_using_pgfid(brick, gfids_file, output_file, outfile_failures): path = path[brick_path_len+1:] output_write(fout, path, args.output_prefix) + ignore_dirs = [os.path.join(brick, dirname) + for dirname in + conf.get_opt("brick_ignore_dirs").split(",")] + for pgfid in pgfids: path = symlink_gfid_to_path(brick, pgfid) find(os.path.join(brick, path), callback_func=output_callback, filter_func=inode_filter, - ignore_dirs=[".glusterfs"], + ignore_dirs=ignore_dirs, subdirs_crawl=False) fout.flush() diff --git a/tools/glusterfind/src/tool.conf.in b/tools/glusterfind/src/tool.conf.in index bae46499aa0..48ecdda06cc 100644 --- a/tools/glusterfind/src/tool.conf.in +++ b/tools/glusterfind/src/tool.conf.in @@ -5,6 +5,7 @@ working_dir=@GLUSTERFSD_MISCDIR@/glusterfind/ log_dir=/var/log/glusterfs/glusterfind/ nodecleanup=@GLUSTERFS_LIBEXECDIR@/glusterfind/nodecleanup.py changelog_rollover_time=15 +brick_ignore_dirs=.glusterfs,.trashcan [change_detectors] changelog=@GLUSTERFS_LIBEXECDIR@/glusterfind/changelog.py diff --git a/tools/glusterfind/src/utils.py b/tools/glusterfind/src/utils.py index c503a2b9f58..de9c027e299 100644 --- a/tools/glusterfind/src/utils.py +++ b/tools/glusterfind/src/utils.py @@ -21,7 +21,7 @@ ROOT_GFID = "00000000-0000-0000-0000-000000000001" def find(path, callback_func=lambda x: True, filter_func=lambda x: True, ignore_dirs=[], subdirs_crawl=True): - if os.path.basename(path) in ignore_dirs: + if path in ignore_dirs: return if filter_func(path): -- cgit