# 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
$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
}
}
+sub abort_setup {
+ my $self = shift;
+ my %params = @_;
+
+ $self->{'dump_cb'} = $params{'dump_cb'};
+ $self->_dump_done();
+}
+
sub _dump_done {
my $self = shift;
# 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'},
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";
}
}
}
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: {
$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;
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';