]> git.proxmox.com Git - pve-guest-common.git/commitdiff
Swap source and target in replication config, if VM was stolen.
authorWolfgang Link <w.link@proxmox.com>
Wed, 9 May 2018 12:48:26 +0000 (14:48 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 9 May 2018 13:10:30 +0000 (15:10 +0200)
PVE/ReplicationState.pm

index 085119574dfbe02ecc2f43511e9df8612a05bfc3..2851b626331d6e926a594a3e7dd1ec2971e29bb1 100644 (file)
@@ -254,8 +254,17 @@ sub job_status {
 
        my $target = $jobcfg->{target};
        if (!$jobcfg->{remove_job}) {
-           # never sync to local node
-           next if $target eq $local_node;
+           # check if vm was stolen (swapped source target)
+           if ($target eq $local_node) {
+               my $source = $jobcfg->{source};
+               if (defined($source) && $source ne $target) {
+                   $jobcfg = PVE::ReplicationConfig::swap_source_target_nolock($jobid);
+                   $cfg->{ids}->{$jobid} = $jobcfg;
+               } else {
+                   # never sync to local node
+                   next;
+               }
+           }
 
            next if !$get_disabled && $jobcfg->{disable};
        }