X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FTaper%2FScribe.pm;fp=perl%2FAmanda%2FTaper%2FScribe.pm;h=6f90d3006e92de3a5f9cba288123c2555aa9f0b5;hb=691567b16c13087b31ee4c2b6d038e57872fae82;hp=31831b754451a62144bc9598c39962d6f48ce9f5;hpb=cc7d7b45afc706099acf7ff2490ec5667d370651;p=debian%2Famanda diff --git a/perl/Amanda/Taper/Scribe.pm b/perl/Amanda/Taper/Scribe.pm index 31831b7..6f90d30 100644 --- a/perl/Amanda/Taper/Scribe.pm +++ b/perl/Amanda/Taper/Scribe.pm @@ -1,8 +1,9 @@ # Copyright (c) 2009-2012 Zmanda, Inc. All Rights Reserved. # -# This library is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License version 2.1 as -# published by the Free Software Foundation. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +#* License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -874,7 +875,7 @@ sub _xmsg_part_done { $self->dbg("not notifying for empty, successful part"); } else { # double-check partnum - confess "Part numbers do not match!" + confess "Part numbers do not match! $self->{'dump_header'}->{'partnum'} $msg->{'partnum'}" unless ($self->{'dump_header'}->{'partnum'} == $msg->{'partnum'}); # notify @@ -985,6 +986,14 @@ sub _xmsg_done { } } +sub abort_setup { + my $self = shift; + my %params = @_; + + $self->{'dump_cb'} = $params{'dump_cb'}; + $self->_dump_done(); +} + sub _dump_done { my $self = shift; @@ -992,14 +1001,19 @@ sub _dump_done { # determine the correct final status - DONE if we're done, PARTIAL # if we've started writing to the volume, otherwise FAILED - if (@{$self->{'device_errors'}} or $self->{'config_denial_message'} or - !$self->{'last_part_successful'}) { - $result = $self->{'started_writing'}? 'PARTIAL' : 'FAILED'; + if (!$self->{'started_writing'}) { + $result = 'FAILED'; + } elsif (@{$self->{'device_errors'}} or $self->{'config_denial_message'} or + !$self->{'last_part_successful'}) { + $result = 'PARTIAL'; } else { $result = 'DONE'; } my $dump_cb = $self->{'dump_cb'}; + + return if !defined $dump_cb; + my %dump_cb_args = ( result => $result, device_errors => $self->{'device_errors'}, @@ -1054,8 +1068,6 @@ sub _operation_failed { if (defined $self->{'dump_cb'}) { # _dump_done constructs the dump_cb from $self parameters $self->_dump_done(); - } else { - confess "error with no callback to handle it: $error_message"; } } } @@ -1249,7 +1261,13 @@ sub _volume_cb { step device_started => sub { my $result = shift; - if ($result == 0) { + if ($result =~ /\D/) { + $self->{'feedback'}->scribe_notif_new_tape( + error => $result, + volume_label => undef); + $self->_get_new_volume(); + return $cbX->(); + } elsif ($result == 0) { # try reading the label to see whether we erased the tape my $erased = 0; CHECK_READ_LABEL: { @@ -1293,12 +1311,6 @@ sub _volume_cb { $self->_get_new_volume(); return $cbX->(); - } elsif ($result != 1) { - $self->{'feedback'}->scribe_notif_new_tape( - error => $result, - volume_label => undef); - $self->_get_new_volume(); - return $cbX->(); } $new_label = $device->volume_label; @@ -1466,11 +1478,26 @@ sub get_splitting_args_from_config { unless defined $params{'part_cache_type'}; } - # if any of the dle_* parameters are set, use those to set the part_* - # parameters, which are emptied out first. - if (defined $params{'dle_tape_splitsize'} or - defined $params{'dle_split_diskbuffer'} or - defined $params{'dle_fallback_splitsize'}) { + if (defined $splitting_args{'data_path'} and + $splitting_args{'data_path'} eq "DIRECTTCP") { + my $ps = $params{'dle_tape_splitsize'}; + if (defined $ps and $ps > 0) { + $params{'part_cache_max_size'} = undef + } else { + $ps = $params{'part_size'}; + my $pcms = $params{'part_cache_max_size'}; + $ps = $pcms if (!defined $ps or (defined $pcms and $pcms < $ps)); + } + $splitting_args{'allow_split'} = 1 if ((defined $ps and $ps > 0) or + $params{'leom_supported'}); + $params{'part_size'} = $ps; + $params{'part_cache_type'} = 'none'; + $params{'part_cache_dir'} = undef; + } elsif (defined $params{'dle_tape_splitsize'} or + defined $params{'dle_split_diskbuffer'} or + defined $params{'dle_fallback_splitsize'}) { + # if any of the dle_* parameters are set, use those to set the part_* + # parameters, which are emptied out first. $params{'part_size'} = $params{'dle_tape_splitsize'} || 0; $params{'part_cache_type'} = 'none';