From 3858eeb5171c0d6824c424e03a523e5686a98dfd Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 18 Jan 2014 14:20:43 +0000 Subject: [PATCH] tests/nbd: Move wait for qemu-nbd to start up earlier. tests/nbd/test-nbd.pl contains a hack (a call to sleep) to wait for qemu-nbd to start up in another process. This sleep was previously located before the call to $g->launch() since that is where (previous to commit 4a0f5ed382) the backend would have connected to the NBD server. However in the new code, an initial NBD connection test is done when the drive is added (ie. $g->add_drive (..., protocol=>"nbd")), which duly failed intermittently because the qemu-nbd server had not opened its socket yet. Move the wait earlier -- just after the fork -- to avoid this. This updates commit 4a0f5ed38233393e75ea69ff0595936aed0e8abb. --- tests/nbd/test-nbd.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/nbd/test-nbd.pl b/tests/nbd/test-nbd.pl index 1c8e0b2ef..c7361fd0a 100755 --- a/tests/nbd/test-nbd.pl +++ b/tests/nbd/test-nbd.pl @@ -74,17 +74,17 @@ sub run_test { die "qemu-nbd: $!"; } + # XXX qemu-nbd lacks any way to tell if it is awake and listening + # for connections. It could write a pid file or something. Could + # we check that the socket has been opened by looking in netstat? + sleep (2); + my $g = Sys::Guestfs->new (); # Add an NBD drive. $g->add_drive ("", readonly => $readonly, format => "raw", protocol => "nbd", server => [$server]); - # XXX qemu-nbd lacks any way to tell if it is awake and listening - # for connections. It could write a pid file or something. Could - # we check that the socket has been opened by looking in netstat? - sleep (2); - # This dies if qemu cannot connect to the NBD server. $g->launch ();