amdup should exit with the same code as amreport.

Try the attached patch.

Jean-Louis

On 01/21/2013 03:45 AM, watanabe hiroyuki wrote:
>
> hi
>
> I use Amanda version 3.3.3.
> I want to check the amdump exit code of the success or failure of a
> backup.
> However, infrequently amdump exit code is 0, but amrecover exit code is 4.
>
> Procedure
>
> 1.
> run amdump.
>
> 2.
> During run amdump, one of backup client is shut down.(not running client)
>
> 3.
> amdump end.(exit code 0)
>
> 4.
> run amreport.(exit code 4)
>
>
> This backup is considered to have failed in this state.
> However, the return value of amdump is backup succeed.
>
> Do I need to check the exit code of amreport to properly verify the
> success of the backup?
>
> ------
> [amandabackup@kvm-r63am3sv scripts]$ /usr/sbin/amdump am3-vtape
> [amandabackup@kvm-r63am3sv scripts]$ echo $?
> 0
>
> [amandabackup@kvm-r63am3sv scripts]$ /usr/sbin/amreport am3-vtape
> Hostname: kvm-r63am3sv
> Org : am3-vtape
> Config : am3-vtape
> Date : 1月 21, 2013
>
> These dumps were to tape am3-vtape-01.
> The next tape Amanda expects to use is: 1 new tape.
> The next new tape already labelled is: am3-vtape-02.
> FAILURE DUMP SUMMARY:
> kvm-r63am3cl2 /home/work/backup lev 0 FAILED [too many dumper retry:
> [request failed: No route to host]]
>
> STATISTICS:
> Total Full Incr. Level:#
> -------- -------- -------- --------
> Estimate Time (hrs:min) 0:00
> Run Time (hrs:min) 0:08
> Dump Time (hrs:min) 0:07 0:07 0:00
> Output Size (meg) 6785.1 6785.1 0.0
> Original Size (meg) 7018.0 7018.0 0.0
> Avg Compressed Size (%) 96.7 96.7 --
> DLEs Dumped 2 2 0
> Avg Dump Rate (k/s) 16532.2 16532.2 --
>
> Tape Time (hrs:min) 0:07 0:07 0:00
> Tape Size (meg) 6785.1 6785.1 0.0
> Tape Used (%) 6.8 6.8 0.0
> DLEs Taped 2 2 0
> Parts Taped 2 2 0
> Avg Tp Write Rate (k/s) 16542.7 16542.7 --
>
> USAGE BY TAPE:
> Label Time Size % DLEs Parts
> am3-vtape-01 0:07 6785M 6.8 2 2
>
> NOTES:
> planner: Adding new disk kvm-r63am3cl1:/home/work/backup.
> planner: Adding new disk kvm-r63am3cl2:/home/work/backup.
> planner: Adding new disk kvm-r63am3cl3:/home/work/backup.
> taper: Slot 1 with label am3-vtape-01 is usable
> taper: tape am3-vtape-01 kb 6947953 fm 2 [OK]
>
>
> DUMP SUMMARY:
> DUMPER STATS TAPER STATS
> HOSTNAME DISK L ORIG-MB OUT-MB COMP% MMM:SS KB/s MMM:SS KB/s
> ---------------------------------
> -------------------------------------- --------------
> kvm-r63am3cl1 /home/work/backup 0 3509 3393 96.7 3:27 16778.3 3:27 16782.5
> kvm-r63am3cl3 /home/work/backup 0 3509 3393 96.7 3:33 16293.1 3:33 16309.7
>
> (brought to you by Amanda version 3.3.3)
> [amandabackup@kvm-r63am3sv scripts]$ echo $?
> 4
> ------
>

diff --git a/server-src/amdump.pl b/server-src/amdump.pl
index 558a4c7..d0eabfb 100644
--- a/server-src/amdump.pl
+++ b/server-src/amdump.pl
@@ -128,12 +128,7 @@ sub run_subprocess {
     my $s = $? >> 8;
     debug("$proc exited with code $s");
     if ($?) {
-	if ($exit_code == 0) {
-	    debug("ignoring failing exit code $s from $proc");
-	} else {
-	    debug("recording failing exit code $s from $proc for amdump exit");
-	    $exit_code = $s;
-	}
+	$exit_code |= $s;
     }
 }
 

Reply via email to