[pve-devel] [PATCH pve-guest-common 4/5] PVE::Replication::run_replication - return replicated $volumes

Dietmar Maurer dietmar at proxmox.com
Tue Jun 20 10:50:56 CEST 2017


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 PVE/Replication.pm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/PVE/Replication.pm b/PVE/Replication.pm
index 7686222..64432eb 100644
--- a/PVE/Replication.pm
+++ b/PVE/Replication.pm
@@ -208,7 +208,7 @@ sub replicate {
 	PVE::ReplicationConfig::delete_job($jobid); # update config
 	$logfunc->("job removed");
 
-	return;
+	return undef;
     }
 
     my $ssh_info = PVE::Cluster::get_ssh_info($jobcfg->{target}, $migration_network);
@@ -296,6 +296,8 @@ sub replicate {
     remote_finalize_local_job($ssh_info, $jobid, $vmid, $sorted_volids, $start_time, $logfunc);
 
     die $err if $err;
+
+    return $volumes;
 }
 
 my $run_replication_nolock = sub {
@@ -303,6 +305,8 @@ my $run_replication_nolock = sub {
 
     my $jobid = $jobcfg->{id};
 
+    my $volumes;
+
     # we normaly write errors into the state file,
     # but we also catch unexpected errors and log them to syslog
     # (for examply when there are problems writing the state file)
@@ -329,7 +333,7 @@ my $run_replication_nolock = sub {
 	$logfunc_wrapper->("start replication job");
 
 	eval {
-	    replicate($guest_class, $jobcfg, $state, $start_time, $logfunc_wrapper);
+	    $volumes = replicate($guest_class, $jobcfg, $state, $start_time, $logfunc_wrapper);
 	};
 	my $err = $@;
 
@@ -347,14 +351,18 @@ my $run_replication_nolock = sub {
     if (my $err = $@) {
 	warn "$jobid: got unexpected replication job error - $err";
     }
+
+    return $volumes;
 };
 
 sub run_replication {
     my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc, $noerr) = @_;
 
+    my $volumes;
+
     eval {
 	my $timeout = 2; # do not wait too long - we repeat periodically anyways
-	PVE::GuestHelpers::guest_migration_lock(
+	$volumes = PVE::GuestHelpers::guest_migration_lock(
 	    $jobcfg->{guest}, $timeout, $run_replication_nolock,
 	    $guest_class, $jobcfg, $iteration, $start_time, $logfunc);
     };
@@ -362,6 +370,7 @@ sub run_replication {
 	return undef if $noerr;
 	die $err;
     }
+    return $volumes;
 }
 
 1;
-- 
2.11.0




More information about the pve-devel mailing list