my $datestamp = "20100101010203";
# set up a 2-tape disk changer with some spanned dumps in it, and add those
-# dumps to the catalog, too. To avoid re-implementing Amanda::Taper::Scan, this
+# dumps to the catalog, too. To avoid re-implementing Amanda::Taper::Scribe, this
# uses individual transfers for each part.
sub setup_changer {
my ($finished_cb, $chg_name, $to_write, $part_len) = @_;
my ($slot, $xfer_info, $partnum);
my $steps = define_steps
- cb_ref => \$finished_cb;
+ cb_ref => \$finished_cb,
+ finalize => sub { $chg->quit() };
step setup => sub {
$chg = Amanda::Changer->new($chg_name);
my $name = $xfer_info->[2];
my $hdr = Amanda::Header->new();
- $hdr->{'type'} = $Amanda::Header::F_SPLIT_DUMPFILE;
+ # if the partnum is 0, write a DUMPFILE like Amanda < 3.1 did
+ $hdr->{'type'} = $partnum? $Amanda::Header::F_SPLIT_DUMPFILE : $Amanda::Header::F_DUMPFILE;
$hdr->{'datestamp'} = $datestamp;
$hdr->{'dumplevel'} = 0;
$hdr->{'name'} = $name;
my $key = $xfer_info->[1];
my $xsrc = Amanda::Xfer::Source::Random->new($len, $key);
- my $xdst = Amanda::Xfer::Dest::Device->new($dev, 1024*256);
+ my $xdst = Amanda::Xfer::Dest::Device->new($dev, 0);
my $xfer = Amanda::Xfer->new([$xsrc, $xdst]);
$xfer->start(sub {
diskname => "/$name",
level => 0,
status => "OK",
- partnum => $partnum,
+ # get the partnum right, even if this wasn't split
+ partnum => $partnum? $partnum : ($partnum+1),
nparts => -1,
kb => $len / 1024,
sec => 1.2,
);
my @to_write = (
# slot xfer partnum
- [ 1, $xfer_info[0], 1 ],
+ [ 1, $xfer_info[0], 0 ], # partnum 0 => old non-split header
[ 1, $xfer_info[1], 1 ],
[ 1, $xfer_info[1], 2 ],
[ 2, $xfer_info[1], 3 ],
return bless \%params, $class;
}
-sub notif_part {
+sub clerk_notif_part {
my $self = shift;
- if (exists $self->{'notif_part'}) {
- $self->{'notif_part'}->(@_);
+ if (exists $self->{'clerk_notif_part'}) {
+ $self->{'clerk_notif_part'}->(@_);
} else {
- $self->SUPER::notif_part(@_);
+ $self->SUPER::clerk_notif_part(@_);
}
}
my $clerk;
my $feedback;
-my @notif_parts;
+my @clerk_notif_parts;
my $chg = Amanda::Changer->new("chg-disk:$taperoot");
my $scan = Amanda::Recovery::Scan->new(chg => $chg);
# recover from TESTCONF02, then 01, and then 02 again
-@notif_parts = ();
+@clerk_notif_parts = ();
$feedback = main::Feedback->new(
- notif_part => sub {
- push @notif_parts, [ $_[0], $_[1] ],
+ clerk_notif_part => sub {
+ push @clerk_notif_parts, [ $_[0], $_[1] ],
},
);
+$chg = Amanda::Changer->new("chg-disk:$taperoot");
+$scan = Amanda::Recovery::Scan->new(chg => $chg);
$clerk = Amanda::Recovery::Clerk->new(scan => $scan, debug => 1,
feedback => $feedback);
),
msg => "two-part recovery from second tape successful");
-is_deeply([ @notif_parts ], [
+is_deeply([ @clerk_notif_parts ], [
[ 'TESTCONF02', 2 ],
[ 'TESTCONF02', 3 ],
- ], "..and notif_part calls are correct");
+ ], "..and clerk_notif_part calls are correct");
try_recovery(
clerk => $clerk,
}
my $tapelist = Amanda::Config::config_dir_relative("tapelist");
- my $tl = Amanda::Tapelist::read_tapelist($tapelist);
+ my $tl = Amanda::Tapelist->new($tapelist);
my $chg = Amanda::Changer->new();
my $scan = Amanda::Recovery::Scan->new(chg => $chg);
[ 1024*160, 0xB000, "home" ],
);
my @to_write = (
+ # (note that slots 1 and 2 are i/e slots, and are initially empty)
# slot xfer partnum
- [ 4, $xfer_info[0], 1 ],
- [ 5, $xfer_info[0], 2 ],
- [ 5, $xfer_info[0], 3 ],
+ [ 3, $xfer_info[0], 1 ],
+ [ 4, $xfer_info[0], 2 ],
+ [ 4, $xfer_info[0], 3 ],
);
setup_changer(\&Amanda::MainLoop::quit, "ndmp_server", \@to_write, 64*1024);
clerk => $clerk,
seed => 0xB000,
dump => fake_dump("home", "/home", $datestamp, 0,
+ { label => 'TESTCONF03', filenum => 1 },
{ label => 'TESTCONF04', filenum => 1 },
- { label => 'TESTCONF05', filenum => 1 },
- { label => 'TESTCONF05', filenum => 2 },
+ { label => 'TESTCONF04', filenum => 2 },
),
msg => "multi-part ndmp recovery successful",
expect_directtcp_supported => 1);