Amanda-2.6.0

Amanda::Changer


NAME

Amanda::Changer -- interface to changer scripts


SYNOPSIS

  use Amanda::Changer;
  my ($error, $slot) = Amanda::Changer::reset();
  my ($nslots, $curslot, $backwards, $searchable) = Amanda::Changer::query();
  my ($tpslot, $tpdevice) = Amanda::Changer::find("TAPE018");
  sub slot_callback {
    my ($slot, $device, $error) = @_;
    if (!$error) print "Slot $slot: $device\n";
    return 0;
  }
  Amanda::Changer::scan(\&slot_callback);


API STATUS

Stable


FUNCTIONS

All of these functions return an array of values, beginning with $error, and containing any other results appropriate to the operation.

The functions croak() in the event of a serious error (problems running the changer script, or an exit status of 2 or higher). ``Benign'' errors, corresponding to an exit status of 1 or a slot named ``<error>'', result in the return of a single-element array containing the error message. Error-handling for calls can be written

$error and $slot. The first is false unless a ``benign'' error, such as a positioning error, has occurred, in which case it contains the message from the changer script, and the other results are undefined. $slot is the first word returned from the changer script, and is usually a number, but occasionally a string such as ``<none>''.

reset
  my ($error, $slot) = reset();

Resets the tape changer, if supported, by calling

  $tpchanger -reset
clean
  my ($error, $slot) = clean();

Triggers a cleaning cycle, if supported, by calling

  $tpchanger -clean
eject
  my ($error, $slot) = eject();

Ejects the tape in the current slot, if supported, by calling

  $tpchanger -eject
label
  my ($error) = label($label);

Inform the changer that the tape in the current slot is labeled $label. Calls

  $tpchanger -label $label
query
  my ($error, $slot, $nslots, $backwards, $searchable) = query();

Query the changer to determine the current slot ($slot), the number of slots ($nslots), whether it can move backward through tapes ($backwards), and whether it is searchable (that is, has a barcode reader; $searchable). A changer which cannot move backward through tapes is also known as a gravity feeder.

This function runs

  $tpchanger -info
loadslot
  my ($error, $slot, $device) = loadslot($desired_slot);

Load the tape in the given slot, returning its slot and device. $desired_slot can be a numeric slot number or one of the symbolic names defined by the changer API, e.g., ``next'', ``current'', or ``first''.

  $tpchanger -slot $slot
find
  my ($error, $tpslot, $tpdevice) = Amanda::Changer::find($label);

Search the changer for a tape with the given label, returning with $tpslot = "<none``> if the given label is not found.

If the changer is searchable, this function calls

  $tpchanger -search $label

Otherwise it scans all slots in order, beginning with the current slot, until it finds one with a label equal to $label or exhausts all slots. Note that it is considered a fatal error if the label is not found.

scan
  my ($error) = Amanda::Changer::scan(\&slot_callback);

Call slot_callback for all slots, beginning with the current slot, until slot_callback returns a nonzero value or all slots are exhausted. slot_callback gets three arguments: a slot number, a device name for that slot, and a boolean value which is true if the changer successfully loaded the slot.


ABOUT THIS PAGE

This page was automatically generated Mon Nov 17 19:29:37 2008 from the Amanda source tree, and documents the most recent development version of Amanda. For documentation specific to the version of Amanda on your system, use the 'perldoc' command.


Amanda-2.6.0