[pve-devel] [PATCH guest-common V3] Remove noerr form replication.

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Oct 17 11:12:23 CEST 2017


On Tue, Oct 17, 2017 at 09:40:50AM +0200, Wolfgang Link wrote:
> We will handle this errors in the API and decide what to do.
> ---
>  PVE/Replication.pm | 29 +++++++++--------------------
>  1 file changed, 9 insertions(+), 20 deletions(-)
> 
> diff --git a/PVE/Replication.pm b/PVE/Replication.pm
> index e53928e..0650726 100644
> --- a/PVE/Replication.pm
> +++ b/PVE/Replication.pm
> @@ -304,7 +304,7 @@ sub replicate {
>  }
>  
>  my $run_replication_nolock = sub {
> -    my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc, $noerr, $verbose) = @_;
> +    my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc, $verbose) = @_;
>  
>      my $jobid = $jobcfg->{id};
>  
> @@ -358,34 +358,23 @@ my $run_replication_nolock = sub {
>  
>  	close($logfd);
>  
> -	die $err if $err && !$noerr;
> +	die $err if $err;
>      };
> -    if (my $err = $@) {
> -	if ($noerr) {
> -	    warn "$jobid: got unexpected replication job error - $err";
> -	} else {
> -	    die $err;
> -	}
> -    }
> +    die $@ if $@;

Dietmar's comment on v2 applies here as well actually.

>  
>      return $volumes;
>  };
>  
>  sub run_replication {
> -    my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc, $noerr, $verbose) = @_;
> +    my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc, $verbose) = @_;
>  
>      my $volumes;
>  
> -    eval {
> -	my $timeout = 2; # do not wait too long - we repeat periodically anyways
> -	$volumes = PVE::GuestHelpers::guest_migration_lock(
> -	    $jobcfg->{guest}, $timeout, $run_replication_nolock,
> -	    $guest_class, $jobcfg, $iteration, $start_time, $logfunc, $noerr, $verbose);
> -    };
> -    if (my $err = $@) {
> -	return undef if $noerr;
> -	die $err;
> -    }
> +    my $timeout = 2; # do not wait too long - we repeat periodically anyways
> +    $volumes = PVE::GuestHelpers::guest_migration_lock(
> +	$jobcfg->{guest}, $timeout, $run_replication_nolock,
> +	$guest_class, $jobcfg, $iteration, $start_time, $logfunc, $verbose);
> +
>      return $volumes;
>  }
>  
> -- 
> 2.11.0



More information about the pve-devel mailing list