]> git.proxmox.com Git - pve-storage.git/commitdiff
storage_migrate: also log with an insecure connection if there is a log function
authorFabian Ebner <f.ebner@proxmox.com>
Wed, 29 Jan 2020 13:30:02 +0000 (14:30 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 5 Feb 2020 07:50:14 +0000 (08:50 +0100)
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/Storage.pm

index 5fefa066c4c2ace406c631f835bab40fc75a0d29..2b292f6d395423bfc3e7306ba9a57a174c6c6597 100755 (executable)
@@ -626,11 +626,21 @@ sub storage_migrate {
                or die "failed to connect to tunnel at $ip:$port\n";
            # we won't be reading from the socket
            shutdown($socket, 0);
-           run_command([$send, @cstream], output => '>&'.fileno($socket));
+           run_command([$send, @cstream], output => '>&'.fileno($socket), logfunc => $logfunc);
            # don't close the connection entirely otherwise the receiving end
            # might not get all buffered data (and fails with 'connection reset by peer')
            shutdown($socket, 1);
-           1 while <$info>; # wait for the remote process to finish
+
+           # wait for the remote process to finish
+           if ($logfunc) {
+               while (my $line = <$info>) {
+                   chomp($line);
+                   $logfunc->("[$target_sshinfo->{name}] $line");
+               }
+           } else {
+               1 while <$info>;
+           }
+
            # now close the socket
            close($socket);
            if (!close($info)) { # does waitpid()