On 2006-07-25 15:03, Alan Brown wrote: > On Tue, 25 Jul 2006, Kern Sibbald wrote: > >>> I thought it was intended to scan slots and drives without requiring a >>> tape drive unload in 1.38. >> I was going to remove the requirement to unload the drive, but the users >> objected to that so it currently unloads the drive you specify. > > OK. > >>> Currently it does - which means that changing out tape sets cannot be done >>> unless at least one drive is idle/blocked - problematic in some >>> circumstances, particularly when a large backup is in progress and waiting >>> for this event means the magazine won't be changed out until next business >>> day, or someone has to wait outside office hours until the drive is freed >>> up. >> Yes, the current behavior presents certain problem. > > It's decidely unfriendly for anything except the smallest changers. > >> However, users were overwhelmly in favor of keeping the current behavior >> until >> they have some way within Bacula to unload drives. Such code does not >> currently exist. > > Understandable, but MTX works. > > How about a "Unload on update" stored keyword to control the behaviour? > >>> 2: Are input/output slots being scanned correcttly? >>> >>> When running update slots, Bacula sees the correct number of slots, but >>> doesn't seem to recognise tapes in the mailslots (Input/output slots) >> I provide a default mtx-changer script, that knows nothing about "mailslots". >> If you want it to handle mailslots, you will probably need to adapt the >> script, and if you can do it in a way that does not break with changers that >> do not have mailslots, I'll be happy to incorporate it. > > Here are the tricky parts (Only 45 slots reported today - one magazine is out) > > Storage Changer /dev/sg16:2 Drives, 45 Slots ( 2 Import/Export ) > Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag = ALOW0026 > Data Transfer Element 1:Full (Storage Element 9 Loaded):VolumeTag = ALOW0039 > ... > Storage Element 41:Full :VolumeTag=AMED0042 > Storage Element 42:Full :VolumeTag=AMED0041 > Storage Element 43:Empty > Storage Element 44 IMPORT/EXPORT:Empty > Storage Element 45 IMPORT/EXPORT:Empty > > The mailslots are designated IMPORT/EXPORT and it seems to be a simple > parsing issue. > > I'm not sure if the report of which barcode is in which drive is being > used. Kern? > > AB > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Bacula-users mailing list > Bacula-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bacula-users
I wrote a script that check for tapes in the IMPORT/EXPORT slot, and take care of that by just talking to mysql, and bacula will then know that the tape is InChanger and which slot. On my changer, an incoming tape is marked IMPORT/EXPORT:Full , but an outgoing tape has also the volumetag. I make it simple and never remove any magazines, and have only one mailslot, so I can do: TRANSFER=`$MTX status | tail -1` if expr match "$TRANSFER" '^.* 82 IMPORT/EXPORT:Full $' >/dev/null ; then importbusy=1 echo "unknown tape in slot 82 (import)" #check if I can import check_in if [ $can_import -eq "1" ] ; then echo moving tape to slot $inslot $MTX transfer 82 $inslot && resetslot $inslot #echo "Doing inventory, please wait" #$MTX inventory else echo "No free slots, please remove tape $involume from the extract port." fi else importbusy=0 fi if expr match "$TRANSFER" '^.*Full.*' >/dev/null ; then exportbusy=1 volume=`expr match "$TRANSFER" '^.*:VolumeTag=\(.*\)$'` echo $volume in IMPORT/EXPORT Slot 82 else exportbusy=0 fi This script requires lot of functions to work, so you can't just use it, but maybe give some hints when making your own script. I have a pool for Offline tapes (PoolId=8), where the script check for tapes in that pool, and if InChanger=1 . Then move them one by one to the export slot and change InChanger to 0 , but keep the Slot number, so another function can get a list of free slots from mysql. When I import another tape to that slot, the extracted tape will have slot=0, that is the resetslot() function. My script is called with -e when I need to extract a tape: case "$1" in -e) if [ $exportbusy -eq 1 ] ; then echo "IMPORT/EXPORT Slot busy , Volume $volume must be removed first." exit fi export=`getoneslot` if [ $export -gt 0 ] ; then $MTX transfer $export 82 && offline $export || echo Failed to export slot $export else echo nothing to export fi ;; -i) if [ ! -z "$2" ] then if [ $exportbusy -ne 1 ] ; then echo "No tape in the IMPORT slot" exit 2 fi echo '$MTX transfer 82 $2 && resetslot $2' else echo Please enter the slot where to store the tape, i.e. one of `getfreeslots` fi ;; *) : ;; esac Some functions that I use: MTX=/opt/local/etc/mtx MYSQL="/extra/mysql/4.0.18/bin/mysql bacula" checknrtoextract() { ( $MYSQL << EOF select count(*) from Media where PoolID=8 and InChanger=1; EOF ) | tail -1 } listtoextract() { ( $MYSQL << EOF select VolumeName from Media where PoolID=8 and InChanger=1; EOF ) |grep -v VolumeName } getoneslot() { ( $MYSQL << EOF select min(Slot) from Media where PoolID=8 and InChanger=1; EOF ) |grep -v Slot } getfreeslots() { ( $MYSQL << EOF select Slot from Media where InChanger!=1 order by Slot; EOF ) | egrep -v 'Slot|^0$' } check_in() { free=`getfreeslots` if [ -z "$free" ] ; then echo "No free slots" can_import=0 else echo $free inslot=`echo $free | cut -f1 -d" "` echo $inslot can_import=1 fi } slot() { ( $MYSQL << EOF select Slot from Media where VolumeName="$1"; EOF ) |grep -v Slot } resetslot() { $MYSQL << EOF update Media set Slot=0 where Slot=$1 ; EOF } offline() { $MYSQL << EOF update Media set InChanger=0 where Slot=$1 ; EOF } What I need is some daemon that can catch a status from the changer when the mailslot is opened/closed, now I must run my script in a loop and then go to the changer and remove/insert tapes. I still need to run mtx inventory to update the slots/volume list, but I never run any scan from bacula since the mysql-database knows whats in the changer. /birre ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users