projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'upstream/3.3.3'
[debian/amanda]
/
server-src
/
amtape.pl
diff --git
a/server-src/amtape.pl
b/server-src/amtape.pl
index dec31ea6e62c7fad61f3913a009f95689b72a2d0..7a83996dd7f3ab224f2a0be07f099ab1bed7d350 100644
(file)
--- a/
server-src/amtape.pl
+++ b/
server-src/amtape.pl
@@
-1,9
+1,10
@@
#! @PERL@
# Copyright (c) 2009-2012 Zmanda, Inc. All Rights Reserved.
#
#! @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
#
# 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'};
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;
}
} 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: %s\n", $last_slot, $dev->error_or_status());
}
- } else {
- print STDERR sprintf("slot %3s: in use\n", $last_slot);
}
if ($res) {
}
if ($res) {
@@
-299,6
+302,7
@@
sub {
for my $sl (@$inv) {
my $line = "slot $sl->{slot}:";
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) {
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}";
} 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";
}
} elsif ($sl->{'device_status'} == $DEVICE_STATUS_VOLUME_UNLABELED) {
$line .= " blank";
@@
-339,6
+345,13
@@
sub {
if ($sl->{'current'}) {
$line .= " (current)";
}
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";
# note that inventory goes to stdout
print "$line\n";
@@
-658,7
+671,11
@@
sub load_changer {
sub failure {
my ($msg, $finished_cb) = @_;
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->();
}
$exit_status = 1;
$finished_cb->();
}