[Qemu-devel] [PATCH 0/5] iotests: Let 233 run concurrently

Max Reitz posted 5 patches 4 years, 12 months ago
Test asan passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190507183610.9848-1-mreitz@redhat.com
Maintainers: Eric Blake <eblake@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
There is a newer version of this series
qemu-nbd.c                    | 32 +++++++++++-
qemu-nbd.texi                 |  2 +
tests/qemu-iotests/147        |  4 +-
tests/qemu-iotests/233        |  1 -
tests/qemu-iotests/common.nbd | 93 ++++++++++++++++-------------------
tests/qemu-iotests/common.rc  |  4 +-
tests/qemu-iotests/iotests.py |  9 ++--
7 files changed, 85 insertions(+), 60 deletions(-)
[Qemu-devel] [PATCH 0/5] iotests: Let 233 run concurrently
Posted by Max Reitz 4 years, 12 months ago
Currently, 233 cannot reliably run concurrently to other NBD TCP tests.
When it starts, it looks for a free port and then attempts to use that
for the whole duration of the test run.  This is a TOCTTOU race
condition: It does not reserve that port, so another NBD TCP test that
runs in parallel can grab it.

To fix this, we must not use the same port all the time, but always
choose a new one when qemu-nbd is started.  We cannot check whether it
is free, but must let qemu-nbd do so and take it atomically.  We can
achieve this by using the existing --fork option.

There are two problems with --fork, however.  First, it does not give us
a chance to reliably get the server’s PID, which we need.  We can change
that by letting qemu-nbd (optionally) write a PID file, though.  (Which
makes sense if we have a daemon mode.)

Second, it currently discards all output after the server has been
started.  That looks like an accident to me, because we clearly try to
restore the old stderr channel after having redirected all startup
messages to the parent process.  If it is a bug, we can fix it.


Max Reitz (5):
  qemu-nbd: Add --pid-file option
  iotests.py: Add qemu_nbd_early_pipe()
  qemu-nbd: Do not close stderr
  iotests: Use qemu-nbd's --pid-file
  iotests: Let 233 run concurrently

 qemu-nbd.c                    | 32 +++++++++++-
 qemu-nbd.texi                 |  2 +
 tests/qemu-iotests/147        |  4 +-
 tests/qemu-iotests/233        |  1 -
 tests/qemu-iotests/common.nbd | 93 ++++++++++++++++-------------------
 tests/qemu-iotests/common.rc  |  4 +-
 tests/qemu-iotests/iotests.py |  9 ++--
 7 files changed, 85 insertions(+), 60 deletions(-)

-- 
2.20.1