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 <avishwan@redhat.com> Reviewed-on: http://review.gluster.org/8540 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
parent
8f07191a4a
commit
7f7dabd7d0
@ -1,11 +1,12 @@
|
||||
#!/bin/bash
|
||||
#Usage: generate-gfid-file.sh <master-volfile-server:master-volume> <path-to-get-gfid.sh> <output-file>
|
||||
#Usage: generate-gfid-file.sh <master-volfile-server:master-volume> <path-to-get-gfid.sh> <output-file> [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;
|
||||
rm -f $OUTPUT;
|
||||
touch $OUTPUT;
|
||||
|
||||
get_gfids $GFID_CMD $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 "$@";
|
||||
|
Loading…
x
Reference in New Issue
Block a user