AMANDA TAPE CHANGER SUPPORT Originally by James da Silva Heavily modified by various contributors 1. INTRODUCTION This document outlines the tape changer support design of Amanda 2.2. I have defined a small interface for changer software to follow so that Amanda can remain device-independent, and support the widest range of tape software and hardware possible. The interface is a bit simplistic, but I have been reluctant to add complications until there is a body of field experience with the simple version. I am very interested in feedback on how the tape changer support can be improved. 2. SPECIFYING A TAPE CHANGER IN AMANDA.CONF All the device-specifics are hidden by a glue program that the rest of Amanda calls to interact with the tape changer. The name of this changer program is given by the new "tpchanger" variable in the amanda.conf file. Example entry: tpchanger "chg-multi" # use multi-unit tape changer emulator changerfile "/etc/amanda/changer.conf" # changer configuration The older tapedev parameter is ignored if a tpchanger program is specified, unless the changer program itself reads tapedev from amanda.conf. chg-multi doesn't, as it reads all its configuration arguments from its own configuration file, specified as changerfile. If the tpchanger program does not begin with a '/', then amanda will expect it to reside in libexecdir, and possibly have the version suffix appended depending on how amanda was configured. 3. DEVICE-SPECIFIC TAPE CHANGER SCRIPT The tape changer program must support the following commands: -slot changes to a particular slot outputs to stdout the slot name and name of the device file to access the tape returns 0 on success, returns 1 on positioning error (eg at bottom of gravity stacker or slot empty) returns 2 any other fatal error error messages to stdout in place of device name Examples: % chg-multi -slot 0 0 /dev/nrst8 # exitcode returned is 0 % chg-multi -slot 1 1 slot 1 is empty # exitcode returned is 1 % chg-multi -slot bogus-slot no slot `bogus-slot' # exitcode returned is 2 -info outputs to stdout three fields: the current slot string, the number of slots, and whether the changer can go backwards (0 if it can't, 1 if it can). Same error handling as above. Example: % chg-multi -info 0 10 1 # exitcode returned is 0 -reset resets changer to known state and loads the first slot. Output and error handling same as " -slot first". In the case of a gravity stacker that must be reset by hand, this could be run (via amtape reset) by the operator to inform the software that the stacker is positioned back at the top. Examples: % chg-multi -reset 0 /dev/nrst8 # exitcode returned is 0 % chg-multi -reset 0 slot 0 is empty # exitcode returned is 1 % chg-multi -reset 0 tape-changer not responding # exitcode returned is 2 -eject ejects the currently loaded tape, if appropriate. Output and error handling are the same as the -slot command. Examples: % chg-multi -eject 0 /dev/nrst8 # exitcode returned is 0 % chg-multi -eject 0 drive was not loaded # exitcode returned is 1 For all the commands: An exit code of 0 implies that the operation was completely successful, and that the output can be parsed by the amanda code as described above. For non-zero exit codes, the first field is still the slot name, but the actual error messages are not fixed. They are just displayed and/or logged as-is by the calling amanda program. An exit code of 1 implies that the operation failed in a benign way, for example an empty slot or an attempt to go backwards in a gravity stacker. The calling amanda program will print the error message if appropriate and continue, perhaps requesting the load of a different slot. Any other exit code is considered a fatal error and will cause amanda to stop attempting to talk to the tape changer. 4. SLOT NUMBERS AND THE "CURRENT" SLOT Some tape changers, such as carousels and gravity stackers, have a hardware notion of current position. Others have no current position when no tape is loaded: all tapes are in their slots and the changer arm is docked away from the slots. Nevertheless, Amanda requires its tape-changer scripts to maintain the notion of a "current" position. This is for performance reasons: as tapes tend to be loaded into the rack in order, and Amanda uses them in order, the next tape to use can be found much quicker if the position of the previous one is remembered. As an example, the chg-multi.sh script maintains the current position in a "chg-multi.state" file (or any other file specified in a `statefile' line in the changer configuration file). Amanda does not care how slots are specified: they could be numbered 0 to N-1, numbered 1 to N, or even designated by letter, A .. Z. The only requirement is that the names do not contain whitespace, and that the names "current", "next", "prev", "first", "last" and "advance" retain their meaning as follows: current the position of the last loaded tape, as described above next the position after current, wrapping from the last slot to the first. prev the position before current, wrapping from the first slot to the last. first the first slot in the tape rack. last the last slot in the tape rack. advance the same as "next" except the next tape may not be loaded if the changer supports advancing to the next slot without putting that tape in the drive. The current position must be updated even if there is a positioning error (such as "empty slot"). This allows amanda to step through the entire tape rack by issuing successive "-slot next" positioning commands. 5. OPERATOR INTERFACE The new amtape program is the main operator interface to Amanda's tape changer support. The commands supported include: amtape slot Load the tape from the specified slot into the drive amtape eject Send an eject command to the tape-changer. Effect is changer specific. amtape reset Send a reset command to the tape-changer. Effect is changer specific. amtape show Goes through the entire tape rack, showing the labels of all amanda tapes encountered. amtape label