[pve-devel] [PATCH qemu-server 3/4] move finish_tunnel to after the VM is stopped

Mira Limbeck m.limbeck at proxmox.com
Wed Mar 11 11:44:19 CET 2020


The NBD socket on the client side is kept open until the VM stops. In
the case of TCP this was not a problem, because we did not rely on it
closing. But with unix socket forwarding via SSH the SSH connection
can't close if the socket is still open.

If it does not close by itself, it will be terminated after 30 seconds.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 PVE/QemuMigrate.pm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 44e4c57..e569a2c 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -1035,15 +1035,6 @@ 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}) {
@@ -1065,6 +1056,15 @@ sub phase3_cleanup {
 	$self->{errors} = 1;
     }
 
+    # 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;
+	}
+    }
+
     # always deactivate volumes - avoid lvm LVs to be active on several nodes
     eval {
 	my $vollist = PVE::QemuServer::get_vm_volumes($conf);
-- 
2.20.1





More information about the pve-devel mailing list