Amanda::Recovery modules list
Amanda modules list
List of All Modules
All Amanda Releases



Amanda::Recovery::Scan -- interface to scan algorithm


    use Amanda::Recovey::Scan;
    # scan the default changer with no interactivity
    my $scan = Amanda::Recovery::Scan->new();
    # ..or scan the changer $chg, using $interactivity for interactivity
    $scan = Amanda::Recovery::Scan->new(chg => $chg,
                                        interactivity => $interactivity);
        label => "TAPE-012",
        res_cb => sub {
            my ($err, $reservation) = @_;
            if ($err) {
                die "$err";
            $dev = $reservation->{device};
            # use device..
    # later..
    $reservation->release(finished_cb => $start_next_volume);
    # later..
    $scan->quit(); # also quit the changer

This package provides a way for programs that need to read data from volumes (loosely called "recovery" programs) to find the volumes they need in a configurable way. It takes care of prompting for volumes when they are not available, juggling multiple changers, and any other unpredictabilities.


Like Amanda::Changer, this package operates asynchronously, and thus requires that the caller use Amanda::MainLoop to poll for events.

A new Scan object is created with the new function as follows:

  my $scan = Amanda::Recovery::Scan->new(scan_conf     => $scan_conf,
                                         chg           => $chg,
                                         interactivity => $interactivity);

scan_conf is the configuration for the scan, which at this point should be omitted, as configuration is not yet supported. The chg parameter specifies the changer to start the scan with. The default changer is used if chg is omitted. The interactivity parameter gives an Amanda::Interactivity object.


Many of the callbacks used by this package are identical to the callbacks of the same name in Amanda::Changer.

When a callback is called with an error, it is an object of type Amanda::Changer::Error. The volinuse reason has a different meaning: it means that the volume with that label is present in the changer, but is in use by another program.

Scan object


  $scan->find_volume(label       => $label,
                     res_cb      => $res_cb,
                     user_msg_fn => $user_msg_fn,
                     set_current => 0)

Find the volume labelled $label and call $res_cb. $user_msg_fn is used to send progress information, The argumnet it takes are describe in the next section. As with the load method of the changer API, set_current should be set to 1 if you want the scan to set the current slot.



The cleanly terminate a scan objet, the changer quit is also called.


The user_msg_fn take various arguments

Initiate the scan of the slot $slot: $self->user_msg_fn(scan_slot => 1, slot => $slot);

Initiate the scan of the slot $slot which should have the label $label: $self->user_msg_fn(scan_slot => 1, slot => $slot, label => $label);

The result of scanning slot $slot: $self->user_msg_fn(slot_result => 1, slot => $slot, err => $err, res => $res);

Other options can be added at any time. The function can ignore them.


This page was automatically generated Tue Sep 29 20:46:45 2015 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.