iotests: Bind qemu-nbd to localhost in 147
authorMax Reitz <mreitz@redhat.com>
Fri, 21 Dec 2018 23:47:49 +0000 (00:47 +0100)
committerMax Reitz <mreitz@redhat.com>
Wed, 30 Jan 2019 23:44:49 +0000 (00:44 +0100)
commitdfadac9a37a7d1e8e891f347f77702f97856c227
tree775833ce6cfc5d29ef6449a6d210cdfffcea3d8e
parente1e6eccd497683b5c2fc2a4219f7737e875fb6b3
iotests: Bind qemu-nbd to localhost in 147

By default, qemu-nbd binds to 0.0.0.0.  However, we then proceed to
connect to "localhost".  Usually, this works out fine; but if this test
is run concurrently, some other test function may have bound a different
server to ::1 (on the same port -- you can bind different serves to the
same port, as long as one is on IPv4 and the other on IPv6).

So running qemu-nbd works, it can bind to 0.0.0.0:NBD_PORT.  But
potentially a concurrent test has successfully taken [::1]:NBD_PORT.  In
this case, trying to connect to "localhost" will lead us to the IPv6
instance, where we do not want to end up.

Fix this by just binding to "localhost".  This will make qemu-nbd error
out immediately and not give us cryptic errors later.

(Also, it will allow us to just try a different port as of a future
patch.)

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20181221234750.23577-3-mreitz@redhat.com
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
tests/qemu-iotests/147