There are some (mostly ISP-specific) name servers who will redirect non-existing domains to special hosts. In this case, we will get a different error message when trying to connect to such a host, which breaks test 162.
162 needed this specific error message so it can confirm that qemu was indeed trying to connect to the user-specified port. However, we can also confirm this by setting up a local NBD server on exactly that port; so we can fix the issue by doing just that. Reported-by: Stefan Hajnoczi <stefa...@redhat.com> Signed-off-by: Max Reitz <mre...@redhat.com> --- tests/qemu-iotests/162 | 10 ++++++---- tests/qemu-iotests/162.out | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/qemu-iotests/162 b/tests/qemu-iotests/162 index 0b43ea3..e38e99a 100755 --- a/tests/qemu-iotests/162 +++ b/tests/qemu-iotests/162 @@ -43,10 +43,12 @@ echo '=== NBD ===' $QEMU_IMG info 'json:{"driver": "nbd", "host": 42}' # And this should not treat @port as if it had not been specified -# (We cannot use localhost with an invalid port here, but we need to use a -# non-existing domain, because otherwise the error message will not contain -# the port) -$QEMU_IMG info 'json:{"driver": "nbd", "host": "does.not.exist.example.com", "port": 42}' +# (We need to set up a server here, because the error message for "Connection +# refused" does not contain the destination port) +$QEMU_NBD -p 42424 -f raw null-co:// & +sleep 0.5 +$QEMU_IMG info 'json:{"driver": "nbd", "host": "localhost", "port": 42424}' \ + | grep '^image' # This is a test for NBD's bdrv_refresh_filename() implementation: It expects # either host or path to be set, but it must not assume that they are set to diff --git a/tests/qemu-iotests/162.out b/tests/qemu-iotests/162.out index 9bba723..0654e3d 100644 --- a/tests/qemu-iotests/162.out +++ b/tests/qemu-iotests/162.out @@ -2,7 +2,7 @@ QA output created by 162 === NBD === qemu-img: Could not open 'json:{"driver": "nbd", "host": 42}': Failed to connect socket: Invalid argument -qemu-img: Could not open 'json:{"driver": "nbd", "host": "does.not.exist.example.com", "port": 42}': address resolution failed for does.not.exist.example.com:42: Name or service not known +image: nbd://localhost:42424 image: nbd+unix://?socket=42 === SSH === -- 2.9.2