From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
"open list:Block layer core" <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PULL 03/11] qemu-iotests: improve nbd-fault-injector.py startup protocol
Date: Wed, 30 Aug 2017 13:07:03 -0500 [thread overview]
Message-ID: <20170830180711.7974-4-eblake@redhat.com> (raw)
In-Reply-To: <20170830180711.7974-1-eblake@redhat.com>
From: Stefan Hajnoczi <stefanha@redhat.com>
Currently 083 waits for the nbd-fault-injector.py server to start up by
looping until netstat shows the TCP listen socket.
The startup protocol can be simplified by passing a 0 port number to
nbd-fault-injector.py. The kernel will allocate a port in bind(2) and
the final port number can be printed by nbd-fault-injector.py.
This should make it slightly nicer and less TCP-specific to wait for
server startup. This patch changes nbd-fault-injector.py, the next one
will rewrite server startup in 083.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20170829122745.14309-3-stefanha@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
tests/qemu-iotests/nbd-fault-injector.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py
index 6c07191a5a..1c10dcb51c 100755
--- a/tests/qemu-iotests/nbd-fault-injector.py
+++ b/tests/qemu-iotests/nbd-fault-injector.py
@@ -235,11 +235,15 @@ def open_socket(path):
sock = socket.socket()
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind((host, int(port)))
+
+ # If given port was 0 the final port number is now available
+ path = '%s:%d' % sock.getsockname()
else:
sock = socket.socket(socket.AF_UNIX)
sock.bind(path)
sock.listen(0)
print 'Listening on %s' % path
+ sys.stdout.flush() # another process may be waiting, show message now
return sock
def usage(args):
--
2.13.5
next prev parent reply other threads:[~2017-08-30 18:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-30 18:07 [Qemu-devel] [PULL 00/11] NBD patches for 2.11 Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 01/11] qemu-iotests: Extend non-shared storage migration test (194) Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 02/11] nbd-client: avoid read_reply_co entry if send failed Eric Blake
2017-08-30 18:07 ` Eric Blake [this message]
2017-08-30 18:07 ` [Qemu-devel] [PULL 04/11] qemu-iotests: test NBD over UNIX domain sockets in 083 Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 05/11] nbd/client: fix nbd_opt_go Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 06/11] nbd/client: refactor nbd_read_eof Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 07/11] nbd/client: refactor nbd_receive_reply Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 08/11] nbd/client: fix nbd_send_request to return int Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 09/11] block/nbd-client: get rid of ssize_t Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 10/11] block/nbd-client: rename nbd_recv_coroutines_enter_all Eric Blake
2017-08-30 18:07 ` [Qemu-devel] [PULL 11/11] block/nbd-client: refactor request send/receive Eric Blake
2017-08-31 14:51 ` [Qemu-devel] [PULL 00/11] NBD patches for 2.11 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170830180711.7974-4-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).