Bacula-users

Re: [Bacula-users] bacula confused about slots on autochanger

2010-08-09 18:11:38
Subject: Re: [Bacula-users] bacula confused about slots on autochanger
From: Maria Mckinley <maria AT shadlen DOT org>
To: Bacula Users <bacula-users AT lists.sourceforge DOT net>
Date: Mon, 09 Aug 2010 15:08:18 -0700
On 8/4/10 2:43 PM, Maria Mckinley wrote:
> Message: 4
> Date: Wed, 04 Aug 2010 10:37:21 -0400
> From: Josh Fisher <jfisher AT pvct DOT com>
> Subject: Re: [Bacula-users] bacula confused about slots on autochanger
> To: bacula-users AT lists.sourceforge DOT net
> Message-ID: <4C597B21.2050602 AT pvct DOT com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>
> On 8/3/2010 9:20 PM, Maria McKinley wrote:
>  > > It seems that part of the problem I have been having with backup is
> that
>  > > bacula is having communication problems with the autochanger. Bacula
>  > > tells the autochanger to load slot 3, but instead slot 2 is loaded:
> On some systems, (BSD?) slot numbers are expected to begin at zero.
> Bacula (and Linux) expect slot numbers to begin at one. When Bacula
> sends a command to the autochanger to load slot 1, it is expecting the
> first slot to be loaded. But on systems that number from zero, when you
> use mtx to load slot 1 it will actually load the second slot. This can
> be worked around by changing your autochanger script to subtract 1 from
> the slot number on a load command and add 1 to slot numbers for the
> loaded and list commands.
>
> I am running linux, but this sounds like it would fix the problem. It
> isn't clear to me what to change. Here is the relevant bit from my
> script (3 is the input argument for slots). I don't think I can just
> change the setup argument to slot=$3+1, but not entirely sure why not:
>
> # Setup arguments
> ctl=$1
> cmd="$2"
> slot=$3
> device=$4
> drive=$5
>
> debug "Parms: $ctl $cmd $slot $device $drive"
>
> case $cmd in
> unload)
> debug "Doing mtx -f $ctl unload $slot $drive"
> #
> # enable the following line if you need to eject the cartridge
> # mt -f $device offline
> # sleep 10
> ${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:
> # sleep 15
> wait_for_drive $device
> exit $rtn
> ;;
>
> list)
> debug "Doing mtx -f $ctl -- to list volumes"
> make_temp_file
> # Enable the following if you are using barcodes and need an inventory
> # ${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=\)*//"
> #
> # If you have a VXA PacketLoader and the above does not work, try
> # turning it off and enabling the following line.
> # cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | sed "s/
> Storage Element //" | 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
> 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
>
> thanks,
> maria

Can anyone send me a copy of their autochanger script? It seems like 
mine is not up to date or something, and would really like to see what 
others look like. Not being able to load the correct slot from bacula is 
really getting old.

thanks,
maria

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users