-# Copyright (c) 2009, 2010 Zmanda, Inc. All Rights Reserved.
+# 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
# Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
-use Test::More tests => 269;
+use Test::More tests => 277;
use strict;
use warnings;
# functions to create dumpfiles
sub write_dumpfile_header_to {
- my ($fh, $size, $hostname, $disk, $expect_failure) = @_;
+ my ($fh, $size, $hostname, $disk, $is_partial) = @_;
my $hdr = Amanda::Header->new();
$hdr->{'type'} = $Amanda::Header::F_DUMPFILE;
$hdr->{'comp_suffix'} = ".foo";
$hdr->{'name'} = $hostname;
$hdr->{'disk'} = $disk;
+ $hdr->{'is_partial'} = 1 if defined $is_partial;
$hdr->{'program'} = "INSTALLCHECK";
$hdr = $hdr->to_string(32768,32768);
# make a new holding-like file in test_filename
sub make_holding_file {
- my ($size, $hostname, $disk) = @_;
+ my ($size, $hostname, $disk, $is_partial) = @_;
open(my $fh, ">", $test_filename);
- write_dumpfile_header_to($fh, $size, $hostname, $disk);
+ write_dumpfile_header_to($fh, $size, $hostname, $disk, $is_partial);
write_dumpfile_data_to($fh, $size, $hostname, $disk);
}
ReuseAddr => 1,
);
- write_dumpfile_header_to($sock, $size, $hostname, $disk, $expect_error);
+ write_dumpfile_header_to($sock, $size, $hostname, $disk);
close $sock;
$sock = IO::Socket::INET->new(
}, "header on file 4 is correct");
}
+##
+# A multipart FILE-WRITE partial dump.
+
+$handle = '11-22223';
+$datestamp = "20070102030406";
+run_taper(4096, "multipart partial FILE-WRITE");
+like(taper_reply, qr/^TAPER-OK worker0$/,
+ "got TAPER-OK") or die;
+make_holding_file(1024*1024, "localhost", "/usr", 1);
+taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /usr 0 $datestamp 524288 \"\" \"\" 1 \"\" \"\" \"\" \"\" 512");
+like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/,
+ "got REQUEST-NEW-TAPE worker0 $handle") or die;
+taper_cmd("START-SCAN worker0 $handle");
+taper_cmd("NEW-TAPE worker0 $handle");
+like(taper_reply, qr/^NEW-TAPE $handle TESTCONF01$/,
+ "got proper NEW-TAPE worker0 $handle") or die;
+like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 512 "\[sec [\d.]+ bytes 524288 kps [\d.]+ orig-kb 512\]"$/,
+ "got PARTDONE for filenum 1") or die;
+like(taper_reply, qr/^PARTDONE $handle TESTCONF01 2 512 "\[sec [\d.]+ bytes 524288 kps [\d.]+ orig-kb 512\]"$/,
+ "got PARTDONE for filenum 2") or die;
+like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ bytes 1048576 kps [\d.]+ orig-kb 512\]" "" ""$/,
+ "got DONE") or die;
+taper_cmd("QUIT");
+wait_for_exit();
+
+check_logs([
+ qr(^INFO taper Slot 1 without label can be labeled$),
+ qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$),
+ qr(^PART taper TESTCONF01 1 localhost /usr $datestamp 1/-1 0 \[sec [\d.]+ bytes 524288 kps [\d.]+ orig-kb 512\]$),
+ qr(^PART taper TESTCONF01 2 localhost /usr $datestamp 2/-1 0 \[sec [\d.]+ bytes 524288 kps [\d.]+ orig-kb 512\]$),
+ qr(^PARTIAL taper localhost /usr $datestamp 2 0 \[sec [\d.]+ bytes 1048576 kps [\d.]+ orig-kb 512\]$),
+ qr(^INFO taper tape TESTCONF01 kb 1024 fm 3 \[OK\]$),
+], "multi-part partial dump logged correctly");
+
##
# A PORT-WRITE with no disk buffer
like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/,
"got REQUEST-NEW-TAPE worker0 $handle") or die;
taper_cmd("NO-NEW-TAPE worker0 $handle sorry");
-like(taper_reply, qr/^FAILED $handle INPUT-GOOD TAPE-ERROR "" "?sorry"?.*$/,
+like(taper_reply, qr/^FAILED $handle INPUT-GOOD TAPE-CONFIG "" "?sorry"?.*$/,
"got FAILED") or die;
taper_cmd("QUIT");
wait_for_exit();
taper_cmd("NEW-TAPE worker0 $handle");
like(taper_reply, qr/^NEW-TAPE $handle TESTCONF01$/,
"got proper NEW-TAPE worker0 $handle") or die;
-like(taper_reply, qr/^PARTIAL $handle INPUT-GOOD TAPE-ERROR "\[sec [\d.]+ bytes 0 kps [\d.]+\]" "" "No space left on device, splitting not enabled"$/,
+like(taper_reply, qr/^PARTIAL $handle INPUT-GOOD TAPE-ERROR "\[sec [\d.]+ bytes 0 kps [\d.]+\]" "" "No space left on device: more than MAX_VOLUME_USAGE bytes written, splitting not enabled"$/,
"got PARTIAL") or die;
# retry on the next tape
$handle = "11-88899";
qr(^INFO taper Slot 1 without label can be labeled$),
qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$),
qr(^PARTPARTIAL taper TESTCONF01 1 localhost /var/log $datestamp 1/-1 0 \[sec [\d.]+ bytes 983040 kps [\d.]+\] "No space left on device"$),
- qr(^PARTIAL taper localhost /var/log $datestamp 1 0 \[sec [\d.]+ bytes 0 kps [\d.]+\] "No space left on device, splitting not enabled"$),
+ qr(^PARTIAL taper localhost /var/log $datestamp 1 0 \[sec [\d.]+ bytes 0 kps [\d.]+\] "No space left on device: more than MAX_VOLUME_USAGE bytes written, splitting not enabled"$),
qr(^INFO taper tape TESTCONF01 kb 0 fm 1 \[OK\]$),
qr(^INFO taper Slot 2 without label can be labeled$),
qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$),
like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/,
"got REQUEST-NEW-TAPE worker0 $handle") or die;
taper_cmd("NO-NEW-TAPE worker0 $handle \"that's enough\"");
-like(taper_reply, qr/^PARTIAL $handle INPUT-GOOD TAPE-ERROR "\[sec [\d.]+ bytes 262144 kps [\d.]+ orig-kb 1312\]" "" "that's enough"$/,
+like(taper_reply, qr/^PARTIAL $handle INPUT-GOOD TAPE-CONFIG "\[sec [\d.]+ bytes 262144 kps [\d.]+ orig-kb 1312\]" "" "that's enough"$/,
"got PARTIAL") or die;
taper_cmd("QUIT");
wait_for_exit();
like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/,
"got REQUEST-NEW-TAPE worker0 $handle") or die;
taper_cmd("NO-NEW-TAPE worker0 $handle \"sorry\"");
-like(taper_reply, qr/^FAILED $handle INPUT-GOOD TAPE-ERROR "" "?sorry"?.*$/,
+like(taper_reply, qr/^FAILED $handle INPUT-GOOD TAPE-CONFIG "" "?sorry"?.*$/,
"got FAILED") or die;
taper_cmd("QUIT");
wait_for_exit();
taper_cmd("NEW-TAPE worker0 $handle");
like(taper_reply, qr/^NEW-TAPE $handle TESTCONF01$/,
"got proper NEW-TAPE worker0 $handle") or die;
-like(taper_reply, qr/^PARTIAL $handle INPUT-GOOD TAPE-ERROR "\[sec [\d.]+ bytes \d* kps [\d.]+ orig-kb 1612\]" "" "No space left on device, splitting not enabled"$/,
+like(taper_reply, qr/^PARTIAL $handle INPUT-GOOD TAPE-ERROR "\[sec [\d.]+ bytes \d* kps [\d.]+ orig-kb 1612\]" "" "No space left on device: more than MAX_VOLUME_USAGE bytes written, splitting not enabled"$/,
"got PARTIAL for filenum 1") or die;
taper_cmd("QUIT");
wait_for_exit();
qr(^INFO taper Slot 1 without label can be labeled$),
qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$),
qr(^PARTPARTIAL taper TESTCONF01 1 localhost /usr $datestamp 1/-1 0 \[sec [\d.]+ bytes 983040 kps [\d.]+ orig-kb 1612\] \"No space left on device\"$),
- qr(^PARTIAL taper localhost /usr $datestamp 1 0 \[sec [\d.]+ bytes 0 kps [\d.]+ orig-kb 1612\] "No space left on device, splitting not enabled"$),
+ qr(^PARTIAL taper localhost /usr $datestamp 1 0 \[sec [\d.]+ bytes 0 kps [\d.]+ orig-kb 1612\] "No space left on device: more than MAX_VOLUME_USAGE bytes written, splitting not enabled"$),
qr(^INFO taper tape TESTCONF01 kb 0 fm 1 \[OK\]$),
], "without LEOM and without allow-split logged correctly");
cleanup_log();