]> git.proxmox.com Git - pve-guest-common.git/commitdiff
PVE::Replication::run_replication - return replicated $volumes
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 20 Jun 2017 06:51:08 +0000 (08:51 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 20 Jun 2017 06:51:08 +0000 (08:51 +0200)
PVE/Replication.pm

index 7686222fbba675c59ba4e44df8a64c68edc02857..64432ebe609c1f82bd24641dd495e81e4b0b7073 100644 (file)
@@ -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;