nbd: Fix iotests failure due to changed client error message

Commit 8ecaeae8 changed the way the client requests an NBD export,
and in the process also changed the resulting error message when
the export is not present, breaking a couple of iotests.  The error
message is now directly given by the server (a failed NBD_OPT_GO)
instead of implied by the client (after exhausting NBD_OPT_LIST),
but looking at the testsuite changes, it proves worthwhile to
reword the error message to be slightly less verbose (as this is
one particular error message likely to be hit by a user).

Note that the error message is now sensitive to which binary is
running the server as well as the client (since the expected
output is replaying a message received from the server - for that
matter, it depends on a server new enough to understand NBD_OPT_GO);
in general iotests are run on client and server from the same source
code base so the default setup will pass; but if it proves
problematic for people overriding QEMU_PROG, QEMU_IMG_PROG,
QEMU_IO_PROG, and QEMU_NBD_PROG to point across multiple builds for
cross-version integration testing, we may have to later tweak or
sanitize the output somehow.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170717142310.17048-1-eblake@redhat.com>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
Eric Blake 2017-07-17 09:23:10 -05:00
parent ca4e667dbf
commit 9a76bd783d
3 changed files with 6 additions and 5 deletions

View File

@ -232,8 +232,7 @@ static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply,
break; break;
case NBD_REP_ERR_UNKNOWN: case NBD_REP_ERR_UNKNOWN:
error_setg(errp, "Requested export not available for option %" PRIx32 error_setg(errp, "Requested export not available");
" (%s)", reply->option, nbd_opt_lookup(reply->option));
break; break;
case NBD_REP_ERR_SHUTDOWN: case NBD_REP_ERR_SHUTDOWN:
@ -253,7 +252,7 @@ static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply,
} }
if (msg) { if (msg) {
error_append_hint(errp, "%s\n", msg); error_append_hint(errp, "server reported: %s\n", msg);
} }
cleanup: cleanup:

View File

@ -8,7 +8,8 @@ wrote 65536/65536 bytes at offset 0
read 65536/65536 bytes at offset 0 read 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
{"return": {}} {"return": {}}
can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: No export with name 'drv' available can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: Requested export not available
server reported: export 'drv' not present
{"return": {}} {"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
*** done *** done

View File

@ -1,7 +1,8 @@
QA output created by 143 QA output created by 143
{"return": {}} {"return": {}}
{"return": {}} {"return": {}}
can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: No export with name 'no_such_export' available can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: Requested export not available
server reported: export 'no_such_export' not present
{"return": {}} {"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
*** done *** done