X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FReport%2Fhuman.pm;fp=perl%2FAmanda%2FReport%2Fhuman.pm;h=a88cb2934a936c0e08665efc1bc72e492e3054ac;hb=d28952249e392eb31bc8eecc53f6c477f30c617b;hp=1726fa1781c98a68a8c48790da6be8a9bcc72121;hpb=949b8910a5e23c4285d0b1aedacfc82a14dc97a5;p=debian%2Famanda diff --git a/perl/Amanda/Report/human.pm b/perl/Amanda/Report/human.pm index 1726fa1..a88cb29 100644 --- a/perl/Amanda/Report/human.pm +++ b/perl/Amanda/Report/human.pm @@ -1,8 +1,9 @@ # Copyright (c) 2010-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 @@ -397,7 +398,7 @@ sub output_tapeinfo my %incr_stats = %{ $self->{incr_stats} }; my %total_stats = %{ $self->{total_stats} }; - if (@$tape_labels > 0) { + if (getconf($CNF_REPORT_USE_MEDIA) and @$tape_labels > 0) { # slightly different sentence depending on the run type my $tapelist_str; @@ -458,47 +459,49 @@ sub output_tapeinfo } } - my $nb_new_tape = 0; - my $run_tapes = getconf($CNF_RUNTAPES); + if (getconf($CNF_REPORT_NEXT_MEDIA)) { + my $nb_new_tape = 0; + my $run_tapes = getconf($CNF_RUNTAPES); - if ($run_tapes) { - ($run_tapes > 1) + if ($run_tapes) { + ($run_tapes > 1) ? print $fh "The next $run_tapes tapes Amanda expects to use are: " : print $fh "The next tape Amanda expects to use is: "; - } + } + + my $first = 1; + foreach my $i ( 0 .. ( $run_tapes - 1 ) ) { - my $first = 1; - foreach my $i ( 0 .. ( $run_tapes - 1 ) ) { + if ( my $tape_label = + Amanda::Tapelist::get_last_reusable_tape_label($i) ) { - if ( my $tape_label = - Amanda::Tapelist::get_last_reusable_tape_label($i) ) { + if ($nb_new_tape) { + print $fh ", " if !$first; + print $fh "$nb_new_tape new tape" + . ( $nb_new_tape > 1 ? "s" : "" ); + $nb_new_tape = 0; + $first = 0; + } - if ($nb_new_tape) { - print $fh ", " if !$first; - print $fh "$nb_new_tape new tape" - . ( $nb_new_tape > 1 ? "s" : "" ); - $nb_new_tape = 0; + print $fh + $first ? "" : ", ", + $tape_label; $first = 0; - } + } else { + $nb_new_tape++; + } + } - print $fh - $first ? "" : ", ", - $tape_label; - $first = 0; - } else { - $nb_new_tape++; - } - } + if ($nb_new_tape) { + print $fh ", " if !$first; + print $fh "$nb_new_tape new tape" + . ( $nb_new_tape > 1 ? "s" : "" ); + } + print $fh ".\n"; - if ($nb_new_tape) { - print $fh ", " if !$first; - print $fh "$nb_new_tape new tape" - . ( $nb_new_tape > 1 ? "s" : "" ); + my $new_tapes = Amanda::Tapelist::list_new_tapes(getconf($CNF_RUNTAPES)); + print $fh "$new_tapes\n" if $new_tapes; } - print $fh ".\n"; - - my $new_tapes = Amanda::Tapelist::list_new_tapes(getconf($CNF_RUNTAPES)); - print $fh "$new_tapes\n" if $new_tapes; return; } @@ -1047,6 +1050,7 @@ sub output_summary my $nodump_PARTIAL_format = get_summary_format($col_spec, 'nodump-PARTIAL', @summary_linedata); my $nodump_FAILED_format = get_summary_format($col_spec, 'nodump-FAILED', @summary_linedata); my $nodump_FLUSH_format = get_summary_format($col_spec, 'nodump-FLUSH', @summary_linedata); + my $nodump_NOT_FLUSHED_format = get_summary_format($col_spec, 'nodump-NOT FLUSHED', @summary_linedata); my $skipped_format = get_summary_format($col_spec, 'skipped', @summary_linedata); ## print the header names @@ -1106,6 +1110,10 @@ sub output_summary print $fh sprintf($nodump_FAILED_format, @data); } elsif ($type eq 'nodump-FLUSH') { print $fh sprintf($nodump_FLUSH_format, @data); + } elsif ($type eq 'nodump-NOT FLUSHED') { +debug("nodump_NOT_FLUSHED_format; $nodump_NOT_FLUSHED_format"); +debug("data: " . Data::Dumper::Dumper(\@data)); + print $fh sprintf($nodump_NOT_FLUSHED_format, @data); } elsif ($type eq 'missing') { print $fh sprintf($missing_format, @data[0..2]); } elsif ($type eq 'noflush') { @@ -1127,7 +1135,7 @@ sub output_summary ## ('missing', host, disk, '' ..) # MISSING ----- ## ('noflush', host, disk, '' ..) # NO FILE TO FLUSH ------ ## ('nodump-$msg', host, disk, level, '', out, '--', '', -## '', tapetime, taperate, taperpartial) # ... {FLUSH|FAILED|PARTIAL} ... +## '', tapetime, taperate, taperpartial) # ... {FLUSH|NOT FLUSHED|FAILED|PARTIAL} ... ## ('skipped', host, disk, '' ..) # SKIPPED ----- ## ## the taperpartial column is not covered by the columnspec, and "hangs off" @@ -1193,10 +1201,10 @@ sub get_summary_info push @rvs, [@rv]; } elsif (keys %{$alldumps} == 0) { my @rv; - push @rv, $report->get_flag("amflush_run")? 'noflush' : 'missing'; + push @rv, $report->get_flag("amflush_run")? 'nodump-NOT FLUSHED' : 'missing'; push @rv, $hostname; push @rv, $disk_out; - push @rv, ("",) x 8; + push @rv, ("",) x 9; push @rvs, [@rv]; } @@ -1224,6 +1232,7 @@ sub get_summary_info if defined $dumper; my ( $out_size, $dump_time, $dump_rate, $tape_time, $tape_rate ) = (0) x 5; + my $tape_failure_from = ''; my ($dumper_status) = ""; my $saw_dumper = 0; # no dumper will mean this was a flush my $taper_partial = 0; # was the last taper run partial? @@ -1243,6 +1252,7 @@ sub get_summary_info $out_size = $try->{taper}{kb}; $tape_time = $try->{taper}{sec}; $tape_rate = $try->{taper}{kps}; + $tape_failure_from = $try->{taper}{failure_from}; } elsif ( exists $try->{taper} && ( $try->{taper}{status} eq "partial" ) ) { @@ -1251,9 +1261,11 @@ sub get_summary_info $out_size = $try->{taper}{kb}; $tape_time = $try->{taper}{sec} if !$tape_time; $tape_rate = $try->{taper}{kps} if !$tape_rate; + $tape_failure_from = $try->{taper}{failure_from}; } elsif (exists $try->{taper} && ( $try->{taper}{status} eq "fail")) { $tape_time = undef; $tape_rate = undef; + $tape_failure_from = $try->{taper}{failure_from}; } if (!$out_size && @@ -1319,7 +1331,7 @@ sub get_summary_info my @rv; - if ( !$orig_size && !$out_size && (!defined($tape_time) || !$tape_time)) { + if ( !$orig_size && !$out_size && ((!defined($tape_time) || !$tape_time) && !defined($tape_failure_from))) { push @rv, $report->get_flag("amflush_run")? 'noflush' : 'missing'; push @rv, $hostname; push @rv, $disk_out; @@ -1334,20 +1346,27 @@ sub get_summary_info push @rv, $compression; push @rv, $dump_time ? $fmt_col_field->(6, mnsc($dump_time)) : "PARTIAL"; push @rv, $dump_rate ? $fmt_col_field->(7, $dump_rate) : ""; - push @rv, $fmt_col_field->(8, + if (defined $tape_failure_from and $tape_failure_from eq 'config') { + push @rv, $format_space->(8,""); + push @rv, $format_space->(9,""); + } else { + push @rv, $fmt_col_field->(8, (defined $tape_time) ? $tape_time ? mnsc($tape_time) : "" : "FAILED"); - push @rv, (defined $tape_rate) ? - $tape_rate ? - $fmt_col_field->(9, $tape_rate) - : $format_space->(9, "") - : $format_space->(9, "FAILED"); + push @rv, (defined $tape_rate) ? + $tape_rate ? + $fmt_col_field->(9, $tape_rate) + : $format_space->(9, "") + : $format_space->(9, "FAILED"); + } push @rv, $taper_partial? " PARTIAL" : ""; # column 10 } else { my $message = $saw_dumper? ($dumper_status eq 'failed') ? 'FAILED' : 'PARTIAL' - : 'FLUSH'; + : (defined $tape_failure_from and + $tape_failure_from eq 'config') ? 'NOT FLUSHED' + : 'FLUSH'; push @rv, "nodump-$message"; push @rv, $hostname; push @rv, $disk_out; @@ -1357,15 +1376,21 @@ sub get_summary_info push @rv, $compression; push @rv, ''; push @rv, ''; - push @rv, $fmt_col_field->(8, - (defined $tape_time) ? - $tape_time ? mnsc($tape_time) : "" - : "FAILED"); - push @rv, (defined $tape_rate) ? - $tape_rate ? - $fmt_col_field->(9, $tape_rate) - : $format_space->(9, "") - : $format_space->(9, "FAILED"); + if (defined $tape_failure_from and $tape_failure_from eq 'config') { + push @rv, $format_space->(8,""); + push @rv, $format_space->(9,""); + next if !$report->get_flag("amflush_run"); # do not print a line for flush with config error + } else { + push @rv, $fmt_col_field->(8, + (defined $tape_time) ? + $tape_time ? mnsc($tape_time) : "" + : "FAILED"); + push @rv, (defined $tape_rate) ? + $tape_rate ? + $fmt_col_field->(9, $tape_rate) + : $format_space->(9, "") + : $format_space->(9, "FAILED"); + } push @rv, $taper_partial? " PARTIAL" : ""; } push @rvs, [@rv];