]> git.sur5r.net Git - bacula/bacula/commitdiff
Manual drive change code
authorKern Sibbald <kern@sibbald.com>
Wed, 25 Jun 2008 21:18:18 +0000 (21:18 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 25 Jun 2008 21:18:18 +0000 (21:18 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7235 91ce42f0-d328-0410-95d8-f526ca767f89

regress/scripts/functions

index 4a63c5c7dd5ebd097a93e3475083e5c82d1f539c..6fa0378e511c6d8e6e14a5329be27597230350d3 100644 (file)
@@ -293,6 +293,44 @@ init_drive()
   fi
 }
 
+rewind_drive()
+{
+  if test a$USE_VTAPE = a; then
+    mt -f $1 rewind
+  fi
+}
+
+
+#
+# $1 has currently loaded slot, load the other one i.e. if 1, load 2;
+#    if 2, load 1; if 0 load 1
+#
+load_other_slot()
+{
+rewind_drive ${TAPE_DRIVE}
+case $1 in
+ 0)
+    bin/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
+    slot=1
+    ;;
+ $SLOT1)
+    bin/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $1 ${TAPE_DRIVE} $DRIVE1
+    bin/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT2 ${TAPE_DRIVE} $DRIVE1
+    slot=2
+    ;;
+ $SLOT2)
+    bin/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $1 ${TAPE_DRIVE} $DRIVE1
+    bin/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
+    slot=1
+    ;;
+ *)
+    echo "Something went wrong. Expected $SLOT1 or $SLOT2, got $1"
+    exit 1
+    ;;
+esac
+}
+
+
 # Save current directory
 cwd=`pwd`
 if test "x${REGRESS_DEBUG}" = "x1"; then