]> git.sur5r.net Git - bacula/bacula/commitdiff
Cleanup some autochanger code
authorKern Sibbald <kern@sibbald.com>
Sun, 1 Jun 2008 20:05:15 +0000 (20:05 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 1 Jun 2008 20:05:15 +0000 (20:05 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7088 91ce42f0-d328-0410-95d8-f526ca767f89

regress/scripts/cleanup-2tape.in
regress/scripts/cleanup-tape.in
regress/scripts/functions
regress/scripts/prepare-two-tapes.in
regress/tests/two-volume-changer

index b937ea115ee900b0cadb23dddcd035127416837a..8fa197d4df7b2e0b6ca71afec068f9dccd7a1a1a 100755 (executable)
@@ -6,28 +6,4 @@
 . scripts/functions
 
 scripts/cleanup
-
-if test x@autochanger@ != x/dev/null; then
-   slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
-   if test "x${slot}" != "x$SLOT2"; then
-      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
-      bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
-   fi
-
-   init_drive @tape_drive@
-fi
-
-
-#
-# If we have an autochanger always load tape in slot 1
-#
-if test x@autochanger@ != x/dev/null; then
-   slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
-   if test "x${slot}" != "x$SLOT1"; then
-      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
-      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
-   fi
-fi
-
-init_drive @tape_drive@
-
+scripts/prepare-two-tapes
index ce996089c3df96acd89e8af7a731e89f4b610925..936540289db983a13199aa913ac319d654e000ef 100755 (executable)
@@ -1,19 +1,26 @@
 #!/bin/sh
 #
-# Cleanup left over files -- both before and after test run
+# Cleanup left over files, then load $SLOT1 into drive and    
+#   write an EOF on it.
 #
 
 . scripts/functions
 
 scripts/cleanup
 
-if test "x@autochanger@" != "x/dev/null" ; then
-   a=`bin/@changer_script@ @autochanger@ loaded $SLOT1 @tape_drive@ 0`
-   if test $a = 0 ; then
-     bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ 0
-   fi
+if test x@autochanger@ != x/dev/null; then
+   slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
+   case $slot in
+   0)
+      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      ;;
+   $SLOT1)
+      ;;
+   default)
+      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      ;;
+  esac
 fi
 
 init_drive @tape_drive@
-
-
index 6ddd0570c51e944878b1df5911c82ae80c74b7f8..61d6eb499901cad011a3caa7dd7063fb3ea3d85b 100644 (file)
@@ -282,3 +282,4 @@ fi
 . ${cwd}/config
 
 CLIENT=${HOST}-fd
+AUTOCHANGER_SCRIPT=${AUTOCHANGER_SCRIPT:-mtx-changer}
index 65bcce823cc96b88122102e1e4186c59dfe70eb6..642a8f850ca7ffc8fca4376d955590d2f5b0f66f 100755 (executable)
@@ -28,6 +28,12 @@ if test x@autochanger@ != x/dev/null; then
       init_drive @tape_drive@
       slot=$SLOT2
       ;;
+   default)
+      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      init_drive @tape_drive@
+      slot=$SLOT1
+      ;;
   esac
 
 # init the other slot
index e9e48d27600c54fe52ef8c5927baff6cb0079564..e775a7bf793fbaa7a6fa0878311dd65816a5417c 100755 (executable)
@@ -33,7 +33,7 @@ messages
 @$out tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1
 label storage=DDS-4 volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
-update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=0
+update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=$DRIVE1
 sql
 select * from Storage;
 select VolumeName,InChanger,Slot,StorageId from Media;
@@ -54,9 +54,7 @@ run_bacula
 check_for_zombie_jobs storage=DDS-4
 stop_bacula
 
-mt -f ${TAPE_DRIVE} rewind
-mtx -f ${AUTOCHANGER} unload
-sleep 15
+bin/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $SLOT2 ${TAPE_DRIVE} 0
 
 cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null