# 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
my $self = shift;
my ($msgtype, %params) = @_;
- if (!defined $self->{'dumper_status'}) {
- $self->{'dumper_status'} = "DONE";
- $self->{'orig_kb'} = $params{'orig_kb'};
- if (defined $self->{'result'}) {
- $self->result_cb(undef);
- }
- } else {
- # ignore the message
+ if ($params{'handle'} ne $self->{'handle'}) {
+ # ignore message for previous handle
+ return;
+ }
+
+ if (defined $self->{'dumper_status'}) {
+ # ignore duplicate message
+ return
+ }
+
+ $self->{'dumper_status'} = "DONE";
+ $self->{'orig_kb'} = $params{'orig_kb'};
+ if (defined $self->{'result'}) {
+ $self->result_cb(undef);
}
}
my $self = shift;
my ($msgtype, %params) = @_;
+ if ($params{'handle'} ne $self->{'handle'}) {
+ # ignore message for previous handle
+ return;
+ }
+
+ if (defined $self->{'dumper_status'}) {
+ # ignore duplicate message
+ return
+ }
+
$self->{'dumper_status'} = "FAILED";
if (defined $self->{'header_xfer'}) {
$self->{'header_xfer'}->cancel();
my $logtype;
if ($params{'result'} eq 'DONE') {
- if (!$self->{'doing_port_write'} or $self->{'dumper_status'} eq "DONE") {
+ if ($self->{'dumper_status'} eq "DONE") {
$msgtype = Amanda::Taper::Protocol::DONE;
$logtype = $L_DONE;
} else {
$msg_params{'taper'} = 'TAPE-ERROR';
$msg_params{'tapererr'} = join("; ", @{$params{'device_errors'}});
} elsif ($params{'config_denial_message'}) {
- $msg_params{'taper'} = 'TAPE-ERROR';
+ $msg_params{'taper'} = 'TAPE-CONFIG';
$msg_params{'tapererr'} = $params{'config_denial_message'};
} else {
$msg_params{'taper'} = 'TAPE-GOOD';
step process_args => sub {
# extract the splitting-related parameters, stripping out empty strings
my %splitting_args = map {
- ($params{$_} ne '')? ($_, $params{$_}) : ()
+ (defined $params{$_} && $params{$_} ne '')? ($_, $params{$_}) : ()
} qw(
dle_tape_splitsize dle_split_diskbuffer dle_fallback_splitsize dle_allow_split
- part_size part_cache_type part_cache_dir part_cache_max_size
+ part_size part_cache_type part_cache_dir part_cache_max_size data_path
);
# convert numeric values to BigInts
# getting the header is easy for FILE-WRITE..
my $hdr = $self->{'header'} = Amanda::Holding::get_header($params{'filename'});
+ if (!defined $hdr || $hdr->{'type'} != $Amanda::Header::F_DUMPFILE) {
+ confess("Could not read header from '$params{filename}'");
+ }
+
# stip out header fields we don't need
$hdr->{'cont_filename'} = '';
- if (!defined $hdr || $hdr->{'type'} != $Amanda::Header::F_DUMPFILE) {
- confess("Could not read header from '$params{filename}'");
+ if ($self->{'header'}->{'is_partial'}) {
+ $self->{'dumper_status'} = "FAILED";
+ } else {
+ $self->{'dumper_status'} = "DONE";
}
+
$steps->{'start_dump'}->(undef);
} else {
# ..but quite a bit harder for PORT-WRITE; this method will send the
$self->_assert_in_state("getting_header") or return;
$self->{'state'} = 'writing';
+ # abort if we already got a device_errors
+ if (@{$self->{'scribe'}->{'device_errors'}}) {
+ $self->{'scribe'}->abort_setup(dump_cb => $params{'dump_cb'});
+ return;
+ }
# if $err is set, cancel the dump, treating it as a input error
if ($err) {
push @{$self->{'input_errors'}}, $err;