X-Git-Url: https://git.gag.com/?p=debian%2Famanda;a=blobdiff_plain;f=installcheck%2Ftaper.pl;h=3cb4b2a73e7de3a21a1b389aab9dea68d4672f83;hp=707d1e16cbe043f1376c54de5a798b7dead65ffc;hb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;hpb=fd48f3e498442f0cbff5f3606c7c403d0566150e diff --git a/installcheck/taper.pl b/installcheck/taper.pl index 707d1e1..3cb4b2a 100644 --- a/installcheck/taper.pl +++ b/installcheck/taper.pl @@ -16,7 +16,9 @@ # Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com -use Test::More tests => 172; +use Test::More tests => 201; +use strict; +use warnings; use lib '@amperldir@'; use Installcheck::Run; @@ -63,7 +65,12 @@ sub run_taper { cleanup_taper(); unless ($params{'keep_config'}) { - my $testconf = Installcheck::Run::setup(); + my $testconf; + if ($params{'new_vtapes'}) { + $testconf = Installcheck::Run::setup(1); + } else { + $testconf = Installcheck::Run::setup(); + } $testconf->add_param('autolabel', '"TESTCONF%%" empty volume_error'); if ($params{'notapedev'}) { $testconf->remove_param('tapedev'); @@ -73,6 +80,10 @@ sub run_taper { $ndmp->reset(); $ndmp->config($testconf); } + unless ($params{'leom'} or $params{'ndmp_server'}) { + $testconf->add_param('device_property', '"LEOM" "OFF"'); + } + $testconf->add_param('debug_taper', '9'); ## TEMPORARY $testconf->add_tapetype('TEST-TAPE', [ 'length' => "$length", ]); @@ -103,7 +114,7 @@ sub run_taper { $taper_reply_timeout = 120; } - taper_cmd("START-TAPER $datestamp"); + taper_cmd("START-TAPER worker0 $datestamp"); } sub wait_for_exit { @@ -173,8 +184,8 @@ sub check_logs { close($logfile); while (@logfile and @$expected) { - $logline = shift @logfile; - $expline = shift @$expected; + my $logline = shift @logfile; + my $expline = shift @$expected; chomp $logline; if ($logline !~ $expline) { like($logline, $expline, $msg); @@ -216,7 +227,7 @@ sub write_dumpfile_header_to { $hdr->{'program'} = "INSTALLCHECK"; $hdr = $hdr->to_string(32768,32768); - $fh->write($hdr); + $fh->syswrite($hdr, 32768); } sub write_dumpfile_data_to { @@ -251,7 +262,7 @@ sub write_to_port { my ($port_cmd, $size, $hostname, $disk, $expect_error) = @_; my ($header_port, $data_addr) = - ($last_taper_reply =~ /^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+)/); + ($last_taper_reply =~ /^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+)/); # just run this in the child return unless fork() == 0; @@ -282,15 +293,16 @@ sub write_to_port { $handle = "11-11111"; $datestamp = "20070102030405"; run_taper(4096, "single-part and multipart FILE-WRITE"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; make_holding_file(1024*1024, "localhost", "/home"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /home 0 $datestamp 0 12"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /home 0 $datestamp \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" 12"); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 1024 "\[sec [\d.]+ kb 1024 kps [\d.]+ orig-kb 12\]"$/, "got PARTDONE") or die; like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 1024 kps [\d.]+ orig-kb 12\]" "" ""$/, @@ -302,7 +314,7 @@ like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 1024 kp $handle = '11-22222'; make_holding_file(1024*1024, "localhost", "/usr"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /usr 0 $datestamp 524288 512"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /usr 0 $datestamp 524288 \"\" \"\" 1 \"\" \"\" \"\" \"\" 512"); like(taper_reply, qr/^PARTDONE $handle TESTCONF01 2 512 "\[sec [\d.]+ kb 512 kps [\d.]+ orig-kb 512\]"$/, "got PARTDONE for filenum 2") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 3 512 "\[sec [\d.]+ kb 512 kps [\d.]+ orig-kb 512\]"$/, @@ -313,7 +325,6 @@ taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /home $datestamp 1/-1 0 \[sec [\d.]+ kb 1024 kps [\d.]+ orig-kb 12\]$), qr(^DONE taper localhost /home $datestamp 1 0 \[sec [\d.]+ kb 1024 kps [\d.]+ orig-kb 12\]$), @@ -381,17 +392,18 @@ check_logs([ $handle = "11-33333"; $datestamp = "19780615010203"; run_taper(4096, "multipart PORT-WRITE"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; -taper_cmd("PORT-WRITE $handle localhost /var 0 $datestamp 524288 NULL 393216"); -like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, +taper_cmd("PORT-WRITE worker0 $handle localhost /var 0 $datestamp 524288 \"\" 393216 1 0 \"\" \"\" 0 AMANDA"); +like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 63*32768, "localhost", "/var", 0); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 384 "\[sec [\d.]+ kb 384 kps [\d.]+\]"$/, "got PARTDONE for filenum 1") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 2 384 "\[sec [\d.]+ kb 384 kps [\d.]+\]"$/, @@ -406,14 +418,13 @@ like(taper_reply, qr/^PARTDONE $handle TESTCONF01 6 96 "\[sec [\d.]+ kb 96 kps [ "got PARTDONE for filenum 6") or die; like(taper_reply, qr/^DUMPER-STATUS $handle$/, "got DUMPER-STATUS request") or die; -taper_cmd("DONE $handle 712"); +taper_cmd("DONE worker0 $handle 712"); like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 2016 kps [\d.]+ orig-kb 712\]" "" ""$/, "got DONE") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /var $datestamp 1/-1 0 \[sec [\d.]+ kb 384 kps [\d.]+\]$), qr(^PART taper TESTCONF01 2 localhost /var $datestamp 2/-1 0 \[sec [\d.]+ kb 384 kps [\d.]+\]$), @@ -431,22 +442,21 @@ check_logs([ $handle = "11-44444"; $datestamp = "19411207000000"; run_taper(4096, "testing NO-NEW-TAPE from the driver on 1st request"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; make_holding_file(1024*1024, "localhost", "/home"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /home 0 $datestamp 0 912"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /home 0 $datestamp 0 \"\" 0 1 0 \"\" \"\" 0 912"); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NO-NEW-TAPE sorry"); -like(taper_reply, qr/^FAILED $handle INPUT-GOOD TAPE-ERROR "" "CONFIG:sorry"?.*$/, + "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"?.*$/, "got FAILED") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), - qr(^ERROR taper no-tape \[CONFIG:sorry\]$), - qr(^FAIL taper localhost /home $datestamp 0 "CONFIG:sorry"$), + qr(^ERROR taper no-tape config \[sorry\]$), + qr(^FAIL taper localhost /home $datestamp 0 config sorry$), ], "NO-NEW-TAPE logged correctly"); ## @@ -455,44 +465,44 @@ check_logs([ $handle = "11-55555"; $datestamp = "19750711095836"; run_taper(1024, "PORT-WRITE retry on EOT (mem cache)"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; -taper_cmd("PORT-WRITE $handle localhost /usr/local 0 $datestamp 786432 NULL 786432"); -like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, +taper_cmd("PORT-WRITE worker0 $handle localhost /usr/local 0 $datestamp 786432 \"\" 786432 1 0 \"\" \"\" 0 AMANDA"); +like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 1575936, "localhost", "/usr/local", 0); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 768 "\[sec [\d.]+ kb 768 kps [\d.]+\]"$/, "got PARTDONE for filenum 1") or die; like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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 TESTCONF02$/, - "got proper NEW-TAPE") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 1 768 "\[sec [\d.]+ kb 768 kps [\d.]+\]"$/, "got PARTDONE for filenum 1 on second tape") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 2 3 "\[sec [\d.]+ kb 3 kps [\d.]+\]"$/, "got PARTDONE for filenum 2 on second tape") or die; like(taper_reply, qr/^DUMPER-STATUS $handle$/, "got DUMPER-STATUS request") or die; -taper_cmd("DONE $handle 1012"); +taper_cmd("DONE worker0 $handle 1012"); like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 1539 kps [\d.]+ orig-kb 1012\]" "" ""$/, "got DONE") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /usr/local $datestamp 1/-1 0 \[sec [\d.]+ kb 768 kps [\d.]+\]$), qr(^PARTPARTIAL taper TESTCONF01 2 localhost /usr/local $datestamp 2/-1 0 \[sec [\d.]+ kb 160 kps [\d.]+\] "No space left on device"$), qr(^INFO taper Will request retry of failed split part\.$), qr(^INFO taper tape TESTCONF01 kb 768 fm 2 \[OK\]$), - qr(^INFO taper Will write new label `TESTCONF02' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), qr(^PART taper TESTCONF02 1 localhost /usr/local $datestamp 2/-1 0 \[sec [\d.]+ kb 768 kps [\d.]+\]$), qr(^PART taper TESTCONF02 2 localhost /usr/local $datestamp 3/-1 0 \[sec [\d.]+ kb 3 kps [\d.]+\]$), @@ -506,22 +516,24 @@ check_logs([ $handle = "11-66666"; $datestamp = "19470815000000"; run_taper(1024, "FILE-WRITE retry on EOT"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; make_holding_file(1575936, "localhost", "/usr"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /usr 0 $datestamp 786432 1112"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /usr 0 $datestamp \"\" \"\" \"\" 1 786432 \"\" \"\" \"\" 1112"); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 768 "\[sec [\d.]+ kb 768 kps [\d.]+ orig-kb 1112\]"$/, "got PARTDONE for filenum 1") or die; like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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 TESTCONF02$/, - "got proper NEW-TAPE") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 1 768 "\[sec [\d.]+ kb 768 kps [\d.]+ orig-kb 1112\]"$/, "got PARTDONE for filenum 1 on second tape") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 2 3 "\[sec [\d.]+ kb 3 kps [\d.]+ orig-kb 1112\]"$/, @@ -532,13 +544,11 @@ taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /usr $datestamp 1/-1 0 \[sec [\d.]+ kb 768 kps [\d.]+ orig-kb 1112\]$), qr(^PARTPARTIAL taper TESTCONF01 2 localhost /usr $datestamp 2/-1 0 \[sec [\d.]+ kb 160 kps [\d.]+ orig-kb 1112\] "No space left on device"$), qr(^INFO taper Will request retry of failed split part\.$), qr(^INFO taper tape TESTCONF01 kb 768 fm 2 \[OK\]$), - qr(^INFO taper Will write new label `TESTCONF02' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), qr(^PART taper TESTCONF02 1 localhost /usr $datestamp 2/-1 0 \[sec [\d.]+ kb 768 kps [\d.]+ orig-kb 1112\]$), qr(^PART taper TESTCONF02 2 localhost /usr $datestamp 3/-1 0 \[sec [\d.]+ kb 3 kps [\d.]+ orig-kb 1112\]$), @@ -552,44 +562,44 @@ check_logs([ $handle = "11-77777"; $datestamp = "20090427212500"; run_taper(1024, "PORT-WRITE retry on EOT (disk cache)"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; -taper_cmd("PORT-WRITE $handle localhost /usr/local 0 $datestamp 786432 \"$Installcheck::TMP\" 786432"); -like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, +taper_cmd("PORT-WRITE worker0 $handle localhost /usr/local 0 $datestamp 786432 \"$Installcheck::TMP\" 786432 1 0 \"\" \"\" 0 AMANDA"); +like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 1575936, "localhost", "/usr/local", 0); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 768 "\[sec [\d.]+ kb 768 kps [\d.]+\]"$/, "got PARTDONE for filenum 1") or die; like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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 TESTCONF02$/, - "got proper NEW-TAPE") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 1 768 "\[sec [\d.]+ kb 768 kps [\d.]+\]"$/, "got PARTDONE for filenum 1 on second tape") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 2 3 "\[sec [\d.]+ kb 3 kps [\d.]+\]"$/, "got PARTDONE for filenum 2 on second tape") or die; like(taper_reply, qr/^DUMPER-STATUS $handle$/, "got DUMPER-STATUS request") or die; -taper_cmd("DONE $handle 1212"); +taper_cmd("DONE worker0 $handle 1212"); like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 1539 kps [\d.]+ orig-kb 1212\]" "" ""$/, "got DONE") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /usr/local $datestamp 1/-1 0 \[sec [\d.]+ kb 768 kps [\d.]+\]$), qr(^PARTPARTIAL taper TESTCONF01 2 localhost /usr/local $datestamp 2/-1 0 \[sec [\d.]+ kb 160 kps [\d.]+\] "No space left on device"$), qr(^INFO taper Will request retry of failed split part\.$), qr(^INFO taper tape TESTCONF01 kb 768 fm 2 \[OK\]$), - qr(^INFO taper Will write new label `TESTCONF02' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), qr(^PART taper TESTCONF02 1 localhost /usr/local $datestamp 2/-1 0 \[sec [\d.]+ kb 768 kps [\d.]+\]$), qr(^PART taper TESTCONF02 2 localhost /usr/local $datestamp 3/-1 0 \[sec [\d.]+ kb 3 kps [\d.]+\]$), @@ -604,47 +614,47 @@ check_logs([ $handle = "11-88888"; $datestamp = "20090424173000"; run_taper(1024, "PORT-WRITE failure on EOT (no cache)"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; -taper_cmd("PORT-WRITE $handle localhost /var/log 0 $datestamp 0 NULL 0"); -like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, +taper_cmd("PORT-WRITE worker0 $handle localhost /var/log 0 $datestamp 0 \"\" 0 0 0 \"\" \"\" 0 AMANDA"); +like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 1575936, "localhost", "/var/log", 1); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTIAL $handle INPUT-GOOD TAPE-ERROR "\[sec [\d.]+ kb 0 kps [\d.]+\]" "" "No space left on device"$/, "got PARTIAL") or die; # retry on the next tape $handle = "11-88899"; -taper_cmd("PORT-WRITE $handle localhost /boot 0 $datestamp 0 NULL 0"); -like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, +taper_cmd("PORT-WRITE worker0 $handle localhost /boot 0 $datestamp 0 \"\" 0 0 0 \"\" \"\" 0 AMANDA"); +like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 65536, "localhost", "/boot", 0); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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 TESTCONF02$/, - "got proper NEW-TAPE") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 1 64 "\[sec [\d.]+ kb 64 kps [\d.]+\]"$/, "got PARTDONE for filenum 1 on second tape") or die; like(taper_reply, qr/^DUMPER-STATUS $handle$/, "got DUMPER-STATUS request") or die; -taper_cmd("DONE $handle 64"); +taper_cmd("DONE worker0 $handle 64"); like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 64 kps [\d.]+ orig-kb 64\]" "" ""$/, "got DONE") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PARTPARTIAL taper TESTCONF01 1 localhost /var/log $datestamp 1/-1 0 \[sec [\d.]+ kb 960 kps [\d.]+\] "No space left on device"$), qr(^PARTIAL taper localhost /var/log $datestamp 1 0 \[sec [\d.]+ kb 0 kps [\d.]+\] "No space left on device"$), qr(^INFO taper tape TESTCONF01 kb 0 fm 1 \[OK\]$), - qr(^INFO taper Will write new label `TESTCONF02' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), qr(^PART taper TESTCONF02 1 localhost /boot $datestamp 1/-1 0 \[sec [\d.]+ kb 64 kps [\d.]+\]$), qr(^DONE taper localhost /boot $datestamp 1 0 \[sec [\d.]+ kb 64 kps [\d.]+ orig-kb 64\]$), @@ -657,35 +667,34 @@ check_logs([ $handle = "11-99999"; $datestamp = "20100101000000"; run_taper(512, "FILE-WRITE runs out of tapes"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; make_holding_file(512*1024, "localhost", "/music"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /music 0 $datestamp 262144 1312"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /music 0 $datestamp \"\" \"\" \"\" 1 262144 \"none\" \"\" 10240 1312"); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1312\]"$/, "got PARTDONE for filenum 1 on first tape") or die; like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NO-NEW-TAPE \"that's enough\""); -like(taper_reply, qr/^PARTIAL $handle INPUT-GOOD TAPE-ERROR "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1312\]" "" "CONFIG:that's enough"$/, + "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.]+ kb 256 kps [\d.]+ orig-kb 1312\]" "" "that's enough"$/, "got PARTIAL") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /music $datestamp 1/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1312\]$), qr(^PARTPARTIAL taper TESTCONF01 2 localhost /music $datestamp 2/-1 0 \[sec [\d.]+ kb 160 kps [\d.]+ orig-kb 1312\] "No space left on device"$), qr(^INFO taper Will request retry of failed split part\.$), qr(^INFO taper tape TESTCONF01 kb 256 fm 2 \[OK\]$), - qr(^ERROR taper no-tape \[CONFIG:that's enough\]$), - qr(^INFO taper Will write new label `TESTCONF02' to new tape$), - qr(^PARTIAL taper localhost /music $datestamp 2 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1312\] "CONFIG:that's enough"$), + qr(^ERROR taper no-tape config \[that's enough\]$), + qr(^PARTIAL taper localhost /music $datestamp 2 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1312\] "that's enough"$), ], "running out of tapes (simulating runtapes=1) logged correctly"); ## @@ -694,17 +703,18 @@ check_logs([ $handle = "22-00000"; $datestamp = "20200202222222"; run_taper(4096, "multipart PORT-WRITE"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; -taper_cmd("PORT-WRITE $handle localhost /sbin 0 $datestamp 10 NULL 655360"); -like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, +taper_cmd("PORT-WRITE worker0 $handle localhost /sbin 0 $datestamp 999999 \"\" 655360 1 \"\" \"\" \"\" \"\" AMANDA"); +like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 63*32768, "localhost", "/sbin", 0); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 640 "\[sec [\d.]+ kb 640 kps [\d.]+\]"$/, "got PARTDONE for filenum 1") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 2 640 "\[sec [\d.]+ kb 640 kps [\d.]+\]"$/, @@ -715,14 +725,13 @@ like(taper_reply, qr/^PARTDONE $handle TESTCONF01 4 96 "\[sec [\d.]+ kb 96 kps [ "got PARTDONE for filenum 4") or die; like(taper_reply, qr/^DUMPER-STATUS $handle$/, "got DUMPER-STATUS request") or die; -taper_cmd("FAILED $handle"); +taper_cmd("FAILED worker0 $handle"); like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 2016 kps [\d.]+\]" "" ""$/, "got DONE") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /sbin $datestamp 1/-1 0 \[sec [\d.]+ kb 640 kps [\d.]+\]$), qr(^PART taper TESTCONF01 2 localhost /sbin $datestamp 2/-1 0 \[sec [\d.]+ kb 640 kps [\d.]+\]$), @@ -738,15 +747,16 @@ check_logs([ $handle = "33-11111"; $datestamp = "20090101010000"; run_taper(1024, "first in a sequence"); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; make_holding_file(500000, "localhost", "/u01"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /u01 0 $datestamp 262144 1412"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /u01 0 $datestamp 262144 \"\" \"\" \"\" \"\" \"\" \"\" \"\" 1412"); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1412\]"$/, "got PARTDONE for filenum 1") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 2 232 "\[sec [\d.]+ kb 232 kps [\d.]+ orig-kb 1412\]"$/, @@ -755,14 +765,15 @@ like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 488 kps "got DONE") or die; $handle = "33-22222"; make_holding_file(614400, "localhost", "/u02"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /u02 0 $datestamp 262144 1512"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /u02 0 $datestamp 262144 \"\" \"\" \"\" \"\" \"\" \"\" \"\" 1512"); like(taper_reply, qr/^PARTDONE $handle TESTCONF01 3 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1512\]"$/, "got PARTDONE for filenum 3") or die; like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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 TESTCONF02$/, - "got proper NEW-TAPE") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 1 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1512\]"$/, "got PARTDONE for filenum 1 on second tape") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 2 88 "\[sec [\d.]+ kb 88 kps [\d.]+ orig-kb 1512\]"$/, @@ -773,7 +784,6 @@ taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /u01 $datestamp 1/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1412\]$), qr(^PART taper TESTCONF01 2 localhost /u01 $datestamp 2/-1 0 \[sec [\d.]+ kb 232 kps [\d.]+ orig-kb 1412\]$), @@ -782,7 +792,6 @@ check_logs([ qr(^PARTPARTIAL taper TESTCONF01 4 localhost /u02 $datestamp 2/-1 0 \[sec [\d.]+ kb 96 kps [\d.]+ orig-kb 1512\] "No space left on device"$), qr(^INFO taper Will request retry of failed split part\.$), qr(^INFO taper tape TESTCONF01 kb 744 fm 4 \[OK\]$), - qr(^INFO taper Will write new label `TESTCONF02' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), qr(^PART taper TESTCONF02 1 localhost /u02 $datestamp 2/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1512\]$), qr(^PART taper TESTCONF02 2 localhost /u02 $datestamp 3/-1 0 \[sec [\d.]+ kb 88 kps [\d.]+ orig-kb 1512\]$), @@ -794,15 +803,16 @@ cleanup_log(); $handle = "33-33333"; $datestamp = "20090202020000"; run_taper(1024, "second in a sequence", keep_config => 1); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; make_holding_file(300000, "localhost", "/u01"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /u01 0 $datestamp 262144 1612"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /u01 0 $datestamp 262144 \"\" \"\" \"\" \"\" \"\" \"\" \"\" 1612"); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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 TESTCONF03$/, - "got proper NEW-TAPE") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF03 1 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]"$/, "got PARTDONE for filenum 1") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF03 2 36 "\[sec [\d.]+ kb 36 kps [\d.]+ orig-kb 1612\]"$/, @@ -811,16 +821,17 @@ like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 292 kps "got DONE") or die; $handle = "33-44444"; make_holding_file(614400, "localhost", "/u02"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /u02 0 $datestamp 262144 1712"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /u02 0 $datestamp 262144 \"\" \"\" \"\" \"\" \"\" \"\" \"\" 1712"); like(taper_reply, qr/^PARTDONE $handle TESTCONF03 3 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1712\]"$/, "got PARTDONE for filenum 3") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF03 4 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1712\]"$/, "got PARTDONE for filenum 4") or die; like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 88 "\[sec [\d.]+ kb 88 kps [\d.]+ orig-kb 1712\]"$/, "got PARTDONE for filenum 1 on second tape") or die; like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 600 kps [\d.]+ orig-kb 1712\]" "" ""$/, @@ -829,7 +840,6 @@ taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF03' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF03 tape 1$), qr(^PART taper TESTCONF03 1 localhost /u01 $datestamp 1/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]$), qr(^PART taper TESTCONF03 2 localhost /u01 $datestamp 2/-1 0 \[sec [\d.]+ kb 36 kps [\d.]+ orig-kb 1612\]$), @@ -839,7 +849,6 @@ check_logs([ qr(^PARTPARTIAL taper TESTCONF03 5 localhost /u02 $datestamp 3/-1 0 \[sec [\d.]+ kb 0 kps [\d.]+ orig-kb 1712\] "No space left on device"$), qr(^INFO taper Will request retry of failed split part\.$), qr(^INFO taper tape TESTCONF03 kb 804 fm 5 \[OK\]$), - # note no "Will write new label.." qr(^START taper datestamp $datestamp label TESTCONF01 tape 2$), qr(^PART taper TESTCONF01 1 localhost /u02 $datestamp 3/-1 0 \[sec [\d.]+ kb 88 kps [\d.]+ orig-kb 1712\]$), qr(^DONE taper localhost /u02 $datestamp 3 0 \[sec [\d.]+ kb 600 kps [\d.]+ orig-kb 1712\]$), @@ -853,31 +862,32 @@ cleanup_log(); $handle = "33-55555"; $datestamp = "20090303030000"; run_taper(1024, "failure to overwrite a volume", keep_config => 1); -like(taper_reply, qr/^TAPER-OK$/, +like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; make_holding_file(32768, "localhost", "/u03"); -taper_cmd("FILE-WRITE $handle \"$test_filename\" localhost /u03 0 $datestamp 262144 1812"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /u03 0 $datestamp 262144 \"\" \"\" \"\" \"\" \"\" \"\" \"\" 1812"); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; + "got REQUEST-NEW-TAPE worker0 $handle") or die; # we've secretly replaced the tape in slot 1 with a read-only tape.. let's see # if anyone can tell the difference! chmod(0555, Installcheck::Run::vtape_dir(2)); -taper_cmd("NEW-TAPE"); +taper_cmd("START-SCAN worker0 $handle"); +taper_cmd("NEW-TAPE worker0 $handle"); # NO-NEW-TAPE indicates it did *not* overwrite the tape like(taper_reply, qr/^NO-NEW-TAPE $handle$/, - "got proper NO-NEW-TAPE"); # no "die" here, so we can restore perms + "got proper NO-NEW-TAPE worker0 $handle"); # no "die" here, so we can restore perms chmod(0755, Installcheck::Run::vtape_dir(2)); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; -taper_cmd("NO-NEW-TAPE \"sorry\""); -like(taper_reply, qr/^FAILED $handle INPUT-GOOD TAPE-ERROR "" "CONFIG:sorry"?.*$/, + "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"?.*$/, "got FAILED") or die; taper_cmd("QUIT"); wait_for_exit(); # (logs aren't that interesting here - filled with VFS-specific error messages) -# TODO: simulate an "erased" tape, to which taper should reply with "NEW-TAPE" and +# TODO: simulate an "erased" tape, to which taper should reply with "NEW-TAPE worker0 $handle" and # immediately REQUEST-NEW-TAPE. I can't see a way to make the VFS device erase a # volume without start_device succeeding. @@ -886,10 +896,124 @@ wait_for_exit(); $handle = "44-11111"; $datestamp = "20070102030405"; run_taper(4096, "no tapedev", notapedev => 1); -like(taper_reply, qr/^TAPE-ERROR 99-9999 "You must specify one of 'tapedev' or 'tpchanger'"$/, +like(taper_reply, qr/^TAPE-ERROR SETUP "You must specify one of 'tapedev' or 'tpchanger'"$/, "got TAPE-ERROR") or die; wait_for_exit(); +## +# A run with 2 workers +my $handle0 = "66-00000"; +my $handle1 = "66-11111"; +$datestamp = "20090202020000"; +run_taper(1024, "with 2 workers", new_vtapes => 1); +like(taper_reply, qr/^TAPER-OK worker0$/, + "got TAPER-OK") or die; +taper_cmd("START-TAPER worker1 $datestamp"); +like(taper_reply, qr/^TAPER-OK worker1$/, + "got TAPER-OK") or die; +make_holding_file(300000, "localhost", "/u01"); +taper_cmd("FILE-WRITE worker0 $handle0 \"$test_filename\" localhost /u01 0 $datestamp 262144 \"\" \"\" \"\" \"\" \"\" \"\" \"\" 1612"); +like(taper_reply, qr/^REQUEST-NEW-TAPE $handle0$/, + "got REQUEST-NEW-TAPE worker0 $handle0") or die; +taper_cmd("START-SCAN worker0 $handle0"); +taper_cmd("NEW-TAPE worker0 $handle0"); +like(taper_reply, qr/^NEW-TAPE $handle0 TESTCONF01$/, + "got proper NEW-TAPE worker0 $handle0") or die; +like(taper_reply, qr/^PARTDONE $handle0 TESTCONF01 1 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]"$/, + "got PARTDONE for filenum 1") or die; +like(taper_reply, qr/^PARTDONE $handle0 TESTCONF01 2 36 "\[sec [\d.]+ kb 36 kps [\d.]+ orig-kb 1612\]"$/, + "got PARTDONE for filenum 2") or die; +like(taper_reply, qr/^DONE $handle0 INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 292 kps [\d.]+ orig-kb 1612\]" "" ""$/, + "got DONE") or die; +make_holding_file(614400, "localhost", "/u02"); +taper_cmd("FILE-WRITE worker1 $handle1 \"$test_filename\" localhost /u02 0 $datestamp 262144 \"\" \"\" \"\" \"\" \"\" \"\" \"\" 1712"); +like(taper_reply, qr/^REQUEST-NEW-TAPE $handle1$/, + "got REQUEST-NEW-TAPE worker1 $handle1") or die; +taper_cmd("START-SCAN worker1 $handle1"); +taper_cmd("NEW-TAPE worker1 $handle1"); +like(taper_reply, qr/^NEW-TAPE $handle1 TESTCONF02$/, + "got proper NEW-TAPE worker1 $handle1") or die; +like(taper_reply, qr/^PARTDONE $handle1 TESTCONF02 1 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1712\]"$/, + "got PARTDONE for filenum 1 on second tape") or die; +like(taper_reply, qr/^PARTDONE $handle1 TESTCONF02 2 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1712\]"$/, + "got PARTDONE for filenum 2 on second tape") or die; +like(taper_reply, qr/^PARTDONE $handle1 TESTCONF02 3 88 "\[sec [\d.]+ kb 88 kps [\d.]+ orig-kb 1712\]"$/, + "got PARTDONE for filenum 3 on second tape") or die; +like(taper_reply, qr/^DONE $handle1 INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 600 kps [\d.]+ orig-kb 1712\]" "" ""$/, + "got DONE") or die; +taper_cmd("QUIT"); +wait_for_exit(); + +check_logs([ + qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), + qr(^PART taper TESTCONF01 1 localhost /u01 $datestamp 1/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]$), + qr(^PART taper TESTCONF01 2 localhost /u01 $datestamp 2/-1 0 \[sec [\d.]+ kb 36 kps [\d.]+ orig-kb 1612\]$), + qr(^DONE taper localhost /u01 $datestamp 2 0 \[sec [\d.]+ kb 292 kps [\d.]+ orig-kb 1612\]$), + qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), + qr(^PART taper TESTCONF02 1 localhost /u02 $datestamp 1/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1712\]$), + qr(^PART taper TESTCONF02 2 localhost /u02 $datestamp 2/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1712\]$), + qr(^PART taper TESTCONF02 3 localhost /u02 $datestamp 3/-1 0 \[sec [\d.]+ kb 88 kps [\d.]+ orig-kb 1712\]$), + qr(^DONE taper localhost /u02 $datestamp 3 0 \[sec [\d.]+ kb 600 kps [\d.]+ orig-kb 1712\]$), + qr(^INFO taper tape TESTCONF01 kb 292 fm 2 \[OK\]$), + qr(^INFO taper tape TESTCONF02 kb 600 fm 3 \[OK\]$), +], "two workers logged correctly"); +cleanup_log(); + +## +# A run with 2 workers and a take_scribe +$handle = "66-22222"; +$datestamp = "20090202020000"; +run_taper(1024, "with 2 workers and a take_scribe", new_vtapes => 1); +like(taper_reply, qr/^TAPER-OK worker0$/, + "got TAPER-OK") or die; +taper_cmd("START-TAPER worker1 $datestamp"); +like(taper_reply, qr/^TAPER-OK worker1$/, + "got TAPER-OK") or die; +make_holding_file(1000000, "localhost", "/u01"); +taper_cmd("FILE-WRITE worker0 $handle \"$test_filename\" localhost /u01 0 $datestamp 262144 \"\" \"\" \"\" \"\" \"\" \"\" \"\" 1612"); +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 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]"$/, + "got PARTDONE for filenum 1") or die; +like(taper_reply, qr/^PARTDONE $handle TESTCONF01 2 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]"$/, + "got PARTDONE for filenum 2") or die; +like(taper_reply, qr/^PARTDONE $handle TESTCONF01 3 256 "\[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]"$/, + "got PARTDONE for filenum 3") or die; +like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, + "got REQUEST-NEW-TAPE worker0 $handle") or die; +taper_cmd("TAKE-SCRIBE-FROM worker0 $handle worker1"); +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 TESTCONF02$/, + "got proper NEW-TAPE worker0 $handle") or die; +like(taper_reply, qr/^PARTDONE $handle TESTCONF02 1 208 "\[sec [\d.]+ kb 208 kps [\d.]+ orig-kb 1612\]"$/, + "got PARTDONE for filenum 4") or die; +like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 976 kps [\d.]+ orig-kb 1612\]" "" ""$/, + "got DONE") or die; +taper_cmd("QUIT"); +wait_for_exit(); + +check_logs([ + qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), + qr(^PART taper TESTCONF01 1 localhost /u01 $datestamp 1/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]$), + qr(^PART taper TESTCONF01 2 localhost /u01 $datestamp 2/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]$), + qr(^PART taper TESTCONF01 3 localhost /u01 $datestamp 3/-1 0 \[sec [\d.]+ kb 256 kps [\d.]+ orig-kb 1612\]$), + qr(^PARTPARTIAL taper TESTCONF01 4 localhost /u01 $datestamp 4/-1 0 \[sec [\d.]+ kb 96 kps [\d.]+ orig-kb 1612\] \"No space left on device\"$), + qr(^INFO taper Will request retry of failed split part.$), + qr(^INFO taper tape TESTCONF01 kb 768 fm 4 \[OK\]$), + qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), + qr(^PART taper TESTCONF02 1 localhost /u01 $datestamp 4/-1 0 \[sec [\d.]+ kb 208 kps [\d.]+ orig-kb 1612\]$), + qr(^DONE taper localhost /u01 $datestamp 4 0 \[sec [\d.]+ kb 976 kps [\d.]+ orig-kb 1612\]$), + qr(^INFO taper tape TESTCONF02 kb 208 fm 1 \[OK\]$), +], "TAKE-SCRIBE logged correctly"); +cleanup_log(); + ## # Test with NDMP device (DirectTCP) @@ -904,19 +1028,21 @@ SKIP : { $datestamp = "19780615010305"; run_taper(4096, "multipart directtcp PORT-WRITE", ndmp_server => $ndmp); - like(taper_reply, qr/^TAPER-OK$/, + like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; - # note that Amanda uses the fallback splitsize here, even though it doesn't - # need a disk_splitbuffer - taper_cmd("PORT-WRITE $handle localhost /var 0 $datestamp 524288 NULL 393216"); - like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, + # note that, with the addition of the new splitting params, this does the "sensible" + # thing and uses the tape_splitsize, not the fallback_splitsize (this is a change from + # Amanda-3.1) + taper_cmd("PORT-WRITE worker0 $handle localhost /var 0 $datestamp 393216 \"\" 327680 \"\" \"\" \"\" \"\" \"\" DIRECTTCP"); + like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 1230*1024, "localhost", "/var", 0); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; - taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 384 "\[sec [\d.]+ kb 384 kps [\d.]+\]"$/, "got PARTDONE for part 1") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 2 384 "\[sec [\d.]+ kb 384 kps [\d.]+\]"$/, @@ -924,43 +1050,42 @@ SKIP : { like(taper_reply, qr/^PARTDONE $handle TESTCONF01 3 64 "\[sec [\d.]+ kb 64 kps [\d.]+\]"$/, "got PARTDONE for part 3 (short part)") or die; like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; - taper_cmd("NEW-TAPE"); + "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 TESTCONF02$/, - "got proper NEW-TAPE") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 1 384 "\[sec [\d.]+ kb 384 kps [\d.]+\]"$/, "got PARTDONE for part 4") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 2 32 "\[sec [\d.]+ kb 32 kps [\d.]+\]"$/, "got PARTDONE for part 5") or die; like(taper_reply, qr/^DUMPER-STATUS $handle$/, "got DUMPER-STATUS request") or die; - taper_cmd("DONE $handle 1912"); + taper_cmd("DONE worker0 $handle 1912"); like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 1248 kps [\d.]+ orig-kb 1912\]" "" ""$/, "got DONE") or die; $handle = "55-22222"; - taper_cmd("PORT-WRITE $handle localhost /etc 0 $datestamp 524288 NULL 393216"); - like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, + taper_cmd("PORT-WRITE worker0 $handle localhost /etc 0 $datestamp 524288 \"\" 393216 \"\" \"\" \"\" \"\" \"\" DIRECTTCP"); + like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 300*1024, "localhost", "/etc", 0); like(taper_reply, qr/^PARTDONE $handle TESTCONF02 3 320 "\[sec [\d.]+ kb 320 kps [\d.]+\]"$/, "got PARTDONE for part 1") or die; like(taper_reply, qr/^DUMPER-STATUS $handle$/, "got DUMPER-STATUS request") or die; - taper_cmd("DONE $handle 2012"); + taper_cmd("DONE worker0 $handle 2012"); like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 320 kps [\d.]+ orig-kb 2012\]" "" ""$/, "got DONE") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /var $datestamp 1/-1 0 \[sec [\d.]+ kb 384 kps [\d.]+\]$), qr(^PART taper TESTCONF01 2 localhost /var $datestamp 2/-1 0 \[sec [\d.]+ kb 384 kps [\d.]+\]$), qr(^PART taper TESTCONF01 3 localhost /var $datestamp 3/-1 0 \[sec [\d.]+ kb 64 kps [\d.]+\]$), # note no "Will retry.." qr(^INFO taper tape TESTCONF01 kb 832 fm 3 \[OK\]$), - qr(^INFO taper Will write new label `TESTCONF02' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), qr(^PART taper TESTCONF02 1 localhost /var $datestamp 4/-1 0 \[sec [\d.]+ kb 384 kps [\d.]+\]$), qr(^PART taper TESTCONF02 2 localhost /var $datestamp 5/-1 0 \[sec [\d.]+ kb 32 kps [\d.]+\]$), @@ -974,54 +1099,55 @@ SKIP : { $datestamp = "19780615010305"; run_taper(4096, "multipart directtcp PORT-WRITE, with a zero-byte part", ndmp_server => $ndmp); - like(taper_reply, qr/^TAPER-OK$/, + like(taper_reply, qr/^TAPER-OK worker0$/, "got TAPER-OK") or die; # use a different part size this time, to hit EOM "on the head" - taper_cmd("PORT-WRITE $handle localhost /var 0 $datestamp 524288 NULL 425984"); - like(taper_reply, qr/^PORT (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, + taper_cmd("PORT-WRITE worker0 $handle localhost /var 0 $datestamp 425984 \"\" 327680 \"\" \"\" \"\" \"\" \"\" DIRECTTCP"); + like(taper_reply, qr/^PORT worker0 $handle (\d+) "?(\d+\.\d+\.\d+\.\d+:\d+;?)+"?$/, "got PORT with data address"); write_to_port($last_taper_reply, 1632*1024, "localhost", "/var", 0); like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; - taper_cmd("NEW-TAPE"); + "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") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 1 416 "\[sec [\d.]+ kb 416 kps [\d.]+\]"$/, "got PARTDONE for part 1") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF01 2 416 "\[sec [\d.]+ kb 416 kps [\d.]+\]"$/, "got PARTDONE for part 2") or die; # note: zero-byte part is not reported as PARTDONE like(taper_reply, qr/^REQUEST-NEW-TAPE $handle$/, - "got REQUEST-NEW-TAPE") or die; - taper_cmd("NEW-TAPE"); + "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 TESTCONF02$/, - "got proper NEW-TAPE") or die; + "got proper NEW-TAPE worker0 $handle") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 1 416 "\[sec [\d.]+ kb 416 kps [\d.]+\]"$/, "got PARTDONE for part 3") or die; like(taper_reply, qr/^PARTDONE $handle TESTCONF02 2 384 "\[sec [\d.]+ kb 384 kps [\d.]+\]"$/, "got PARTDONE for part 4") or die; like(taper_reply, qr/^DUMPER-STATUS $handle$/, "got DUMPER-STATUS request") or die; - taper_cmd("DONE $handle 2112"); + taper_cmd("DONE worker0 $handle 2112"); like(taper_reply, qr/^DONE $handle INPUT-GOOD TAPE-GOOD "\[sec [\d.]+ kb 1632 kps [\d.]+ orig-kb 2112\]" "" ""$/, "got DONE") or die; taper_cmd("QUIT"); wait_for_exit(); check_logs([ - qr(^INFO taper Will write new label `TESTCONF01' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF01 tape 1$), qr(^PART taper TESTCONF01 1 localhost /var $datestamp 1/-1 0 \[sec [\d.]+ kb 416 kps [\d.]+\]$), qr(^PART taper TESTCONF01 2 localhost /var $datestamp 2/-1 0 \[sec [\d.]+ kb 416 kps [\d.]+\]$), # Note: zero-byte part is not logged, but is counted in this INFO line's 'fm' field qr(^INFO taper tape TESTCONF01 kb 832 fm 3 \[OK\]$), - qr(^INFO taper Will write new label `TESTCONF02' to new tape$), qr(^START taper datestamp $datestamp label TESTCONF02 tape 2$), qr(^PART taper TESTCONF02 1 localhost /var $datestamp 3/-1 0 \[sec [\d.]+ kb 416 kps [\d.]+\]$), qr(^PART taper TESTCONF02 2 localhost /var $datestamp 4/-1 0 \[sec [\d.]+ kb 384 kps [\d.]+\]$), qr(^DONE taper localhost /var $datestamp 4 0 \[sec [\d.]+ kb 1632 kps [\d.]+ orig-kb 2112\]$), qr(^INFO taper tape TESTCONF02 kb 800 fm 2 \[OK\]$), ], "multipart directtcp PORT-WRITE with a zero-byte part logged correctly"); + cleanup_log(); $ndmp->cleanup(); } # end of ndmp SKIP