X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Famtape.pl;fp=server-src%2Famtape.pl;h=7a83996dd7f3ab224f2a0be07f099ab1bed7d350;hb=d28952249e392eb31bc8eecc53f6c477f30c617b;hp=dec31ea6e62c7fad61f3913a009f95689b72a2d0;hpb=949b8910a5e23c4285d0b1aedacfc82a14dc97a5;p=debian%2Famanda diff --git a/server-src/amtape.pl b/server-src/amtape.pl index dec31ea..7a83996 100644 --- a/server-src/amtape.pl +++ b/server-src/amtape.pl @@ -1,9 +1,10 @@ #! @PERL@ # Copyright (c) 2009-2012 Zmanda, Inc. All Rights Reserved. # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -219,6 +220,10 @@ sub { return; } elsif ($err->volinuse and defined $err->{'slot'}) { $last_slot = $err->{'slot'}; + print STDERR sprintf("slot %3s: in use\n", $last_slot); + } elsif ($err->empty and defined $err->{'slot'}) { + $last_slot = $err->{'slot'}; + print STDERR sprintf("slot %3s: empty\n", $last_slot); } else { return failure($err, $finished_cb) if $err; } @@ -240,8 +245,6 @@ sub { } else { print STDERR sprintf("slot %3s: %s\n", $last_slot, $dev->error_or_status()); } - } else { - print STDERR sprintf("slot %3s: in use\n", $last_slot); } if ($res) { @@ -299,6 +302,7 @@ sub { for my $sl (@$inv) { my $line = "slot $sl->{slot}:"; + my $tle; if (!defined($sl->{device_status}) && !defined($sl->{label})) { $line .= " unknown state"; } elsif ($sl->{'state'} == Amanda::Changer::SLOT_EMPTY) { @@ -306,9 +310,11 @@ sub { } else { if (defined $sl->{label}) { $line .= " label $sl->{label}"; - my $tle = $tl->lookup_tapelabel($sl->{label}); - if ($tle->{'meta'}) { - $line .= " ($tle->{'meta'})"; + $tle = $tl->lookup_tapelabel($sl->{label}); + if (defined $tle) { + if ($tle->{'meta'}) { + $line .= " ($tle->{'meta'})"; + } } } elsif ($sl->{'device_status'} == $DEVICE_STATUS_VOLUME_UNLABELED) { $line .= " blank"; @@ -339,6 +345,13 @@ sub { if ($sl->{'current'}) { $line .= " (current)"; } + if (defined $tle) { + if (defined $sl->{'barcode'} and + defined $tle->{'barcode'} and + $sl->{'barcode'} ne $tle->{'barcode'}) { + $line .= " MISTMATCH barcode in tapelist: $tle->{'barcode'}"; + } + } # note that inventory goes to stdout print "$line\n"; @@ -658,7 +671,11 @@ sub load_changer { sub failure { my ($msg, $finished_cb) = @_; - print STDERR "ERROR: $msg\n"; + if ($msg->isa("Amanda::Changer::Error") and defined $msg->{'slot'}) { + print STDERR "ERROR: Slot: $msg->{'slot'}: $msg\n"; + } else { + print STDERR "ERROR: $msg\n"; + } $exit_status = 1; $finished_cb->(); }