mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
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 commit4a0f5ed382) 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 commit4a0f5ed382.
This commit is contained in:
@@ -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 ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user