Hi,

On 7/7/2006 6:25 PM, Christoff Buch wrote:
> 
> Hi Arno
> 
> This has taken a while but here come mtx and bacula-sd.conf:
> 
> 
> 
> 
> 
> As to the btape test results:
> I can't find my files with the results at the moment (oops...), but I 
> have the print-outs here:
> I reviewed them again (as I already did when I started with the 
> autochanger) and there is really not a single error whatsoever.
> I did the normal test for the drive as such and the test for the 
> autochanger. Both succeded fine.

A good start, at least...

> If you can find anything, answers would be very appreciated!

Well, I looked them over, and - see below.

> Thanks again + Best Regards,
> 
> Christoff Buch
...
> ------------------------------------------------------------------------
> 
> #!/bin/sh
> #
> # Bacula interface to mtx autoloader  Adapted by Christoff Buch, OneVision 
> Software AG, 2006-05-31
> #
> #  $Id: mtx-changer.in,v 1.21.2.7 2006/05/02 14:48:12 kerns Exp $
> #
> #  If you set in your Device resource
> #
> #  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
> #    in come cases, not all are used.
> #
> #  mtx-changer "changer-device" "command" "slot" "archive-device" 
> "drive-index"
> #                $1              $2       $3        $4               $5
> #
> #  for example:
> #
> #  mtx-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system)
> # 
> #  will request to load the first cartidge into drive 0, where
> #   the SCSI control channel is /dev/sg0, and the read/write device
> #   is /dev/nst0.
> #
> #  If you need to an offline, refer to the drive as $4
> #    e.g.   mt -f $4 offline
> #
> #  Many changers need an offline after (Sorry, not before?) the unload. Also 
> many
> #   changers need a sleep 60 after the mtx load.
> #
> #  N.B. If you change the script, take care to return either 
> #   the mtx exit code or a 0. If the script exits with a non-zero
> #   exit code, Bacula will assume the request failed.
> #
> 
> MTX=mtx
> 
> #
> # log whats done
> #
> # to turn on logging, uncomment the following line

You might consider turning on logging. Personally, I also like some more 
extensive output in the debug log, like mtx output.

> #touch /usr/local/bacula/working/mtx.log
> #
> dbgfile="/usr/local/bacula/working/mtx.log"
> debug() {
>     if test -f $dbgfile; then
>       echo "`date +\"%Y%m%d-%H:%M:%S\"` $*" >> $dbgfile
>     fi
> }
> 
> 
> #
> # Create a temporary file
> #
> make_temp_file() {
...
> }
> 
> #
> # The purpose of this function to wait a maximum 
> #   time for the drive. It will
> #   return as soon as the drive is ready, or after
> #   waiting a maximum of 300 seconds.
> # Note, this is very system dependent, so if you are
> #   not running on Linux, you will probably need to
> #   re-write it, or at least change the grep target.
> #
> wait_for_drive() {
>   i=0 
>   while [ $i -le 300 ]; do  # Wait max 300 seconds
>     if mt -f $1 status | grep ONLINE  >/dev/null 2>&1; then
>       break
>     fi
>     debug "Device $1 - not ready, retrying..."
>     sleep 1
>     i=`expr $i + 1`
>   done
> }

Ok, here it might happen that waiting for the drive times out without 
notification.

I use a longer wait time per loop, and you should log the result of the 
last check, for example.

Also, there is a last-resort timeout in the SD configuration: "Maximum 
Changer Wait = time in seconds" should be set to a time longer than any 
mtx-changer operation should ever take. I have this set to a very long time.

> # check parameter count on commandline
> #
> check_parm_count() {
...
> 
> # Check for special cases where only 2 arguments are needed, 
> #  all others are a minimum of 5
> #
...
> case $cmd in 
>    unload)
>       debug "Doing mtx -f $ctl unload $slot $drive"
> #
> # enable the following line if you need to eject the cartridge
> # the following two(!)lines enabled by Christoff Buch, OneVision Software AG, 
> 2006-05-31
>       mt -f $device offline
>       sleep 10

should not be a problem, but when reading this I thought about adding a 
"negative" wait_for_drive, some function that makes sure a tape is not 
loaded (but perhaps in the drive).

>       ${MTX} -f $ctl unload $slot $drive
>       ;;
> 
>    load)
>       debug "Doing mtx -f $ctl load $slot $drive"
>       ${MTX} -f $ctl load $slot $drive
>       rtn=$?
> #
> # Increase the sleep time if you have a slow device
> # or remove the sleep and add the following:
> # the following line enabled by Christoff Buch, OneVision Software AG, 
> 2006-05-31
>      wait_for_drive $device
> 
> # the following line disabled by Christoff Buch, OneVision Software AG, 
> 2006-05-31
> #      sleep 15
>       exit $rtn

looks good, although, even after the wait_for_drive succeeded the $rtn 
variable might still contain a value != 0. Worth checking or logging, I 
think.

>       ;;
> 
>    list) 
>       debug "Doing mtx -f $ctl -- to list volumes"
>       make_temp_file
> # Enable the following if you are using barcodes and need an inventory
> # OneVision Software AG, Exabyte 221L tape library doesn't need this!
> # Exabyte 221L scans barcodes after POST. Left as is by Christoff Buch, 
> OneVision Software AG, 2006-05-31
> #     $(MTX) -f $ctl inventory
>       ${MTX} -f $ctl status >${TMPFILE}
>       rtn=$?
>       cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | awk "{print 
> \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
>       cat ${TMPFILE} | grep "^Data Transfer Element [0-9]*:Full (Storage 
> Element [0-9]" | awk '{printf "%s:%s\n",$7,$10}'
>       rm -f ${TMPFILE} >/dev/null 2>&1
> #
> # If you have a VXA PacketLoader and the above does not work, try
> #  turning it off and enabling the following line.
> #     ${MTX} -f $ctl status | grep " *Storage Element [0-9]*:.*Full" | sed 
> "s/*Storage Element //" | sed "s/Full :VolumeTag=//"
>       exit $rtn
>       ;;
> 
>    loaded)
>       debug "Doing mtx -f $ctl $drive -- to find what is loaded"
>       make_temp_file
>       ${MTX} -f $ctl status >${TMPFILE}
>       rtn=$?
>       cat ${TMPFILE} | grep "^Data Transfer Element $drive:Full" | awk 
> "{print \$7}"
>       cat ${TMPFILE} | grep "^Data Transfer Element $drive:Empty" | awk 
> "{print 0}"
>       rm -f ${TMPFILE} >/dev/null 2>&1
>       exit $rtn
>       ;;
> 
>    slots)
>       debug "Doing mtx -f $ctl -- to get count of slots"
>       ${MTX} -f $ctl status | grep " *Storage Changer" | awk "{print \$5}"
>       ;;
> esac

You see I don't find any definite problems, but rather things that might 
be worth looking into.

Perhaps, once you've got mtx-changer adapted to your OS and hardware, 
the other problems will vanish, too.

Good luck!

Arno


> 
> ------------------------------------------------------------------------
> 
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users

-- 
IT-Service Lehmann                    [EMAIL PROTECTED]
Arno Lehmann                  http://www.its-lehmann.de


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to