diff options
author | Venky Shankar <vshankar@redhat.com> | 2013-08-01 13:22:34 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-09-04 19:28:35 -0700 |
commit | 59d37265acf250b1b29c186020c55e9df0ef4215 (patch) | |
tree | 781932c35dc46f3ecb48ab6a361d19b23d7338de /geo-replication/src/gverify.sh | |
parent | c7cc5252a350ff78b5f8396d05c85b9d2ade17b8 (diff) |
gverify/glusterd : Added check to warn the user of existing files in slave volume
Change-Id: I41c9fb44613386189d9f3c090729f4ded8e4dea8
BUG: 990997
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/5453
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'geo-replication/src/gverify.sh')
-rwxr-xr-x | geo-replication/src/gverify.sh | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/geo-replication/src/gverify.sh b/geo-replication/src/gverify.sh index 186af53a407..f10e21ed6e0 100755 --- a/geo-replication/src/gverify.sh +++ b/geo-replication/src/gverify.sh @@ -61,10 +61,11 @@ exit 1; fi; cd \$d; available_size=\$(df \$d | tail -1 | awk "{print \\\$4}"); +no_of_files=\$(find \$d -maxdepth 0 -empty); umount -l \$d; rmdir \$d; ver=\$(gluster --version | head -1 | cut -f2 -d " "); -echo \$available_size:\$ver; +echo \$available_size:\$ver:\$no_of_files:; }; cd /tmp; [ x$VOL != x ] && do_verify $VOL; @@ -102,7 +103,9 @@ function main() slave_size=$(echo $slave_data | cut -f1 -d':'); master_version=$(echo $master_data | cut -f2 -d':'); slave_version=$(echo $slave_data | cut -f2 -d':'); + slave_no_of_files=$(echo $slave_data | cut -f3 -d':'); log_file=$4 + > $log_file if [[ "x$master_size" = "x" || "x$master_version" = "x" || "$master_size" -eq "0" ]]; then echo "Unable to fetch master volume details." > $log_file; @@ -119,20 +122,19 @@ function main() exit 1; fi; - if [ $slave_size -ge $(($master_size - $BUFFER_SIZE )) ]; then - echo "Total size of master is lesser than available size of slave." > $log_file; - else - echo "Total size of master is greater than available size of slave." > $log_file; + if [ ! $slave_size -ge $(($master_size - $BUFFER_SIZE )) ]; then + echo "Total size of master is greater than available size of slave." >> $log_file; ERRORS=$(($ERRORS + 1)); - exit $ERRORS; fi; - if [[ $master_version < $slave_version || $master_version == $slave_version ]]; then - echo "Gluster version of master and slave matches." > $log_file; - else - echo "Gluster version mismatch between master and slave." > $log_file; + if [ -z $slave_no_of_files ]; then + echo "$2::$3 is not empty. Please delete existing files in $2::$3 and retry, or use force to continue without deleting the existing files." >> $log_file; + ERRORS=$(($ERRORS + 1)); + fi; + + if [[ $master_version > $slave_version ]]; then + echo "Gluster version mismatch between master and slave." >> $log_file; ERRORS=$(($ERRORS + 1)); - exit $ERRORS; fi; exit $ERRORS; |