5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-03-11 16:58:28 +03:00

online migration fix: close tunnel later, wait for connection close

This commit is contained in:
Dietmar Maurer 2012-01-17 11:25:44 +01:00
parent e95fe75f86
commit 97439670bc
3 changed files with 35 additions and 13 deletions

View File

@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0 VERSION=2.0
PACKAGE=qemu-server PACKAGE=qemu-server
PKGREL=14 PKGREL=15
DESTDIR= DESTDIR=
PREFIX=/usr PREFIX=/usr

View File

@ -39,7 +39,7 @@ sub fork_command_pipe {
} }
sub finish_command_pipe { sub finish_command_pipe {
my ($self, $cmdpipe) = @_; my ($self, $cmdpipe, $timeout) = @_;
my $writer = $cmdpipe->{writer}; my $writer = $cmdpipe->{writer};
my $reader = $cmdpipe->{reader}; my $reader = $cmdpipe->{reader};
@ -49,9 +49,25 @@ sub finish_command_pipe {
my $cpid = $cmdpipe->{pid}; my $cpid = $cmdpipe->{pid};
kill(15, $cpid) if kill(0, $cpid); if ($timeout) {
for (my $i = 0; $i < $timeout; $i++) {
return if !PVE::ProcFSTools::check_process_running($cpid);
sleep(1);
}
}
waitpid($cpid, 0); $self->log('info', "ssh tunnel still running - terminating now with SIGTERM\n");
kill(15, $cpid);
# wait again
for (my $i = 0; $i < 10; $i++) {
return if !PVE::ProcFSTools::check_process_running($cpid);
sleep(1);
}
$self->log('info', "ssh tunnel still running - terminating now with SIGKILL\n");
kill 9, $cpid;
sleep 1;
} }
sub fork_tunnel { sub fork_tunnel {
@ -94,7 +110,7 @@ sub finish_tunnel {
}; };
my $err = $@; my $err = $@;
$self->finish_command_pipe($tunnel); $self->finish_command_pipe($tunnel, 30);
die $err if $err; die $err if $err;
} }
@ -366,14 +382,6 @@ sub phase3 {
last if $err =~ /^interrupted by signal$/; last if $err =~ /^interrupted by signal$/;
} }
} }
if ($self->{tunnel}) {
eval { finish_tunnel($self, $self->{tunnel}); };
if (my $err = $@) {
$self->log('err', $err);
$self->{errors} = 1;
}
}
} }
sub phase3_cleanup { sub phase3_cleanup {
@ -388,6 +396,14 @@ sub phase3_cleanup {
$self->{errors} = 1; $self->{errors} = 1;
} }
if ($self->{tunnel}) {
eval { finish_tunnel($self, $self->{tunnel}); };
if (my $err = $@) {
$self->log('err', $err);
$self->{errors} = 1;
}
}
# always deactivate volumes - avoid lvm LVs to be active on several nodes # always deactivate volumes - avoid lvm LVs to be active on several nodes
eval { eval {
my $vollist = PVE::QemuServer::get_vm_volumes($conf); my $vollist = PVE::QemuServer::get_vm_volumes($conf);

View File

@ -1,3 +1,9 @@
qemu-server (2.0-15) unstable; urgency=low
* online migration fix: close tunnel later, wait for connection close
-- Proxmox Support Team <support@proxmox.com> Tue, 17 Jan 2012 11:24:56 +0100
qemu-server (2.0-14) unstable; urgency=low qemu-server (2.0-14) unstable; urgency=low
* use 'da' instead of 'dk' for Danish keyboard (qemu use that name) * use 'da' instead of 'dk' for Danish keyboard (qemu use that name)