diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm index 7b161e36..b70bb200 100755 --- a/PVE/CLI/qm.pm +++ b/PVE/CLI/qm.pm @@ -277,7 +277,10 @@ __PACKAGE__->register_method ({ while (my $line = <>) { chomp $line; - last if $line =~ m/^quit$/; + if ($line =~ /^quit$/) { + $tunnel_write->("OK"); + last; + } } return undef; diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index a0380509..43a39119 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -123,6 +123,17 @@ sub write_tunnel { }); }; die "writing to tunnel failed: $@\n" if $@; + + if ($tunnel->{version} && $tunnel->{version} >= 1) { + my $res = eval { $self->read_tunnel($tunnel, 10); }; + die "no reply to command '$command': $@\n" if $@; + + if ($res eq 'OK') { + return; + } else { + die "tunnel replied '$res' to command '$command'\n"; + } + } } sub fork_tunnel {