[pve-devel] [PATCH guest-common 6/6] Swap source and target in replication config, if VM was stolen.

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Dec 14 08:58:05 CET 2017


On 12/13/2017 03:46 PM, Wolfgang Link wrote:
> ---
>  PVE/ReplicationState.pm | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm
> index 0851195..52688bb 100644
> --- a/PVE/ReplicationState.pm
> +++ b/PVE/ReplicationState.pm
> @@ -255,7 +255,15 @@ sub job_status {
>  	my $target = $jobcfg->{target};
>  	if (!$jobcfg->{remove_job}) {
>  	    # never sync to local node
> -	    next if $target eq $local_node;
> +	    # but check if vm was stolen (swaped source target)

s/but//
s/swaped/swapped/

> +	    if ($target eq $local_node) {
> +		my $source = $jobcfg->{source};
> +		if (defined($source) && $source ne $target) {
> +		    $jobcfg = PVE::ReplicationConfig::swap_source_target($jobid);
> +		} else {
> +		    next;

Please move the "never sync to local node" comment here

> +		}
> +	    }
>  
>  	    next if !$get_disabled && $jobcfg->{disable};
>  	}
> 





More information about the pve-devel mailing list