-# Copyright (c) 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved.
+# Copyright (c) 2008-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
(integer) -- number of successful parts in this dump
+=item bytes
+
+(integer) -- size (in bytes) of the dump on disk, 0 if the size is not known.
+
=item kb
(integer) -- size (in kb) of the dump on disk
=cut
-use Amanda::Logfile qw( :constants match_disk match_host
- match_datestamp match_level );
+use Amanda::Logfile qw( :constants );
use Amanda::Tapelist;
use Amanda::Config qw( :init :getconf config_dir_relative );
-use Amanda::Util qw( quote_string weaken_ref );
+use Amanda::Util qw( quote_string weaken_ref match_disk match_host match_datestamp match_level);
use File::Glob qw( :glob );
use warnings;
use strict;
# the rest of these params are unknown until we see a taper
# DONE, PARTIAL, or FAIL line, although we count nparts
# manually instead of relying on the logfile
- nparts => 0,
- kb => -1,
- sec => -1,
+ nparts => 0, # $find_result->{'totalparts'}
+ bytes => -1, # $find_result->{'bytes'}
+ kb => -1, # $find_result->{'kb'}
+ sec => -1, # $find_result->{'sec'}
};
}
);
# and fix up the dump, too
$dump->{'status'} = $find_result->{'status'} || 'FAILED';
+ $dump->{'bytes'} = $find_result->{'bytes'};
$dump->{'kb'} = $find_result->{'kb'};
$dump->{'sec'} = $find_result->{'sec'};
}
# now extract the appropriate info; luckily these log lines have the same
# format, more or less
- my ($hostname, $diskname, $dump_timestamp, $nparts, $level, $secs, $kb, $message);
+ my ($hostname, $diskname, $dump_timestamp, $nparts, $level, $secs, $kb, $bytes, $message);
($hostname, $str) = Amanda::Util::skip_quoted_string($str);
($diskname, $str) = Amanda::Util::skip_quoted_string($str);
($dump_timestamp, $str) = Amanda::Util::skip_quoted_string($str);
if ($status ne 'FAIL' and $type != $L_SUCCESS) { # nparts is not in SUCCESS lines
- ($nparts, $str) = Amanda::Util::skip_quoted_string($str);
+ ($nparts, my $str1) = Amanda::Util::skip_quoted_string($str);
+ if (substr($str1, 0,1) ne '[') {
+ $str = $str1;
+ } else { # nparts is not in all PARTIAL lines
+ $nparts = 0;
+ }
+
} else {
$nparts = 0;
}
($level, $str) = Amanda::Util::skip_quoted_string($str);
if ($status ne 'FAIL') {
my $s = $str;
- ($secs, $kb, $str) = ($str =~ /^\[sec ([-0-9.]+) kb (\d+).*\] ?(.*)$/)
+ my $b_unit;
+ ($secs, $b_unit, $kb, $str) = ($str =~ /^\[sec ([-0-9.]+) (kb|bytes) ([-0-9]+).*\] ?(.*)$/)
or die("'$s'");
+ if ($b_unit eq 'bytes') {
+ $bytes = $kb;
+ $kb /= 1024;
+ } else {
+ $bytes = 0;
+ }
$secs = 0.1 if ($secs <= 0);
}
if ($status ne 'OK') {
$dump->{'message'} = $message;
if ($status eq 'FAIL') {
+ $dump->{'bytes'} = 0;
$dump->{'kb'} = 0;
$dump->{'sec'} = 0.0;
} else {
+ $dump->{'bytes'} = $bytes+0;
$dump->{'kb'} = $kb+0;
$dump->{'sec'} = $secs+0.0;
}
for my $key (@$keys) {
my ($rev, $k) = ($key =~ /^(-?)(.*)$/);
- if ($k =~ /^(nparts|level)$/) {
+ if ($k =~ /^(nparts|level|filenum)$/) {
# compare dump components numerically
$res = $a->{$k} <=> $b->{$k};
} else { # ($k =~ /^(hostname|diskname|write_timestamp|dump_timestamp)$/)