From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>
Cc: "kwolf@redhat.com" <kwolf@redhat.com>,
Denis Lunev <den@virtuozzo.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"stefanha@redhat.com" <stefanha@redhat.com>,
"mreitz@redhat.com" <mreitz@redhat.com>
Subject: Re: [PATCH v9 3/3] iotests: test nbd reconnect
Date: Fri, 4 Oct 2019 13:05:24 -0500 [thread overview]
Message-ID: <7854fa11-5c2d-4b88-16f8-2bbb2679efa2@redhat.com> (raw)
In-Reply-To: <88a7e9c9-caf2-b114-93c4-7c99036c9b33@virtuozzo.com>
On 9/24/19 3:31 AM, Vladimir Sementsov-Ogievskiy wrote:
>>> +def qemu_nbd_popen(*args):
>>> + '''Run qemu-nbd in daemon mode and return the parent's exit code'''
>>> + return subprocess.Popen(qemu_nbd_args + ['--persistent'] + list(args))
>>> +
>>
>> Should you also use a pid file here, and wait for the existence of the
>> pid file before returning (rather than hard-coding sleep(1))?
>
> What do you mean / how to do it?
>
> We want to wait until listening socket is prepared..
In shell:
qemu-nbd --pid-file=/path/to/file ...
while [ ! -e /path/to/file ]; do
sleep ... # fractional second, or exponential, or whatever...
done
# Now the listening socket is indeed prepared
You'd have to translate that idiom to python.
Or:
pre-open Unix socket at /path/to/socket
LISTEN_PID=... LISTEN_FDS=1 qemu-nbd ... 3<>/path/to/socket
Now the socket is pre-created and passed into qemu-nbd via systemd
socket activation, so you know the listening socket is ready without
having to do any loop at all. Here's a patch in libnbd where we just
switched from waiting for the port to appear (because the test predated
qemu-nbd pidfile support) to instead using socket activation, for reference:
https://github.com/libguestfs/libnbd/commit/352331d177
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2019-10-04 18:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 17:13 [Qemu-devel] [PATCH v9 0/3] NBD reconnect Vladimir Sementsov-Ogievskiy
2019-09-17 17:13 ` [Qemu-devel] [PATCH v9 1/3] qemu-coroutine-sleep: introduce qemu_co_sleep_wake Vladimir Sementsov-Ogievskiy
2019-09-23 14:53 ` Eric Blake
2019-09-17 17:13 ` [Qemu-devel] [PATCH v9 2/3] block/nbd: nbd reconnect Vladimir Sementsov-Ogievskiy
2019-09-23 19:23 ` Eric Blake
2019-09-24 8:05 ` Vladimir Sementsov-Ogievskiy
2019-10-04 17:29 ` Vladimir Sementsov-Ogievskiy
2019-09-17 17:13 ` [Qemu-devel] [PATCH v9 3/3] iotests: test " Vladimir Sementsov-Ogievskiy
2019-09-23 19:51 ` Eric Blake
2019-09-24 8:31 ` Vladimir Sementsov-Ogievskiy
2019-10-04 18:05 ` Eric Blake [this message]
2019-10-07 10:48 ` Vladimir Sementsov-Ogievskiy
2019-10-07 20:03 ` Eric Blake
2019-09-24 9:27 ` [PATCH v9 4/3] " Vladimir Sementsov-Ogievskiy
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=7854fa11-5c2d-4b88-16f8-2bbb2679efa2@redhat.com \
--to=eblake@redhat.com \
--cc=den@virtuozzo.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.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).