summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2014-08-26 12:57:59 +0530
committerVijay Bellur <vbellur@redhat.com>2014-11-26 00:12:18 -0800
commit7f7dabd7d0df82678e2977002b3d1068ae283dce (patch)
treefb982f6b86c1101794e318795f11fc717dc1795a
parent8f07191a4ab312c8b99e2eb08c7a1fc7e2c5eff2 (diff)
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>
-rw-r--r--extras/geo-rep/generate-gfid-file.sh27
1 files changed, 22 insertions, 5 deletions
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 <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;
-
- 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 "$@";