From: Kern Sibbald Date: Wed, 22 Feb 2006 18:43:55 +0000 (+0000) Subject: - Back port changes to 1.38.5 X-Git-Tag: Release-1.38.6~9 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6cda4b67a0125e1f8b71698937719cea81ef4df9;p=bacula%2Fbacula - Back port changes to 1.38.5 - Fix recycle SQL for StorageId. - Fix misplaced quote in mtx-changer script. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2805 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/examples/autochangers/chio-bacula b/bacula/examples/autochangers/chio-bacula index 82558c1bc9..d988b0151a 100644 --- a/bacula/examples/autochangers/chio-bacula +++ b/bacula/examples/autochangers/chio-bacula @@ -5,7 +5,7 @@ # # If you set in your Device resource # -# Changer Command = "path-to-this-script/chio-bacula" %c %o %S %a +# Changer Command = "path-to-this-script/chio-bacula %c %o %S %a" # you will have the following input to this script: # # chio-bacula "changer-device" "command" "slot" "archive-device" diff --git a/bacula/examples/autochangers/chio-changer b/bacula/examples/autochangers/chio-changer index 4eba4a3064..60d1ed0990 100644 --- a/bacula/examples/autochangers/chio-changer +++ b/bacula/examples/autochangers/chio-changer @@ -16,7 +16,7 @@ # # If you set in your Device resource # -# Changer Command = "path-to-this-script/chio-changer" %c %o %S %a +# Changer Command = "path-to-this-script/chio-changer %c %o %S %a" # you will have the following input to this script: # # chio-changer "changer-device" "command" "slot" "archive-device" diff --git a/bacula/examples/autochangers/chio-changer.Sony-TSL-SA300C b/bacula/examples/autochangers/chio-changer.Sony-TSL-SA300C index 3710059664..758e416ebe 100755 --- a/bacula/examples/autochangers/chio-changer.Sony-TSL-SA300C +++ b/bacula/examples/autochangers/chio-changer.Sony-TSL-SA300C @@ -9,7 +9,7 @@ # # If you set in your Device resource # -# Changer Command = "path-to-this-script/chio-bacula" %c %o %S %a +# Changer Command = "path-to-this-script/chio-bacula %c %o %S %a" # you will have the following input to this script: # # chio-bacula "changer-device" "command" "slot" "archive-device" @@ -94,58 +94,58 @@ usage() case ${COMMAND} in unload) - # enable the following line if you need to eject the cartridge - #mt -f ${TAPE} off - #sleep 2 - # If the changer is power cycled with a tape loaded in a drive - if [ `${fullpath_me} ${CHANGER} loaded` -gt 0 ]; then - free_slot=`${fullpath_me} ${CHANGER} loaded` - free_slot=`expr $free_slot - 1` - ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $free_slot - fi - ;; + # enable the following line if you need to eject the cartridge + #mt -f ${TAPE} off + #sleep 2 + # If the changer is power cycled with a tape loaded in a drive + if [ `${fullpath_me} ${CHANGER} loaded` -gt 0 ]; then + free_slot=`${fullpath_me} ${CHANGER} loaded` + free_slot=`expr $free_slot - 1` + ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $free_slot + fi + ;; load) - ${MTX} -f ${CHANGER} move slot $((${SLOT}-1)) drive ${DRIVE} - rtn=$? - # Increase the sleep time if you have a slow device - sleep $SLEEP - exit $rtn - ;; + ${MTX} -f ${CHANGER} move slot $((${SLOT}-1)) drive ${DRIVE} + rtn=$? + # Increase the sleep time if you have a slow device + sleep $SLEEP + exit $rtn + ;; list) - if [ "${SIMULATE_BARCODE}" = "true" ]; then - if [ -f "$BARCODE_FILE" ]; then - cat $BARCODE_FILE | grep -v "^#" - exit 0 - else - echo "Barcode file $BARCODE_FILE missing ... exiting!" - exit 1 - fi - else - ${MTX} -f ${CHANGER} status | grep "^slot .*: .*FULL>" | awk '{print $2}' | awk -F: '{print $1+1" "}' | tr -d "[\r\n]" - fi + if [ "${SIMULATE_BARCODE}" = "true" ]; then + if [ -f "$BARCODE_FILE" ]; then + cat $BARCODE_FILE | grep -v "^#" + exit 0 + else + echo "Barcode file $BARCODE_FILE missing ... exiting!" + exit 1 + fi + else + ${MTX} -f ${CHANGER} status | grep "^slot .*: .*FULL>" | awk '{print $2}' | awk -F: '{print $1+1" "}' | tr -d "[\r\n]" + fi ;; loaded) - # echo "Request loaded" - ${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$ - rtn=$? - cat /tmp/mtx.$$ | grep "^slot .: " | awk '{print $2+1}' | tr -d ":" - drive=`cat /tmp/mtx.$$ | grep "^drive .: "` - if [ -n "$drive" ]; then - echo 0 - fi - rm -f /tmp/mtx.$$ - exit $rtn - ;; + # echo "Request loaded" + ${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$ + rtn=$? + cat /tmp/mtx.$$ | grep "^slot .: " | awk '{print $2+1}' | tr -d ":" + drive=`cat /tmp/mtx.$$ | grep "^drive .: "` + if [ -n "$drive" ]; then + echo 0 + fi + rm -f /tmp/mtx.$$ + exit $rtn + ;; slots) - # echo "Request slots" - ${MTX} -f ${CHANGER} status | grep "^slot " | tail -1 | awk '{print $2+1}' | tr -d ":" + # echo "Request slots" + ${MTX} -f ${CHANGER} status | grep "^slot " | tail -1 | awk '{print $2+1}' | tr -d ":" ;; *) - usage + usage ;; esac diff --git a/bacula/examples/autochangers/locking-mtx-changer b/bacula/examples/autochangers/locking-mtx-changer index 8c43621b92..c71169af39 100644 --- a/bacula/examples/autochangers/locking-mtx-changer +++ b/bacula/examples/autochangers/locking-mtx-changer @@ -2,11 +2,16 @@ # # Bacula interface to mtx autoloader # +# This script is not needed with Bacula version 1.38 or later +# since the Storage daemon automatically ensures that only one +# thread accesses the script at a time. +# +# # $Id$ # # If you set in your Device resource # -# Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d +# Changer Command = "path-to-this-script/mtx-changer %c %o %S %a %d # you will have the following input to this script: # # mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index" diff --git a/bacula/examples/autochangers/mtx-changer.Adic-Scalar-24 b/bacula/examples/autochangers/mtx-changer.Adic-Scalar-24 index 8f0dc9d580..9cdf6372f4 100755 --- a/bacula/examples/autochangers/mtx-changer.Adic-Scalar-24 +++ b/bacula/examples/autochangers/mtx-changer.Adic-Scalar-24 @@ -6,7 +6,7 @@ # # If you set in your Device resource # -# Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d +# Changer Command = "path-to-this-script/mtx-changer %c %o %S %a %d" # you will have the following input to this script: # # mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index" diff --git a/bacula/examples/autochangers/multiple-drive-changer.txt b/bacula/examples/autochangers/multiple-drive-changer.txt index 4d2ceca83a..e9fe18d41f 100644 --- a/bacula/examples/autochangers/multiple-drive-changer.txt +++ b/bacula/examples/autochangers/multiple-drive-changer.txt @@ -99,7 +99,7 @@ Content-Disposition: inline; # # If you set in your Device resource # -# Changer Command = "path-to-this-script/multitape-changer" %c %o %S %a %d +# Changer Command = "path-to-this-script/multitape-changer %c %o %S %a %d" # you will have the following input to this script: # # multitape-changer "changer-device" "command" "slot" "archive-device" "drive-index" @@ -255,4 +255,3 @@ case $cmd in esac --------------050209030507060501040304-- - diff --git a/bacula/examples/autochangers/solaris-mtx-changer b/bacula/examples/autochangers/solaris-mtx-changer index fd86992a44..6f68595859 100755 --- a/bacula/examples/autochangers/solaris-mtx-changer +++ b/bacula/examples/autochangers/solaris-mtx-changer @@ -8,11 +8,11 @@ # # If you set in your Device resource # -# Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d +# Changer Command = "path-to-this-script/mtx-changer %c %o %S %a %d" # you will have the following input to this script: # # mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index" -# $1 $2 $3 $4 $5 +# $1 $2 $3 $4 $5 # # for example: # @@ -92,10 +92,10 @@ case $cmd in ;; *) if test $# -lt 3; then - echo "usage: mtx-changer ctl-device command slot archive-device drive" - echo " Insufficient number of arguments arguments given." - echo " Mimimum usage is first three arguments ..." - exit 1 + echo "usage: mtx-changer ctl-device command slot archive-device drive" + echo " Insufficient number of arguments arguments given." + echo " Mimimum usage is first three arguments ..." + exit 1 fi ;; esac @@ -109,9 +109,9 @@ case $cmd in #mt -f $device offline mt -f $device rewoffl if test x$slot = x; then - ${MTX} -f $ctl unload + ${MTX} -f $ctl unload else - ${MTX} -f $ctl unload $slot $drive + ${MTX} -f $ctl unload $slot $drive fi ;; diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index 7c254d3546..58e8ad1d3a 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -4,8 +4,12 @@ General: Changes to 1.39.5 +22Feb06 +- Back port changes to 1.38.5 +- Fix recycle SQL for StorageId. +- Fix misplaced quote in mtx-changer script. 20Feb06 -- Note!!! Your database must be updated, or you must create +- Note. Your database must be updated, or you must create a new database. I have not yet incremented the database level. - Add Location table. - Add LocationId, DeviceId, and MediaTypeId to Media record. @@ -77,7 +81,7 @@ Changes to 1.39.5 - Fix typo (strcpy->strcmp) in ua_prune.c as reported by Martin. - Fix command arg name->volume in label command of gnome-console. - Fix SD acquire.c to release correct DCR by explicitly testing - on the dcr address rather than trying to "devine" if it is a read + on the dcr address rather than trying to devine if it is a read or write dcr. This failed in error conditions when the device was not fully setup. diff --git a/bacula/scripts/disk-changer.in b/bacula/scripts/disk-changer.in index 7181c60f2d..c66799b50e 100644 --- a/bacula/scripts/disk-changer.in +++ b/bacula/scripts/disk-changer.in @@ -6,7 +6,7 @@ # # If you set in your Device resource # -# Changer Command = "path-to-this-script/disk-changer" %c %o %S %a %d +# Changer Command = "path-to-this-script/disk-changer %c %o %S %a %d" # you will have the following input to this script: # # So Bacula will always call with all the following arguments, even though diff --git a/bacula/scripts/mtx-changer.in b/bacula/scripts/mtx-changer.in index 41498ef89e..48eccb8a78 100644 --- a/bacula/scripts/mtx-changer.in +++ b/bacula/scripts/mtx-changer.in @@ -6,7 +6,7 @@ # # If you set in your Device resource # -# Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d +# Changer Command = "path-to-this-script/mtx-changer %c %o %S %a %d" # you will have the following input to this script: # # So Bacula will always call with all the following arguments, even though diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index 048de8fd42..641a1e7700 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -10,7 +10,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/dird/recycle.c b/bacula/src/dird/recycle.c index 11241990ff..dddff5be55 100644 --- a/bacula/src/dird/recycle.c +++ b/bacula/src/dird/recycle.c @@ -77,8 +77,8 @@ int recycle_oldest_purged_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr) oldest.MediaId = 0; if (InChanger) { char changer[100]; - bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s", - edit_uint64(mr->StorageId, ed1)); + bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ", + edit_int64(mr->StorageId, ed1)); Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, changer); } else { Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, "");