From: Radoslaw Korzeniewski Date: Wed, 15 Jul 2020 15:08:15 +0000 (+0200) Subject: regress: Add regress script for GPFS code X-Git-Tag: Release-11.3.2~1382 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ce3c3836b8a309170cbb7ea7d3d00781e4b529f;p=thirdparty%2Fbacula.git regress: Add regress script for GPFS code --- diff --git a/regress/.gitignore b/regress/.gitignore index 084250c359..6ee40cacc7 100644 --- a/regress/.gitignore +++ b/regress/.gitignore @@ -43,4 +43,9 @@ scripts/prepare-two-tapes scripts/regress-config scripts/update-ctest scripts/mtx-changer +<<<<<<< HEAD +======= +scripts/k8s_backend +scripts/bacula-dir.conf.gpfs +>>>>>>> e694fcf7a1... regress: Add regress script for GPFS code /tmp2/ diff --git a/regress/prototype.conf b/regress/prototype.conf index 087b40f280..5ca729ae2c 100644 --- a/regress/prototype.conf +++ b/regress/prototype.conf @@ -203,3 +203,9 @@ REMOTE_STORE_ADDR="zzzz" # you can use: unix:///var/run/docker.sock # to simulate remote operation with local socket #PLUGDOCKERHOST="tcp://10.0.0.1:2376" + +# +# This is a config variable for GPFS regression tests +# It should point to the mounted GPFS +# +#GPFSDIR=/gpfs diff --git a/regress/scripts/do_sed b/regress/scripts/do_sed index 23af678a9c..46caccf6f0 100755 --- a/regress/scripts/do_sed +++ b/regress/scripts/do_sed @@ -38,6 +38,7 @@ sed -f ${out} ${rscripts}/migrate-bacula-sd.conf.in >${rscripts}/migrate-bacula- sed -f ${out} ${rscripts}/virtualfull-extreme-bacula-dir.conf.in >${rscripts}/virtualfull-extreme-bacula-dir.conf sed -f ${out} ${rscripts}/test-console.conf.in >${rscripts}/test-console.conf sed -f ${out} ${rscripts}/crypto-bacula-fd.conf.in >${rscripts}/crypto-bacula-fd.conf +sed -f ${out} ${rscripts}/gpfs-bacula-dir.conf.in >${rscripts}/gpfs-bacula-dir.conf sed -f ${out} ${rscripts}/bacula-dir-tape.conf.in >${rscripts}/bacula-dir-tape.conf sed -f ${out} ${rscripts}/bacula-dir-2client.conf.in >${rscripts}/bacula-dir-2client.conf sed -f ${out} ${rscripts}/bacula-dir-2media-virtual.conf.in >${rscripts}/bacula-dir-2media-virtual.conf @@ -95,7 +96,7 @@ if test -f ${conf}/bacula-sd.conf ; then cp ${conf}/bacula-sd.conf ${tmp}/bac$$ sed "s% /tmp%${tmp}%g" ${tmp}/bac$$ >${conf}/bacula-sd.conf fi -chmod 755 ${rscripts}/cleanup-*tape ${rscripts}/cleanup-*drive ${rscripts}/prepare-two-tapes +chmod 755 ${rscripts}/cleanup-*tape ${rscripts}/cleanup-*drive ${rscripts}/prepare-two-tapes rm -f ${tmp}/tmp/bac$$ cp ${scripts}/mtx-changer ${tmp}/bac$$ sed "s%^MTX.*$%MTX=${AUTOCHANGER_PATH}%g" ${tmp}/bac$$ >${scripts}/mtx-changer diff --git a/regress/scripts/gpfs-bacula-dir.conf.in b/regress/scripts/gpfs-bacula-dir.conf.in new file mode 100644 index 0000000000..44df87a702 --- /dev/null +++ b/regress/scripts/gpfs-bacula-dir.conf.in @@ -0,0 +1,112 @@ +# +# Default Bacula Director Configuration file +# +# The only thing that MUST be changed is to add one or more +# file or directory names in the Include directive of the +# FileSet resource. +# +# For Bacula release 1.39.27 (24 October 2006) -- debian testing/unstable +# +# You might also want to change the default email address +# from root to your address. See the "mail" and "operator" +# directives in the Messages resource. +# + +Director { # define myself + Name = @hostname@-dir + DIRPort = @dirport@ # where we listen for UA connections + QueryFile = "@scriptdir@/query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@piddir@" + SubSysDirectory = "@subsysdir@" + Maximum Concurrent Jobs = 4 + Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3" # Console password + Messages = Standard +} + +JobDefs { + Name = "DefaultJob" + Type = Backup + Level = Incremental + Client = @hostname@-fd + FileSet = GPFS + Storage = File + Messages = Standard + Pool = Default + Priority = 10 + Maximum Concurrent Jobs = 16 +} + +FileSet { + Name = GPFS + Include { + Options { + aclsupport = yes + } + File = <@tmpdir@/file-list + } +} + +Job { + Name = backup + Accurate = yes + JobDefs = DefaultJob +} + +# Standard Restore template, to be changed by Console program +Job { + Name = "RestoreFiles" + Type = Restore + Client=@hostname@-fd + FileSet= GPFS + Storage = File + Messages = Standard + Pool = Default + Where = @tmpdir@/bacula-restores +} + +# Client (File Services) to backup +Client { + Name = @hostname@-fd + Address = @hostname@ + FDPort = @fdport@ + Catalog = MyCatalog + Password = "xevrjURYoCHhn26RaJoWbeWXEY/a3VqGKp/37tgWiuHc" # password for FileDaemon + File Retention = 30d # 30 days + Job Retention = 180d # six months + AutoPrune = yes # Prune expired Jobs/Files + Maximum Concurrent Jobs = 4 +} + +# Definiton of file storage device +Storage { + Name = File + Address = @hostname@ # N.B. Use a fully qualified name here + SDPort = @sdport@ + Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9" + Device = FileStorage + Media Type = File + Maximum Concurrent Jobs = 4 +} + +# Generic catalog service +Catalog { + Name = MyCatalog + @libdbi@ + dbname = @db_name@; user = @db_user@; password = "@db_password@" +} + +Messages { + Name = Standard + console = all, !skipped, saved + catalog = all, !skipped +} + +# Default pool definition +Pool { + Name = Default + Pool Type = Backup + Recycle = yes # Bacula can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 365d # one year +} diff --git a/regress/scripts/gpfs-copy-confs b/regress/scripts/gpfs-copy-confs new file mode 100755 index 0000000000..9a0ce55b1a --- /dev/null +++ b/regress/scripts/gpfs-copy-confs @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Copyright (C) 2000-2017 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +. scripts/functions +/bin/cp -f ${rscripts}/gpfs-bacula-dir.conf ${conf}/bacula-dir.conf +/bin/cp -f ${rscripts}/test-bacula-sd.conf ${conf}/bacula-sd.conf +/bin/cp -f ${rscripts}/test-bacula-fd.conf ${conf}/bacula-fd.conf +/bin/cp -f ${rscripts}/test-console.conf ${conf}/bconsole.conf +/bin/cp -f ${rscripts}/test-console.conf ${conf}/bat.conf + +${rscripts}/set_tape_options diff --git a/regress/scripts/regress-utils.sh b/regress/scripts/regress-utils.sh index a4a4665f83..154ade1484 100644 --- a/regress/scripts/regress-utils.sh +++ b/regress/scripts/regress-utils.sh @@ -65,7 +65,9 @@ do_regress_unittest() tname=$1 tdirloc=$2 make -C ${src}/${tdirloc} ${tname} -${src}/${tdirloc}/${tname} +if test $? -eq 0; then + ${src}/${tdirloc}/${tname} +fi exit $? } @@ -82,7 +84,7 @@ ltest=$1 blevel="full" if [ "x$2" != "x" ] then - blevel=$2 + blevel=$2 fi printf " backup test${ltest} ... " cat << END_OF_DATA >${tmp}/bconcmds @@ -144,7 +146,7 @@ lpath=$2 lplug=$LPLUG if [ "x$3" != "x" ] then - lplug=$3 + lplug=$3 fi printf " listing test${ltest} ... " cat << END_OF_DATA >${tmp}/bconcmds diff --git a/regress/tests/gpfs-acl-test b/regress/tests/gpfs-acl-test new file mode 100755 index 0000000000..c80dac1a69 --- /dev/null +++ b/regress/tests/gpfs-acl-test @@ -0,0 +1,164 @@ +#!/bin/sh +# +# Copyright (C) 2000-2015 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# + +# +# Run a backup of the GPFS directory with some acls then restore it. +# The test requires $GPFSDIR env variable set which will points to gpfs mounted filesystem +# +TestName="gpfs-acl-test" +JobName=backup +. scripts/functions + +# +# See if the right software is installed. +# +if test x$GPFSDIR = x; then + echo "$TestName skipped: \$GPFSDIR not set but required" + exit 0 +fi + +if test x`uname -s` != xLinux; then + echo "$TestName skipped: test is supported on Linux only" + exit 0 +fi + +mmgetacl $GPFSDIR 2>&1 >/dev/null +if test $? -ne 0; then + echo "$TestName skipped: mmgetacl not installed" + exit 0 +fi + +scripts/cleanup +scripts/gpfs-copy-confs + +d=$GPFSDIR/acl +rm -rf $d +mkdir -p $d +mkdir -p $d/acl-dir +cp ${cwd}/bin/bconsole $d/bconsole +cp ${cwd}/bin/bconsole $d/other + +cat > $d/acl.param.acl << EOD +#owner:root +#group:root +user::rwxc +group::rwx- +other::--x- +mask::rwxc +user:bacula:r-xc +group:sys:rwx- +group:adm:rw-- +EOD + +cat > $d/acl.param.nfs4 << EOD +#NFSv4 ACL +#owner:root +#group:root +special:owner@:rwxc:allow + (X)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL (X)READ_ATTR (X)READ_NAMED + (-)DELETE (-)DELETE_CHILD (X)CHOWN (X)EXEC/SEARCH (X)WRITE_ACL (X)WRITE_ATTR (X)WRITE_NAMED + +user:bacula:-w--:deny + (-)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (-)SYNCHRONIZE (-)READ_ACL (-)READ_ATTR (-)READ_NAMED + (-)DELETE (X)DELETE_CHILD (-)CHOWN (-)EXEC/SEARCH (-)WRITE_ACL (X)WRITE_ATTR (-)WRITE_NAMED + +user:bacula:r-xc:allow + (X)READ/LIST (-)WRITE/CREATE (-)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL (X)READ_ATTR (X)READ_NAMED + (-)DELETE (-)DELETE_CHILD (-)CHOWN (X)EXEC/SEARCH (X)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED + +special:group@:rwx-:allow + (X)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL (X)READ_ATTR (X)READ_NAMED + (-)DELETE (-)DELETE_CHILD (-)CHOWN (X)EXEC/SEARCH (-)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED + +group:sys:rwx-:allow + (X)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL (X)READ_ATTR (X)READ_NAMED + (-)DELETE (-)DELETE_CHILD (-)CHOWN (X)EXEC/SEARCH (-)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED + +group:adm:rw--:allow + (X)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL (X)READ_ATTR (X)READ_NAMED + (-)DELETE (-)DELETE_CHILD (-)CHOWN (-)EXEC/SEARCH (-)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED + +group:adm:--xc:deny + (-)READ/LIST (-)WRITE/CREATE (-)APPEND/MKDIR (-)SYNCHRONIZE (-)READ_ACL (-)READ_ATTR (-)READ_NAMED + (-)DELETE (X)DELETE_CHILD (-)CHOWN (X)EXEC/SEARCH (X)WRITE_ACL (X)WRITE_ATTR (-)WRITE_NAMED + +special:everyone@:--x-:allow + (-)READ/LIST (-)WRITE/CREATE (-)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL (X)READ_ATTR (X)READ_NAMED + (-)DELETE (-)DELETE_CHILD (-)CHOWN (X)EXEC/SEARCH (-)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED + +EOD + +mmputacl -d -i $d/acl.param.acl $d/acl-dir 2>/dev/null 1>/dev/null +mmputacl -i $d/acl.param.acl $d/bconsole 2>/dev/null 1>/dev/null +mmputacl -i $d/acl.param.nfs4 $d/other 2>/dev/null 1>/dev/null + +cp ${cwd}/bin/bconsole $d/acl-dir/bconsole + +cat > ${tmp}/file-list << EOD +$d/acl-dir +$d/bconsole +$d/other +EOD + +change_jobname backup $JobName +start_test + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0 +setdebug level=500 trace=1 client +setdebug level=500 trace=1 director +@#setdebug level=300 trace=1 storage=File1 +run job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out ${cwd}/tmp/log2.out +restore where=${d}/bacula-restores select all done +yes +wait +messages +quit +END_OF_DATA + +# create a file list for backup + +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula + +# now get restored acls +mmgetacl -d $d/acl-dir -o ${tmp}/acl-dir.default.acl 2>/dev/null 1>/dev/null +mmgetacl $d/bconsole -o ${tmp}/bconsole.access.acl 2>/dev/null 1>/dev/null +mmgetacl $d/other -o ${tmp}/other.access.nfs4 2>/dev/null 1>/dev/null + +diff -u ${tmp}/acl-dir.default.acl $d/acl.param.acl +if [ $? -ne 0 ]; then + rstat=1 +fi + +diff -u ${tmp}/bconsole.access.acl $d/acl.param.acl +if [ $? -ne 0 ]; then + rstat=1 +fi + +diff -u ${tmp}/other.access.nfs4 $d/acl.param.nfs4 +if [ $? -ne 0 ]; then + rstat=1 +fi + +check_two_logs +# check_restore_diff + +if [ x$REGRESS_DEBUG != x ]; then + rm -rf $d +fi + +end_test