Imported Upstream version 2.6.1p1
[debian/amanda] / perl / Amanda / Changer.pm
index a0126508a416a5d2dac86c97db3a6f4345e6c50a..ea664f98d9ce547a026b5b728f29e07112338bf3 100644 (file)
@@ -187,6 +187,13 @@ an amtape argument). Note that some changers cannot detect the completion of a
 cleaning cycle; in this case, the user will just need to delay further Amanda
 activities until the cleaning is complete.
 
+=head3 $chg->eject(finished_cb => $cb, drive => $drivename)
+
+Eject the volume in a drive, if the changer supports it.  Drivename is as
+specified to C<clean>.  If possible, applications should prefer to eject a
+reserved volume when finished with it (C<< $res->release(eject => 1) >>), to
+ensure that the correct volume is ejected from a multi-drive changer.
+
 =head3 $chg->update(finished_cb => $cb, changed => $changed)
 
 The user has changed something -- loading or unloading tapes,
@@ -493,6 +500,16 @@ sub clean {
     }
 }
 
+sub eject {
+    my $self = shift;
+    my %params = @_;
+
+    my $class = ref($self);
+    if (exists $params{'finished_cb'}) {
+       $params{'finished_cb'}->("$class does not support eject()");
+    }
+}
+
 sub update {
     my $self = shift;
     my %params = @_;
@@ -575,14 +592,17 @@ sub release {
 
     $self->{'released'} = 1;
     $self->do_release(%params);
-
-    if (exists $params{'finished_cb'}) {
-       Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
-    }
 }
 
 sub do_release {
+    my $self = shift;
+    my %params = @_;
+
     # this is the one subclasses should override
+
+    if (exists $params{'finished_cb'}) {
+       Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
+    }
 }
 
 1;