[pve-devel] [PATCH qemu-server 2/4] drive-mirror: warn use POSIX::_exit on exec failure

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Jan 5 10:09:27 CET 2017


---
 PVE/QemuServer.pm | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 0b866cd..31e30fa 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5926,17 +5926,16 @@ sub qemu_drive_mirror {
 	    die "forking socat tunnel failed";
 	} elsif ($pid == 0) {
 	    exec(@$cmd);
-	    exit(-1);
-	} else {
-	    $jobs->{"drive-$drive"}->{pid} = $pid;
+	    warn "exec failed: $!\n";
+	    POSIX::_exit(-1);
+	}
+	$jobs->{"drive-$drive"}->{pid} = $pid;
 
-	    my $timeout = 0;
-	    while (1) {
-		last if -S $unixsocket; 
-		die if $timeout > 5;
-		$timeout++;
-		sleep 1;
-	    }
+	my $timeout = 0;
+	while (!-S $unixsocket) {
+	    die "nbd connection helper timed out\n"
+		if $timeout++ > 5;
+	    sleep 1;
 	}
     } else {
 	my $storecfg = PVE::Storage::config();
-- 
2.1.4





More information about the pve-devel mailing list