]> git.proxmox.com Git - qemu-server.git/commitdiff
migrate: finish tunnel in phase 3
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 4 Aug 2017 12:54:05 +0000 (14:54 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 7 Aug 2017 07:23:56 +0000 (09:23 +0200)
after resuming the VM over the tunnel.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/QemuMigrate.pm

index 75935e0e2b78154d10493919a99c6ee92dd24050..471d5a158d9b34759f259f4a4dbfbbcd10317382 100644 (file)
@@ -818,16 +818,6 @@ sub phase2 {
            die "unable to parse migration status '$stat->{status}' - aborting\n";
        }
     }
-
-    # 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);
-           $self->{errors} = 1;
-       }
-    }
 }
 
 sub phase2_cleanup {
@@ -977,6 +967,15 @@ sub phase3_cleanup {
        }
     }
 
+    # close tunnel on successful migration, on error phase2_cleanup closed it
+    if ($tunnel) {
+       eval { finish_tunnel($self, $tunnel);  };
+       if (my $err = $@) {
+           $self->log('err', $err);
+           $self->{errors} = 1;
+       }
+    }
+
     eval {
        my $timer = 0;
        if (PVE::QemuServer::vga_conf_has_spice($conf->{vga}) && $self->{running}) {