diff options
-rwxr-xr-x | extras/hook-scripts/S56glusterd-geo-rep-create-post.sh | 15 | ||||
-rw-r--r-- | geo-replication/gsyncd.conf.in | 6 | ||||
-rwxr-xr-x | geo-replication/src/gverify.sh | 25 | ||||
-rw-r--r-- | geo-replication/syncdaemon/gsyncd.py | 2 | ||||
-rw-r--r-- | geo-replication/syncdaemon/resource.py | 10 | ||||
-rw-r--r-- | tests/env.rc.in | 3 | ||||
-rw-r--r-- | tests/geo-rep.rc | 277 | ||||
-rw-r--r-- | tests/geo-rep/georep-basic-dr-rsync.t | 169 | ||||
-rw-r--r-- | tests/geo-rep/georep-basic-dr-tarssh.t | 147 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 10 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 4 |
11 files changed, 384 insertions, 284 deletions
diff --git a/extras/hook-scripts/S56glusterd-geo-rep-create-post.sh b/extras/hook-scripts/S56glusterd-geo-rep-create-post.sh index a5e472e926..83828ab037 100755 --- a/extras/hook-scripts/S56glusterd-geo-rep-create-post.sh +++ b/extras/hook-scripts/S56glusterd-geo-rep-create-post.sh @@ -86,9 +86,16 @@ if [ -f $pub_file ]; then scp -P ${SSH_PORT} $pub_file $slave_user@$slave_ip:$slave_user_home_dir/common_secret.pem.pub_tmp ssh -p ${SSH_PORT} $slave_user@$slave_ip "mv $slave_user_home_dir/common_secret.pem.pub_tmp $slave_user_home_dir/${mastervol}_${slavevol}_common_secret.pem.pub" else - scp -P ${SSH_PORT} $pub_file $slave_ip:$pub_file_tmp - ssh -p ${SSH_PORT} $slave_ip "mv $pub_file_tmp ${pub_file_dname}/${mastervol}_${slavevol}_${pub_file_bname}" - ssh -p ${SSH_PORT} $slave_ip "gluster system:: copy file /geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub > /dev/null" - ssh -p ${SSH_PORT} $slave_ip "gluster system:: execute add_secret_pub root geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub > /dev/null" + if [[ -z "${GR_SSH_IDENTITY_KEY}" ]]; then + scp -P ${SSH_PORT} $pub_file $slave_ip:$pub_file_tmp + ssh -p ${SSH_PORT} $slave_ip "mv $pub_file_tmp ${pub_file_dname}/${mastervol}_${slavevol}_${pub_file_bname}" + ssh -p ${SSH_PORT} $slave_ip "gluster system:: copy file /geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub > /dev/null" + ssh -p ${SSH_PORT} $slave_ip "gluster system:: execute add_secret_pub root geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub > /dev/null" + else + scp -P ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} $pub_file $slave_ip:$pub_file_tmp + ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} $slave_ip "mv $pub_file_tmp ${pub_file_dname}/${mastervol}_${slavevol}_${pub_file_bname}" + ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} $slave_ip "gluster system:: copy file /geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub > /dev/null" + ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} $slave_ip "gluster system:: execute add_secret_pub root geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub > /dev/null" + fi fi fi diff --git a/geo-replication/gsyncd.conf.in b/geo-replication/gsyncd.conf.in index ecdeab9377..53cc76b842 100644 --- a/geo-replication/gsyncd.conf.in +++ b/geo-replication/gsyncd.conf.in @@ -117,7 +117,11 @@ help=If SSH keys are not secured with gsyncd prefix then use this configuration [gluster-command-dir] value=/usr/local/sbin/ -help=Directory where Gluster binary exists +help=Directory where Gluster binaries exist on master + +[slave-gluster-command-dir] +value=/usr/local/sbin/ +help=Directory where Gluster binaries exist on slave [gluster-params] value = aux-gfid-mount acl diff --git a/geo-replication/src/gverify.sh b/geo-replication/src/gverify.sh index 9b1328aa63..8eae8469ff 100755 --- a/geo-replication/src/gverify.sh +++ b/geo-replication/src/gverify.sh @@ -11,11 +11,19 @@ slave_log_file=`gluster --print-logdir`/geo-replication-slaves/slave.log function SSHM() { - ssh -p ${SSH_PORT} -q \ - -oPasswordAuthentication=no \ - -oStrictHostKeyChecking=no \ - -oControlMaster=yes \ - "$@"; + if [[ -z "${GR_SSH_IDENTITY_KEY}" ]]; then + ssh -p ${SSH_PORT} -q \ + -oPasswordAuthentication=no \ + -oStrictHostKeyChecking=no \ + -oControlMaster=yes \ + "$@"; + else + ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} -q \ + -oPasswordAuthentication=no \ + -oStrictHostKeyChecking=no \ + -oControlMaster=yes \ + "$@"; + fi } function get_inode_num() @@ -172,7 +180,12 @@ function main() exit 1; fi; - ssh -p ${SSH_PORT} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 "echo Testing_Passwordless_SSH"; + if [[ -z "${GR_SSH_IDENTITY_KEY}" ]]; then + ssh -p ${SSH_PORT} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 "echo Testing_Passwordless_SSH"; + else + ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 "echo Testing_Passwordless_SSH"; + fi + if [ $? -ne 0 ]; then echo "FORCE_BLOCKER|Passwordless ssh login has not been setup with $3 for user $2." > $log_file exit 1; diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py index edecf076a0..04ceb435bf 100644 --- a/geo-replication/syncdaemon/gsyncd.py +++ b/geo-replication/syncdaemon/gsyncd.py @@ -117,6 +117,8 @@ def main(): p.add_argument("--slave-log-level", help="Slave Gsyncd Log level") p.add_argument("--slave-gluster-log-level", help="Slave Gluster mount Log level") + p.add_argument("--slave-gluster-command-dir", + help="Directory where Gluster binaries exist on slave") p.add_argument("--slave-access-mount", action="store_true", help="Do not lazy umount the slave volume") diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index ab0484d5f5..2d48a28c14 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -807,8 +807,10 @@ class Mounter(object): @classmethod def get_glusterprog(cls): - return os.path.join(gconf.get("gluster-command-dir"), - cls.glusterprog) + gluster_cmd_dir = gconf.get("gluster-command-dir") + if rconf.args.subcmd == "slave": + gluster_cmd_dir = gconf.get("slave-gluster-command-dir") + return os.path.join(gluster_cmd_dir, cls.glusterprog) def umount_l(self, d): """perform lazy umount""" @@ -1371,7 +1373,9 @@ class SSH(object): '--slave-timeout', str(gconf.get("slave-timeout")), '--slave-log-level', gconf.get("slave-log-level"), '--slave-gluster-log-level', - gconf.get("slave-gluster-log-level")] + gconf.get("slave-gluster-log-level"), + '--slave-gluster-command-dir', + gconf.get("slave-gluster-command-dir")] if gconf.get("slave-access-mount"): args_to_slave.append('--slave-access-mount') diff --git a/tests/env.rc.in b/tests/env.rc.in index 3f3394bd5e..f78fe8ffeb 100644 --- a/tests/env.rc.in +++ b/tests/env.rc.in @@ -31,3 +31,6 @@ export PYTHON PYTHONPATH=@BUILD_PYTHON_SITE_PACKAGES@:$PYTHON_PATH export PYTHONPATH + +GLUSTER_CMD_DIR=@sbindir@ +export GLUSTER_CMD_DIR diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc index 1a44b4a394..cdad4f1cb6 100644 --- a/tests/geo-rep.rc +++ b/tests/geo-rep.rc @@ -1,18 +1,14 @@ -function check_status() -{ - local search_key=$1 - $GEOREP_CLI $master $slave status detail | egrep -i "$search_key" -} +GEO_REP_TIMEOUT=60 function check_status_num_rows() { - local search_key=$1 - $GEOREP_CLI $master $slave status detail | egrep -i "$search_key" | wc -l + local search_key=$1 + $GEOREP_CLI $master $slave status detail | egrep -i "$search_key" | wc -l } function create_data() { - prefix=$1 + prefix=$1 # GF_FOP_MKNOD # GF_FOP_MKDIR @@ -26,139 +22,150 @@ function create_data() # GF_FOP_CREATE # GF_FOP_SETATTR - # Regular file - touch ${master_mnt}/${prefix}_f1 - touch ${master_mnt}/${prefix}_f2 - touch ${master_mnt}/${prefix}_f3 + # Regular file + touch ${master_mnt}/${prefix}_f1 + touch ${master_mnt}/${prefix}_f2 + touch ${master_mnt}/${prefix}_f3 - # dir - mkdir ${master_mnt}/${prefix}_d1 - mkdir ${master_mnt}/${prefix}_d2 - touch ${master_mnt}/${prefix}_d3 + # dir + mkdir ${master_mnt}/${prefix}_d1 + mkdir ${master_mnt}/${prefix}_d2 + touch ${master_mnt}/${prefix}_d3 - # Hardlink - ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1 + # Hardlink + ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1 - # Symlink - cd ${master_mnt} - ln -s ${prefix}_f1 ${prefix}_sl1 - cd - + # Symlink + cd ${master_mnt} + ln -s ${prefix}_f1 ${prefix}_sl1 + cd - - # data - echo "HelloWorld!" >> ${master_mnt}/${prefix}_f1 + # data + echo "HelloWorld!" >> ${master_mnt}/${prefix}_f1 - # UNLINK - rm ${master_mnt}/${prefix}_f2 + # UNLINK + rm ${master_mnt}/${prefix}_f2 - # RMDIR - rmdir ${master_mnt}/${prefix}_d2 + # RMDIR + rmdir ${master_mnt}/${prefix}_d2 - # Rename - File - mv ${master_mnt}/${prefix}_f3 ${master_mnt}/${prefix}_f4 + # Rename - File + mv ${master_mnt}/${prefix}_f3 ${master_mnt}/${prefix}_f4 - # Rename - Dir - mv ${master_mnt}/${prefix}_d3 ${master_mnt}/${prefix}_d4 + # Rename - Dir + mv ${master_mnt}/${prefix}_d3 ${master_mnt}/${prefix}_d4 - # chown - touch ${master_mnt}/${prefix}_chown_f1 - chown 1000:1000 ${master_mnt}/${prefix}_chown_f1 + # chown + touch ${master_mnt}/${prefix}_chown_f1 + chown 1000:1000 ${master_mnt}/${prefix}_chown_f1 } function chown_file_ok() { - local file_owner=$(stat --format "%u:%g" "$1" 2>/dev/null) - if test "X$file_owner" != "X1000:1000"; then return 1;fi + local file_owner=$(stat --format "%u:%g" "$1") + if test "X$file_owner" != "X1000:1000"; then echo 1; else echo 0; fi } function regular_file_ok() { - local file_type=$(stat --format "%F" "$1") - if test "X$file_type" != "Xregular file"; then return 1; fi + local file_type=$(stat --format "%F" "$1") + if test "X$file_type" != "Xregular file"; then echo 1; else echo 0; fi } function directory_ok() { - file_type=$(stat --format "%F" "$1") - if test "X$file_type" != "Xdirectory"; then return 1; fi + file_type=$(stat --format "%F" "$1") + if test "X$file_type" != "Xdirectory"; then echo 1; else echo 0; fi } function unlink_ok() { - stat "$1" stat ./case > /dev/null 2>&1 - rc=$? - if test $rc != 0; then return 0; fi - return 1; + stat "$1" > /dev/null 2>&1 + rc=$? + echo $rc } function hardlink_file_ok() { - orig_file=$1 - link_file=$2 + orig_file=$1 + link_file=$2 - orig_inode=$(stat --format "%i" "$orig_file") - rc=$? - if test $rc != 0; then return $rc; fi + orig_inode=$(stat --format "%i" "$orig_file") + rc=$? + if test $rc != 0; then echo $rc; fi - link_inode=$(stat --format "%i" "$link_file") - rc=$? - if test $rc != 0; then return $rc; fi + link_inode=$(stat --format "%i" "$link_file") + rc=$? + if test $rc != 0; then echo $rc; fi - if test $orig_inode != $link_inode - then - return 1 - fi + if test $orig_inode != $link_inode + then + echo 1 + else + echo 0 + fi } function data_ok() { - path=$1 - data1="$2" - data2=$(cat $path) - echo "data1:$data1" - echo "data2:$data2" - if test "X$data1" != "X$data2" - then - return 1 - fi + path=$1 + data1="$2" + data2=$(cat $path) + echo "data1:$data1" + echo "data2:$data2" + if test "X$data1" != "X$data2" + then + echo 1 + else + echo 0 + fi } -function symlink_ok() +function arequal_checksum() { - local orig_file_name=$1 - local symlink_file=$2 + master=$1 + slave=$2 + diff <(arequal-checksum -p $master) <(arequal-checksum -p $slave) | wc -l +} +function symlink_ok() +{ + local orig_file_name=$1 + local symlink_file=$2 - local file_type=$(stat --format "%F" "$symlink_file") - if test "X$file_type" != "Xsymbolic link"; then return 1; fi + local file_type=$(stat --format "%F" "$symlink_file") + if test "X$file_type" != "Xsymbolic link"; then echo 1;else echo 0; fi - local fname=$(readlink $symlink_file) - if test "X$fname" != "X$orig_file_name"; then return 1; fi + local fname=$(readlink $symlink_file) + if test "X$fname" != "X$orig_file_name"; then echo 1;else echo 0; fi } function rename_ok() { - old_name=$1 - new_name=$2 + old_name=$1 + new_name=$2 - if [ -f $old_name ] - then - return 1 - fi + if [ -f $old_name ] + then + echo 1 + fi - if [ ! -f $new_name ] - then - return 1 - fi + if [ ! -f $new_name ] + then + echo 1 + fi + echo 0 } function create_georep_session() { - $CLI system:: execute gsec_create - rc=$? - if test $rc != 0; then return $rc; fi - $CLI volume geo-rep $master $slave create push-pem - rc=$? - if test $rc != 0; then return $rc; fi + $CLI system:: execute gsec_create + rc=$? + if test $rc != 0; then echo $rc; fi + $CLI volume geo-rep $master $slave create push-pem + rc=$? + if test $rc != 0; then echo $rc; fi + echo 0 } # logrotate_simulate should be called (rotate_count + 1) times to cause @@ -167,66 +174,66 @@ function create_georep_session() # calls function logrotate_simulate() { - file_name=$1 - declare -i rotate_count=$2 - - while [ $rotate_count -ge 0 ]; do - source_file="${master_mnt}/$file_name.$((rotate_count))" - if [ $rotate_count -eq 0 ]; then - source_file="${master_mnt}/$file_name" - fi - if [ -f "${source_file}" ]; then - mv "${source_file}" "${master_mnt}/$file_name.$((rotate_count+1))" - fi - ((rotate_count--)) - done - - # logrotate causes gfid to be rellocated to a new file created - # after an unlink and a blind rename later causes georep session - # to go Faulty - # this should not happen if source basename on slave is tested - # to be linked with its own gfid as on master, before invoking - # the rename syscall - touch ${master_mnt}/$file_name - rotate_count=$2 - unlink_file_name="${master_mnt}/$file_name.$((rotate_count+1))" - unlink $unlink_file_name + file_name=$1 + declare -i rotate_count=$2 + + while [ $rotate_count -ge 0 ]; do + source_file="$file_name.$((rotate_count))" + if [ $rotate_count -eq 0 ]; then + source_file="$file_name" + fi + if [ -f "${source_file}" ]; then + mv "${source_file}" "$file_name.$((rotate_count+1))" + fi + ((rotate_count--)) + done + + # logrotate causes gfid to be rellocated to a new file created + # after an unlink and a blind rename later causes georep session + # to go Faulty + # this should not happen if source basename on slave is tested + # to be linked with its own gfid as on master, before invoking + # the rename syscall + touch $file_name + rotate_count=$2 + unlink_file_name="$file_name.$((rotate_count+1))" + unlink $unlink_file_name 2>/dev/null } function create_rename() { - file_name=$1 - echo $file_name > ${master_mnt}/$file_name - mv ${master_mnt}/$file_name ${master_mnt}/$file_name.bak + file_name=$1 + echo $file_name > $file_name + mv $file_name $file_name.bak } function create_rename_ok() { - file_name=$1 - # after a log replay, we don't expect the original file - # to be recreated i.e. a dangling entry without a corresponding - # back-end gfid link should not exist on the slave - if [ -f "${slave_mnt}/$file_name" ]; then - return 1 - fi - return 0 + file_name=$1 + # after a log replay, we don't expect the original file + # to be recreated i.e. a dangling entry without a corresponding + # back-end gfid link should not exist on the slave + if [ -f "$file_name" ]; then + echo 1 + fi + echo 0 } function hardlink_rename() { - file_name=$1 - echo $file_name > ${master_mnt}/$file_name - ln ${master_mnt}/$file_name ${master_mnt}/$file_name.hl - mv ${master_mnt}/$file_name.hl ${master_mnt}/$file_name + file_name=$1 + echo $file_name > $file_name + ln $file_name $file_name.hl + mv $file_name.hl $file_name } function hardlink_rename_ok() { - file_name=$1 - # the hardlink file should not exist on the slave after renaming - # to one of its links - if [ -f "${slave_mnt}/$file_name.hl" ]; then - return 1 - fi - return 0 + file_name=$1 + # the hardlink file should not exist on the slave after renaming + # to one of its links + if [ -f "$file_name.hl" ]; then + echo 1 + fi + echo 0 } diff --git a/tests/geo-rep/georep-basic-dr-rsync.t b/tests/geo-rep/georep-basic-dr-rsync.t index 39da524f63..683506684d 100644 --- a/tests/geo-rep/georep-basic-dr-rsync.t +++ b/tests/geo-rep/georep-basic-dr-rsync.t @@ -3,6 +3,15 @@ . $(dirname $0)/../include.rc . $(dirname $0)/../volume.rc . $(dirname $0)/../geo-rep.rc +. $(dirname $0)/../env.rc + +AREQUAL_PATH=$(dirname $0)/../utils +test "`uname -s`" != "Linux" && { + CFLAGS="$CFLAGS -I$(dirname $0)/../../../contrib/argp-standalone "; + CFLAGS="$CFLAGS -L$(dirname $0)/../../../contrib/argp-standalone -largp "; + CFLAGS="$CFLAGS -lintl"; +} +build_tester $AREQUAL_PATH/arequal-checksum.c $CFLAGS ### Basic Tests with Distribute Replicate volumes @@ -15,7 +24,8 @@ TEST pidof glusterd ##Variables GEOREP_CLI="$CLI volume geo-replication" master=$GMV0 -slave=${H0}::${GSV0} +SH0="127.0.0.1" +slave=${SH0}::${GSV0} num_active=2 num_passive=2 master_mnt=$M0 @@ -30,14 +40,14 @@ TEST $CLI volume create $GMV0 replica 2 $H0:$B0/${GMV0}{1,2,3,4}; TEST $CLI volume start $GMV0 ##create_and_start_slave_volume -TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4}; #5 +TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4}; TEST $CLI volume start $GSV0 ##Create, start and mount meta_volume TEST $CLI volume create $META_VOL replica 3 $H0:$B0/${META_VOL}{1,2,3}; TEST $CLI volume start $META_VOL TEST mkdir -p $META_MNT -TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT #10 +TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT ##Mount master TEST glusterfs -s $H0 --volfile-id $GMV0 $M0 @@ -52,98 +62,97 @@ TEST glusterfs -s $H0 --volfile-id $GSV0 $M1 #Check Hybrid Crawl TEST create_data "hybrid" TEST create_georep_session $master $slave -EXPECT 4 check_status_num_rows "Created" #15 +EXPECT_WITHIN $GEO_REP_TIMEOUT 4 check_status_num_rows "Created" + +#Config gluster-command-dir +TEST $GEOREP_CLI $master $slave config gluster-command-dir ${GLUSTER_CMD_DIR} + +#Config gluster-command-dir +TEST $GEOREP_CLI $master $slave config slave-gluster-command-dir ${GLUSTER_CMD_DIR} #Enable_metavolume TEST $GEOREP_CLI $master $slave config use_meta_volume true +#Set changelog roll-over time to 3 secs +TEST $CLI volume set $GMV0 changelog.rollover-time 3 + #Start_georep TEST $GEOREP_CLI $master $slave start -sleep 10 -EXPECT 2 check_status_num_rows "Active" -EXPECT 2 check_status_num_rows "Passive" - -#DATA_TESTS HYBRID -sleep 15 -TEST regular_file_ok ${slave_mnt}/hybrid_f1 #20 -TEST directory_ok ${slave_mnt}/$hybrid_d1 -TEST rename_ok ${slave_mnt}/hybrid_f3 ${slave_mnt}/hybrid_f4 -TEST rename_ok ${slave_mnt}/hybrid_d3 ${slave_mnt}/hybrid_d4 -TEST symlink_ok hybrid_f1 ${slave_mnt}/hybrid_sl1 -TEST hardlink_file_ok ${slave_mnt}/hybrid_f1 ${slave_mnt}/hybrid_hl1 #25 -TEST unlink_ok ${slave_mnt}/hybrid_f2 -TEST unlink_ok ${slave_mnt}/hybrid_d2 -TEST data_ok ${slave_mnt}/hybrid_f1 "HelloWorld!" -TEST chown_file_ok ${slave_mnt}/hybrid_chown_f1 - +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Active" +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive" + +#data_tests "hybrid" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/hybrid_f1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/$hybrid_d1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/hybrid_f3 ${slave_mnt}/hybrid_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/hybrid_d3 ${slave_mnt}/hybrid_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok hybrid_f1 ${slave_mnt}/hybrid_sl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/hybrid_f1 ${slave_mnt}/hybrid_hl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/hybrid_f2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/hybrid_d2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 data_ok ${slave_mnt}/hybrid_f1 "HelloWorld!" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/hybrid_chown_f1 #Check History Crawl. -TEST $GEOREP_CLI $master $slave stop #30 +TEST $GEOREP_CLI $master $slave stop TEST create_data "history" TEST $GEOREP_CLI $master $slave start -sleep 10 -EXPECT 2 check_status_num_rows "Active" -EXPECT 2 check_status_num_rows "Passive" - - +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Active" +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive" #data_tests "history" -sleep 15 -TEST regular_file_ok ${slave_mnt}/history_f1 #35 -TEST directory_ok ${slave_mnt}/history_d1 -TEST rename_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4 -TEST rename_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4 -TEST symlink_ok history_f1 ${slave_mnt}/history_sl1 -TEST hardlink_file_ok ${slave_mnt}/history_f1 ${slave_mnt}/history_hl1 #40 -TEST unlink_ok ${slave_mnt}/history_f2 -TEST unlink_ok ${slave_mnt}/history_d2 -TEST data_ok ${slave_mnt}/history_f1 "HelloWorld!" -TEST chown_file_ok ${slave_mnt}/history_chown_f1 - -#Check History Crawl. -TEST create_data "changelog" #45 -sleep 15 -TEST check_status "Changelog Crawl" - -#data_tests "changelog" -sleep 15 -TEST regular_file_ok ${slave_mnt}/changelog_f1 -TEST directory_ok ${slave_mnt}/changelog_d1 -TEST rename_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4 -TEST rename_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4 #50 -TEST symlink_ok changelog_f1 ${slave_mnt}/changelog_sl1 -TEST hardlink_file_ok ${slave_mnt}/changelog_f1 ${slave_mnt}/changelog_hl1 -TEST unlink_ok ${slave_mnt}/changelog_f2 -TEST unlink_ok ${slave_mnt}/changelog_d2 -TEST data_ok ${slave_mnt}/changelog_f1 "HelloWorld!" #55 -TEST chown_file_ok ${slave_mnt}/changelog_chown_f1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/history_f1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/history_d1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok history_f1 ${slave_mnt}/history_sl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/history_f1 ${slave_mnt}/history_hl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/history_f2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/history_d2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 data_ok ${slave_mnt}/history_f1 "HelloWorld!" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/history_chown_f1 + +#Check Changelog Crawl. +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Changelog Crawl" +TEST create_data "changelog" # logrotate test -logrotate_simulate logrotate_test_file 2 -logrotate_simulate logrotate_test_file 2 -logrotate_simulate logrotate_test_file 2 -logrotate_simulate logrotate_test_file 2 -sleep 15 -EXPECT 0 check_status_num_rows "Faulty" +logrotate_file=${master_mnt}/logrotate/lg_test_file +TEST mkdir -p ${master_mnt}/logrotate +logrotate_simulate $logrotate_file 2 +logrotate_simulate $logrotate_file 2 +logrotate_simulate $logrotate_file 2 +logrotate_simulate $logrotate_file 2 # CREATE + RENAME -create_rename create_rename_test_file -sleep 15 -TEST $GEOREP_CLI $master $slave stop -sleep 5 -TEST $GEOREP_CLI $master $slave start -sleep 15 -TEST create_rename_ok create_rename_test_file #58 +create_rename ${master_mnt}/rename_test_file # hard-link rename -hardlink_rename hardlink_rename_test_file -sleep 15 -TEST $GEOREP_CLI $master $slave stop -sleep 5 -TEST $GEOREP_CLI $master $slave start -sleep 15 -TEST hardlink_rename_ok hardlink_rename_test_file +hardlink_rename ${master_mnt}/hardlink_rename_test_file + +#SYNC CHECK +#data_tests "changelog" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/changelog_f1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/changelog_d1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok changelog_f1 ${slave_mnt}/changelog_sl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/changelog_f1 ${slave_mnt}/changelog_hl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/changelog_f2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/changelog_d2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 data_ok ${slave_mnt}/changelog_f1 "HelloWorld!" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/changelog_chown_f1 + +#logrotate +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/logrotate +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate + +#CREATE+RENAME +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 create_rename_ok ${slave_mnt}/create_rename_test_file + +#hardlink rename +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_rename_ok ${slave_mnt}/hardlink_rename_test_file #Stop Geo-rep TEST $GEOREP_CLI $master $slave stop @@ -151,6 +160,12 @@ TEST $GEOREP_CLI $master $slave stop #Delete Geo-rep TEST $GEOREP_CLI $master $slave delete +#Cleanup are-equal binary +TEST rm $AREQUAL_PATH/arequal-checksum + +#Cleanup authorized keys +sed -i '/^command=.*SSH_ORIGINAL_COMMAND#.*/d' ~/.ssh/authorized_keys +sed -i '/^command=.*gsyncd.*/d' ~/.ssh/authorized_keys + cleanup; -#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=000000 #G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000 diff --git a/tests/geo-rep/georep-basic-dr-tarssh.t b/tests/geo-rep/georep-basic-dr-tarssh.t index 5f879db99c..81b2a0b21c 100644 --- a/tests/geo-rep/georep-basic-dr-tarssh.t +++ b/tests/geo-rep/georep-basic-dr-tarssh.t @@ -4,9 +4,15 @@ . $(dirname $0)/../volume.rc . $(dirname $0)/../geo-rep.rc -################################################# -# BASIC TESTS WITH DISTRIBUTE REPLICATE VOLUMES -################################################# +AREQUAL_PATH=$(dirname $0)/../utils +test "`uname -s`" != "Linux" && { + CFLAGS="$CFLAGS -I$(dirname $0)/../../../contrib/argp-standalone "; + CFLAGS="$CFLAGS -L$(dirname $0)/../../../contrib/argp-standalone -largp "; + CFLAGS="$CFLAGS -lintl"; +} +build_tester $AREQUAL_PATH/arequal-checksum.c $CFLAGS + +### Basic Tests with Distribute Replicate volumes ##Cleanup and start glusterd cleanup; @@ -17,7 +23,8 @@ TEST pidof glusterd ##Variables GEOREP_CLI="$CLI volume geo-replication" master=$GMV0 -slave=${H0}::${GSV0} +SH0="127.0.0.1" +slave=${SH0}::${GSV0} num_active=2 num_passive=2 master_mnt=$M0 @@ -32,14 +39,14 @@ TEST $CLI volume create $GMV0 replica 2 $H0:$B0/${GMV0}{1,2,3,4}; TEST $CLI volume start $GMV0 ##create_and_start_slave_volume -TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4}; #5 +TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4}; TEST $CLI volume start $GSV0 ##Create, start and mount meta_volume TEST $CLI volume create $META_VOL replica 3 $H0:$B0/${META_VOL}{1,2,3}; TEST $CLI volume start $META_VOL TEST mkdir -p $META_MNT -TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT #10 +TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT ##Mount master TEST glusterfs -s $H0 --volfile-id $GMV0 $M0 @@ -54,72 +61,100 @@ TEST glusterfs -s $H0 --volfile-id $GSV0 $M1 #Check Hybrid Crawl TEST create_data "hybrid" TEST create_georep_session $master $slave -EXPECT 4 check_status_num_rows "Created" #15 +EXPECT_WITHIN $GEO_REP_TIMEOUT 4 check_status_num_rows "Created" + +#Config gluster-command-dir +TEST $GEOREP_CLI $master $slave config gluster-command-dir ${GLUSTER_CMD_DIR} + +#Config gluster-command-dir +TEST $GEOREP_CLI $master $slave config slave-gluster-command-dir ${GLUSTER_CMD_DIR} #Enable_metavolume TEST $GEOREP_CLI $master $slave config use_meta_volume true +#Set changelog roll-over time to 3 secs +TEST $CLI volume set $GMV0 changelog.rollover-time 3 + #Config tarssh as sync-engine TEST $GEOREP_CLI $master $slave config use_tarssh true #Start_georep TEST $GEOREP_CLI $master $slave start -sleep 10 -EXPECT 2 check_status_num_rows "Active" -EXPECT 2 check_status_num_rows "Passive" #20 - -#DATA_TESTS HYBRID -sleep 15 -TEST regular_file_ok ${slave_mnt}/hybrid_f1 -TEST directory_ok ${slave_mnt}/$hybrid_d1 -TEST rename_ok ${slave_mnt}/hybrid_f3 ${slave_mnt}/hybrid_f4 -TEST rename_ok ${slave_mnt}/hybrid_d3 ${slave_mnt}/hybrid_d4 -TEST symlink_ok hybrid_f1 ${slave_mnt}/hybrid_sl1 #25 -TEST hardlink_file_ok ${slave_mnt}/hybrid_f1 ${slave_mnt}/hybrid_hl1 -TEST unlink_ok ${slave_mnt}/hybrid_f2 -TEST unlink_ok ${slave_mnt}/hybrid_d2 -TEST data_ok ${slave_mnt}/hybrid_f1 "HelloWorld!" -TEST chown_file_ok ${slave_mnt}/hybrid_chown_f1 #30 +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Active" +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive" + +#data_tests "hybrid" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/hybrid_f1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/$hybrid_d1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/hybrid_f3 ${slave_mnt}/hybrid_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/hybrid_d3 ${slave_mnt}/hybrid_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok hybrid_f1 ${slave_mnt}/hybrid_sl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/hybrid_f1 ${slave_mnt}/hybrid_hl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/hybrid_f2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/hybrid_d2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 data_ok ${slave_mnt}/hybrid_f1 "HelloWorld!" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/hybrid_chown_f1 #Check History Crawl. TEST $GEOREP_CLI $master $slave stop TEST create_data "history" TEST $GEOREP_CLI $master $slave start -sleep 10 -EXPECT 2 check_status_num_rows "Active" -EXPECT 2 check_status_num_rows "Passive" #35 +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Active" +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive" #data_tests "history" -sleep 15 -TEST regular_file_ok ${slave_mnt}/history_f1 -TEST directory_ok ${slave_mnt}/history_d1 -TEST rename_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4 -TEST rename_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4 -TEST symlink_ok history_f1 ${slave_mnt}/history_sl1 #40 -TEST hardlink_file_ok ${slave_mnt}/history_f1 ${slave_mnt}/history_hl1 -TEST unlink_ok ${slave_mnt}/history_f2 -TEST unlink_ok ${slave_mnt}/history_d2 -TEST data_ok ${slave_mnt}/history_f1 "HelloWorld!" -TEST chown_file_ok ${slave_mnt}/history_chown_f1 #45 - -#Check History Crawl. +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/history_f1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/history_d1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok history_f1 ${slave_mnt}/history_sl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/history_f1 ${slave_mnt}/history_hl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/history_f2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/history_d2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 data_ok ${slave_mnt}/history_f1 "HelloWorld!" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/history_chown_f1 + +#Check Changelog Crawl. +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Changelog Crawl" TEST create_data "changelog" -sleep 15 -TEST check_status "Changelog Crawl" +# logrotate test +logrotate_file=${master_mnt}/logrotate/lg_test_file +TEST mkdir -p ${master_mnt}/logrotate +logrotate_simulate $logrotate_file 2 +logrotate_simulate $logrotate_file 2 +logrotate_simulate $logrotate_file 2 +logrotate_simulate $logrotate_file 2 + +# CREATE + RENAME +create_rename ${master_mnt}/rename_test_file + +# hard-link rename +hardlink_rename ${master_mnt}/hardlink_rename_test_file + +#SYNC CHECK #data_tests "changelog" -sleep 15 -TEST regular_file_ok ${slave_mnt}/changelog_f1 -TEST directory_ok ${slave_mnt}/changelog_d1 -TEST rename_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4 #50 -TEST rename_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4 -TEST symlink_ok changelog_f1 ${slave_mnt}/changelog_sl1 -TEST hardlink_file_ok ${slave_mnt}/changelog_f1 ${slave_mnt}/changelog_hl1 -TEST unlink_ok ${slave_mnt}/changelog_f2 -TEST unlink_ok ${slave_mnt}/changelog_d2 #55 -TEST data_ok ${slave_mnt}/changelog_f1 "HelloWorld!" -TEST chown_file_ok ${slave_mnt}/changelog_chown_f1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/changelog_f1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/changelog_d1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok changelog_f1 ${slave_mnt}/changelog_sl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/changelog_f1 ${slave_mnt}/changelog_hl1 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/changelog_f2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/changelog_d2 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 data_ok ${slave_mnt}/changelog_f1 "HelloWorld!" +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/changelog_chown_f1 + +#logrotate +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/logrotate +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate + +#CREATE+RENAME +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 create_rename_ok ${slave_mnt}/create_rename_test_file + +#hardlink rename +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_rename_ok ${slave_mnt}/hardlink_rename_test_file #Stop Geo-rep TEST $GEOREP_CLI $master $slave stop @@ -127,6 +162,12 @@ TEST $GEOREP_CLI $master $slave stop #Delete Geo-rep TEST $GEOREP_CLI $master $slave delete +#Cleanup are-equal binary +TEST rm $AREQUAL_PATH/arequal-checksum + +#Cleanup authorized keys +sed -i '/^command=.*SSH_ORIGINAL_COMMAND#.*/d' ~/.ssh/authorized_keys +sed -i '/^command=.*gsyncd.*/d' ~/.ssh/authorized_keys + cleanup; -#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=000000 #G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000 diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 73d632110a..154ac146c4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -67,7 +67,7 @@ struct gsync_config_opt_vals_ gsync_confopt_vals[] = { }; static char *gsync_reserved_opts[] = { - "gluster-command-dir", + "gluster-command", "pid-file", "state-file", "session-owner", @@ -1201,6 +1201,10 @@ gsync_verify_config_options (dict_t *dict, char **op_errstr, char *volname) continue; banned = _gf_false; } + + if (op_name[i] != '\0') + banned = _gf_false; + if (banned) { gf_msg (this->name, GF_LOG_WARNING, 0, GD_MSG_RESERVED_OPTION, @@ -6091,9 +6095,9 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path) * slave pre-configuration ************/ - /* gluster-command-dir */ + /* slave-gluster-command-dir */ runinit_gsyncd_setrx (&runner, conf_path); - runner_add_args (&runner, "gluster-command-dir", SBIN_DIR"/", + runner_add_args (&runner, "slave-gluster-command-dir", SBIN_DIR"/", ".", NULL); RUN_GSYNCD_CMD; diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index f380583701..e071f8f9bc 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -854,9 +854,9 @@ configure_syncdaemon (glusterd_conf_t *conf) * slave pre-configuration ************/ - /* gluster-command-dir */ + /* slave-gluster-command-dir */ runinit_gsyncd_setrx (&runner, conf); - runner_add_args (&runner, "gluster-command-dir", SBIN_DIR"/", + runner_add_args (&runner, "slave-gluster-command-dir", SBIN_DIR"/", ".", NULL); RUN_GSYNCD_CMD; |