[pve-devel] [PATCH/RFC guest-common 6/6] job_status: return jobs with target local node

Fabian Ebner f.ebner at proxmox.com
Mon Aug 10 14:35:57 CEST 2020


even if not scheduled for removal, while adapting
replicate to die gracefully except for the removal case.

Like this such invalid jobs are not hidden to the user anymore
(at least via the API, the GUI still hides them)

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

I think it's a bit weird that such jobs only show up once
they are scheduled for removal. I'll send a patch for the
GUI too if we do want the new behavior.

 PVE/Replication.pm      | 3 +++
 PVE/ReplicationState.pm | 5 +----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/PVE/Replication.pm b/PVE/Replication.pm
index ae0f145..b5835bd 100644
--- a/PVE/Replication.pm
+++ b/PVE/Replication.pm
@@ -207,6 +207,9 @@ sub replicate {
 
     die "not implemented - internal error" if $jobcfg->{type} ne 'local';
 
+    die "job target is local node\n" if $jobcfg->{target} eq $local_node
+				     && !$jobcfg->{remove_job};
+
     my $dc_conf = PVE::Cluster::cfs_read_file('datacenter.cfg');
 
     my $migration_network;
diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm
index e486bc7..0b751bb 100644
--- a/PVE/ReplicationState.pm
+++ b/PVE/ReplicationState.pm
@@ -261,10 +261,6 @@ sub job_status {
 	    $cfg->switch_replication_job_target_nolock($vmid, $local_node, $jobcfg->{source})
 		if $local_node ne $jobcfg->{source};
 
-	    my $target = $jobcfg->{target};
-	    # never sync to local node
-	    next if !$jobcfg->{remove_job} && $target eq $local_node;
-
 	    next if !$get_disabled && $jobcfg->{disable};
 
 	    my $state = extract_job_state($stateobj, $jobcfg);
@@ -280,6 +276,7 @@ sub job_status {
 	    } else  {
 		if (my $fail_count = $state->{fail_count}) {
 		    my $members = PVE::Cluster::get_members();
+		    my $target = $jobcfg->{target};
 		    if (!$fail_count || ($members->{$target} && $members->{$target}->{online})) {
 			$next_sync = $state->{last_try} + 60*($fail_count < 3 ? 5*$fail_count : 30);
 		    }
-- 
2.20.1






More information about the pve-devel mailing list