migrate: close tunnel after dest. VM stopped on error

On error let phase2_cleanup close the tunnel as it stops the for
incoming migration waiting VM on the destination first, to be safe.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2016-06-03 11:32:01 +02:00 committed by Dietmar Maurer
parent 1c9d54bfd0
commit 92437b8de0

View File

@ -609,8 +609,10 @@ sub phase2 {
die "unable to parse migration status '$stat->{status}' - aborting\n";
}
}
#to be sure tat the tunnel is closed
if ($self->{tunnel}) {
# just to be sure that the tunnel gets closed on successful migration, on error
# phase2_cleanup closes it *after* stopping the remote waiting VM
if (!$self->{errors} && $self->{tunnel}) {
eval { finish_tunnel($self, $self->{tunnel}); };
if (my $err = $@) {
$self->log('err', $err);