From 7f7dabd7d0df82678e2977002b3d1068ae283dce Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Tue, 26 Aug 2014 12:57:59 +0530 Subject: extras: geo-rep: Customize the generate gfid script to dirs list generate-gfid-file.sh now accepts dirs list file and generate gfids only for those dirs list. Change-Id: Ia78a0a744dc8a079db56c38578cc6fcac2a6fa90 Signed-off-by: Aravinda VK Reviewed-on: http://review.gluster.org/8540 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- extras/geo-rep/generate-gfid-file.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'extras') diff --git a/extras/geo-rep/generate-gfid-file.sh b/extras/geo-rep/generate-gfid-file.sh index 0b7f60f48e5..14f104b986d 100644 --- a/extras/geo-rep/generate-gfid-file.sh +++ b/extras/geo-rep/generate-gfid-file.sh @@ -1,11 +1,12 @@ #!/bin/bash -#Usage: generate-gfid-file.sh +#Usage: generate-gfid-file.sh [dirs-list-file] function get_gfids() { GET_GFID_CMD=$1 OUTPUT_FILE=$2 - find . -exec $GET_GFID_CMD {} \; > $OUTPUT_FILE + DIR_PATH=$3 + find "$DIR_PATH" -exec $GET_GFID_CMD {} \; >> $OUTPUT_FILE } function mount_client() @@ -27,8 +28,18 @@ function mount_client() [ "x$i" = "x1" ] || fatal "could not mount volume $MASTER on $T"; cd $T; - - get_gfids $GFID_CMD $OUTPUT + rm -f $OUTPUT; + touch $OUTPUT; + + if [ "$DIRS_FILE" = "." ] + then + get_gfids $GFID_CMD $OUTPUT "." + else + while read line + do + get_gfids $GFID_CMD $OUTPUT "$line" + done < $DIRS_FILE + fi; cd -; @@ -47,7 +58,13 @@ function main() VOLFILE_SERVER=`echo $SLAVE | sed -e 's/\(.*\):.*/\1/'` VOLUME_NAME=`echo $SLAVE | sed -e 's/.*:\(.*\)/\1/'` - mount_client $VOLFILE_SERVER $VOLUME_NAME $GET_GFID_CMD $OUTPUT + if [ "$#" -lt 4 ] + then + DIRS_FILE="." + else + DIRS_FILE=$4 + fi + mount_client $VOLFILE_SERVER $VOLUME_NAME $GET_GFID_CMD $OUTPUT $DIRS_FILE } main "$@"; -- cgit