From e7ff02c25382a326ba53ceaf03642c1007817adb Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 26 Mar 2007 14:19:09 +0000 Subject: [PATCH] Make prepare 2 tape script wait for drive to ready git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4427 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/scripts/prepare-two-tapes.in | 27 +++++++++++++++++++++++++++ regress/tests/two-volume-tape | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/regress/scripts/prepare-two-tapes.in b/regress/scripts/prepare-two-tapes.in index 8d47b7e8c0..611fb906f7 100755 --- a/regress/scripts/prepare-two-tapes.in +++ b/regress/scripts/prepare-two-tapes.in @@ -1,14 +1,41 @@ #!/bin/sh # # Create two blank tapes +# +OS=`uname` +case ${OS} in + SunOS) + ready="No Additional Sense" + ;; + FreeBSD) + ready="Current Driver State: at rest." + ;; + *) + ready="ONLINE" + ;; +esac +wait_for_drive() { + i=0 + while [ $i -le 300 ]; do # Wait max 300 seconds + if mt -f $1 status | grep ${ready} >/dev/null 2>&1; then + break + fi +# debug "Device $1 - not ready, retrying..." + sleep 1 + i=`expr $i + 1` + done +} + # # mt -f @tape_drive@ offline @changer_path@ -f @autochanger@ unload @changer_path@ -f @autochanger@ load 1 +wait_for_drive @tape_drive@ mt -f @tape_drive@ rewind mt -f @tape_drive@ weof @changer_path@ -f @autochanger@ unload @changer_path@ -f @autochanger@ load 2 +wait_for_drive @tape_drive@ mt -f @tape_drive@ rewind mt -f @tape_drive@ weof #@changer_path@ -f @autochanger@ unload diff --git a/regress/tests/two-volume-tape b/regress/tests/two-volume-tape index b26e0a9d85..83c9347bc1 100755 --- a/regress/tests/two-volume-tape +++ b/regress/tests/two-volume-tape @@ -10,7 +10,6 @@ JobName=twovoltape . scripts/functions set_debug 0 - . config.out if test x${AUTOCHANGER} = x/dev/null ; then echo "two-volume-tape test skipped. No autochanger." -- 2.39.5