Skip to contentSkip to conversation

nbd: Fix iotests failure due to changed client error message

PATCH In review Eric Blake 2 participants 3 messages Jul 17, 2017

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

PATCH 1/1 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); in general iotests are run on client and server from the same source code base, but if it proves problematic in practice, we'll have to tweak or sanitize the output somehow.

---
 nbd/client.c               | 5 ++---
 tests/qemu-iotests/140.out | 3 ++-
 tests/qemu-iotests/143.out | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)
nbd/client.c +2 -3
index 4c12fffcbf..509ed5e4ba 100644
@@ -232,8 +232,7 @@ static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply,
         break;
 
     case NBD_REP_ERR_UNKNOWN:
-        error_setg(errp, "Requested export not available for option %" PRIx32
-                   " (%s)", reply->option, nbd_opt_lookup(reply->option));
+        error_setg(errp, "Requested export not available");
         break;
 
     case NBD_REP_ERR_SHUTDOWN:
@@ -253,7 +252,7 @@ static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply,
     }
 
     if (msg) {
-        error_append_hint(errp, "%s\n", msg);
+        error_append_hint(errp, "server reported: %s\n", msg);
     }
 
  cleanup:
tests/qemu-iotests/140.out +2 -1
index 0689b2b41c..7295b3d975 100644
@@ -8,7 +8,8 @@ wrote 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)
 {"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": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
 *** done
tests/qemu-iotests/143.out +2 -1
index 0978b8985a..1c7fb45543 100644
@@ -1,7 +1,8 @@
 QA output created by 143
 {"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": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
 *** done
Signature · 1 line
2.13.3
Tested-by Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Eric Blake

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); in general iotests are run on client and server from the same source code base, but if it proves problematic in practice, we'll have to tweak or sanitize the output somehow.

Quoted 2 lines

Thanks, fixes it up for me.

author
#2 lore raw
Quoted 12 lines · John Snow
Quoted 9 lines · Eric Blake

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).

Quoted 3 lines
Quoted 3 lines

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); in

also depends on the server being new enough to understand NBD_OPT_GO. I'll tweak the commit message before sending the pull request

Quoted 11 lines
Quoted 6 lines

general iotests are run on client and server from the same source code base, but if it proves problematic in practice, we'll have to tweak or sanitize the output somehow.

Thanks, fixes it up for me.

Thanks; queued on my NBD branch:
git://repo.or.cz/qemu/ericb.git nbd

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org