[pve-devel] [PATCH pve-guest-common] PVE::ReplicationState - cleanup job state on job removal

Dietmar Maurer dietmar at proxmox.com
Tue Jun 27 11:41:44 CEST 2017


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 PVE/ReplicationState.pm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm
index eeab4e8..5401db6 100644
--- a/PVE/ReplicationState.pm
+++ b/PVE/ReplicationState.pm
@@ -158,12 +158,17 @@ sub record_job_end {
 	chomp $err;
 	$state->{fail_count}++;
 	$state->{error} = "$err";
+	write_job_state($jobcfg,  $state);
     } else {
-	$state->{last_sync} = $start_time;
-	$state->{fail_count} = 0;
-	delete $state->{error};
+	if ($jobcfg->{remove_job}) {
+	    write_job_state($jobcfg, undef);
+	} else {
+	    $state->{last_sync} = $start_time;
+	    $state->{fail_count} = 0;
+	    delete $state->{error};
+	    write_job_state($jobcfg,  $state);
+	}
     }
-    write_job_state($jobcfg,  $state);
 }
 
 sub replication_snapshot_name {
-- 
2.11.0




More information about the pve-devel mailing list