I think at some point a bug was introduced into the code. The routine set_volume_name() in btape.c doesn't set the dcr->VolCatInfo.InChanger to true. However the routine autoload_device in autochanger.c requires it to be set to true or it ignores the slot number.
I have a fixed version of btape that I'm completing final tests on. I'll commit it to the CVS so that it is fixed for the next version of 1.39.X and for version 1.40.0. I also fixed it so that if the drive is empty or contains a tape other than the one for slot 1 when the fill command is started then the correct tape is loaded. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kern Sibbald Sent: Tuesday, October 03, 2006 1:08 PM To: bacula-users@lists.sourceforge.net Cc: Alan Davis Subject: Re: [Bacula-users] btape won't autoload for TL892 on Solaris 10? On Tuesday 03 October 2006 21:58, Alan Davis wrote: > > Self update on problem #1 - multiple causes and maybe a "non-problem" > ie: > > The btape autochanger test works perfectly, the fill command fails to > autoload the tapes. > > The mtx-changer command had some issues with the "list" and > wait_for_drive under Solaris. > > I dug through the code for btape and, if I'm reading it correctly, the > btape fill command will /never/ be able to autoload the tape. It's > depending on a reference to > > slot = dcr->VolCatInfo.InChanger ? dcr->VolCatInfo.Slot : 0 > > to determine the slot that volume TestVolume1 or TestVolume2 is in. > Since the label was forced onto the tape without a corresponding > VolCatInfo.Slot element update, and the VolCatInfo.InChanger defaults > to false, the slot will always be set to 0 and disables the autoload. This is not true unless a bug has been introduced into the code or unless you are running on an old Bacula (i.e. pre 1.38.11). > > After I added code to force the InChanger value and Slot and added a > call to acquire_device_for_[read|append] it successfully loads the > tape but then fails to satisfy the volume id requirements in that > routine and errors out. > > I'm working on a patch, but it's slow going since I have to learn the > code. It's easy enough to fake out the VolCatInfo bits, but I haven't > figured out how to reserve/mount the device yet. I'll be digging into > the developer's manual but if anyone wants to take a look at it I'd > certainly appreciate it. > > The bottom line is that I think I've convinced myself that the btape > error is specific to btape and bacula_sd will function as expected. There is no need to get too deeply into the Bacula code since btape has no access to the catalog, it must *fake* Volume and Slot numbers. This is done in set_volume_name() and the very end of the btape.c file. > > > Alan Davis > Senior Architect > Ruckus Network, Inc. > 703.464.6578 (o) > 410.365.7175 (m) > [EMAIL PROTECTED] > alancdavis AIM > > > -----Original Message----- > From: Alan Davis [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 03, 2006 4:47 AM > To: 'Alan Davis'; 'bacula-users@lists.sourceforge.net' > Subject: RE: btape won't autoload for TL892 on Solaris 10? > > Self update on problem #1 - possible solution > > I found that the permissions on the /devices/.../[EMAIL PROTECTED],0:changer > was > rw for root:sys only. Adding the bacula user to sys and chmod'ing the > device to 660 helped - bacula-sd can now count the number of slots via > mtx-changer. > > I found that mtx-changer is not Solaris friendly and has issues with > both the wait_for_drive function > > # modified for Solaris' mt > if mt -f $1 status | grep 'No Additional Sense' >/dev/null 2>&1; > then > # if mt -f $1 status | grep ONLINE >/dev/null 2>&1; then > > and the "list" command > > #cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | awk "{print > \$3 #\$4}" | sed "s/Full *\(:VolumeTag=\)*//" > > cat ${TMPFILE} | grep ' *Storage Element [0-9]*:.*Full' | awk '{print > $3 $4}' | sed 's/Full *:VolumeTag=*//' | sed 's/^\([0-9]*:\)Full/\1/' > > ---- > Alan Davis > Senior Architect > Ruckus Network, Inc. > 703.464.6578 (o) > 410.365.7175 (m) > [EMAIL PROTECTED] > alancdavis AIM > > > -----Original Message----- > From: Alan Davis [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 03, 2006 2:17 AM > To: 'Alan Davis'; 'bacula-users@lists.sourceforge.net' > Subject: RE: btape won't autoload for TL892 on Solaris 10? > > Self update on problem # 2 - it just took an incredibly long time to > reposition to the last block of the first tape again. > > I still have the first problem - and reading the responses to similar > questions on the archive didn't help. Here's the clearest response, > could someone clarify? > > "Use the Autochanger-Directive in the SD configuration. Use that > device with btape and (usually) in the DIR config." > > > Alan Davis > Senior Architect > Ruckus Network, Inc. > 703.464.6578 (o) > 410.365.7175 (m) > [EMAIL PROTECTED] > alancdavis AIM > > > -----Original Message----- > From: Alan Davis [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 03, 2006 1:58 AM > To: 'bacula-users@lists.sourceforge.net' > Subject: btape won't autoload for TL892 on Solaris 10? > > I'm configuring bacula 1.39.22 on Solaris 10 x86 on an IBM e345 with a > Compaq TL892 library, 2 TZ89 DLT drives w/ 1 TL800 robot. I've been > using a combination of the Bacula manual and Dan Langille's articles > to work out the nuances of the Storage clause for the bacula-sd.conf file. > > I'm getting 2 unexpected results from btape fill. It doesn't autoload > the next tape and it hangs after reading the first 10000 records from > the first tape. > > Where can I start looking to resolve the problems? Is the no autoload > a problem because I don't have a storage pool defined with appendable > volumes or is it a device configuration problem? > > The btape test command says that my settings are ok, and the > autochanger section of btape also works as expected. > > The btape fill command takes about 2 hours to fill the DLTIV tape > using the /dev/rmt/0cbn device. When it reaches the end of the first > tape I get this (debug is set to 99): > > Wrote blk_block=540000, dev_blk_num=12500 VolBytes=34,836,415,488 > rate=4939.2 KB/s > 03-Oct 01:11 btape: End of Volume "TestVolume1" at 51:486 on device > "Drive-1" (/dev/rmt/0cbn). Write of 64512 bytes got 0. > btape: btape.c:2308 Last block at: 51:485 this_dev_block_num=486 > btape: btape.c:2342 End of tape 53:0. VolumeCapacity=35,061,304,320. > Write rate = 4934.0 KB/s > 03-Oct 01:11 btape: End of medium on Volume "TestVolume1" > Bytes=35,061,304,320 Blocks=543,485 at 03-Oct-2006 01:11. > btape: btape.c:2679 Enter dir_find_next_appendable_volume. stop=1 > btape: btape.c:2707 Enter dir_ask_sysop_to_create_appendable_volume > btape: btape.c:2679 Enter dir_find_next_appendable_volume. stop=1 > 03-Oct 01:11 btape: Invalid slot=0 defined, cannot autoload Volume. > <----##### Unexpected result here > Mount blank Volume on device "Drive-1" (/dev/rmt/0cbn) and press > return when ready: > btape: dev.c:283 open dev: type=2 dev_name="Drive-1" (/dev/rmt/0cbn) > vol=TestVolume2 mode=OPEN_READ_WRITE > btape: dev.c:328 open dev: device is tape 03-Oct 01:28 btape: 3301 > Issuing autochanger "loaded? drive 0" command. > > I used mtx in another session to unload the first tape and load the > second. The test continued normally, successfully loading, labeling > and writing to the second tape and then a similar message and the > prompt to reload the first tape. > > The process then seems to hang after reading the first 10000 records : > > Volume Label: > Id : Bacula 1.0 immortal > VerNo : 11 > VolName : TestVolume1 > PrevVolName : > VolFile : 0 > LabelType : PRE_LABEL > LabelSize : 165 > PoolName : Default > MediaType : DLT-8000 > PoolType : Backup > HostName : athos > Date label written: 02-Oct-2006 23:12 > btape: label.c:227 Leave read_volume_label() VOL_OK 03-Oct 01:31 > btape: Ready to read from volume "TestVolume1" on device "Drive-1" > (/dev/rmt/0cbn). > btape: acquire.c:278 jcr->dcr=80df1d8 > Rewinding. > Reading the first 10000 records from 0:0. > 10000 records read now at 1:5084 > Reposition from 1:5084 to 51:485 > > Here are my device definitions: > > Autochanger { > Name = Autochanger > Device = Drive-1 > Device = Drive-2 > Changer Command = "/opt/bacula/bin/mtx-changer %c %o %S %a %d" > Changer Device = /dev/changer > } > > Device { > Name = Drive-1 # > Drive Index = 0 > Media Type = DLT-8000 > Archive Device = /dev/rmt/0cbn > AutomaticMount = yes; # when device opened, read it > AlwaysOpen = yes; > RemovableMedia = yes; > RandomAccess = no; > AutoChanger = yes > Changer Command = "/opt/bacula/bin/mtx-changer %c %o %S %a %d" > Changer Device = /dev/changer > # Enable the Alert command only if you have the mtx package loaded > Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" > Offline On Unmount = no > Hardware End of Medium = no > BSF at EOM = yes > Backward Space Record = no > Fast Forward Space File = no > TWO EOF = yes > LabelMedia = yes; # lets Bacula label unlabeled > media > } > > Device { > Name = Drive-2 # > Drive Index = 1 > Media Type = DLT-8000 > Archive Device = /dev/rmt/1cbn > AutomaticMount = yes; # when device opened, read it > AlwaysOpen = yes; > RemovableMedia = yes; > RandomAccess = no; > AutoChanger = yes > Changer Command = "/opt/bacula/bin/mtx-changer %c %o %S %a %d" > Changer Device = /dev/changer > # Enable the Alert command only if you have the mtx package loaded > Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" > Offline On Unmount = no > Hardware End of Medium = no > BSF at EOM = yes > Backward Space Record = no > Fast Forward Space File = no > TWO EOF = yes > LabelMedia = yes; # lets Bacula label unlabeled > media > } > > > > > ---- > Alan Davis > Senior Architect > Ruckus Network, Inc. > 703.464.6578 (o) > 410.365.7175 (m) > [EMAIL PROTECTED] > alancdavis AIM > > > > > > > ---------------------------------------------------------------------- > --- 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=DEV > DEV _______________________________________________ > Bacula-users mailing list > Bacula-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bacula-users > ------------------------------------------------------------------------- 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 ------------------------------------------------------------------------- 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