[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/25] nbd: Add "failed to open export" error messag
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH 07/25] nbd: Add "failed to open export" error message |
Date: |
Wed, 25 Feb 2015 13:08:20 -0500 |
In case the connection is closed before the export length can be read,
and an export name had been specified, this generally indicates that for
some reason the export could not be opened (e.g. there is no export with
that name). Make the error message reflect this.
Signed-off-by: Max Reitz <address@hidden>
---
nbd.c | 6 +++++-
tests/qemu-iotests/096.out | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/nbd.c b/nbd.c
index 77d1158..ad0948b 100644
--- a/nbd.c
+++ b/nbd.c
@@ -600,7 +600,11 @@ int nbd_receive_negotiate(int csock, const char *name,
uint32_t *flags,
}
if (read_sync(csock, &s, sizeof(s)) != sizeof(s)) {
- error_setg(errp, "Failed to read export length");
+ if (name) {
+ error_setg(errp, "Failed to open export");
+ } else {
+ error_setg(errp, "Failed to read export length");
+ }
goto fail;
}
*size = be64_to_cpu(s);
diff --git a/tests/qemu-iotests/096.out b/tests/qemu-iotests/096.out
index cc10e51..80d542a 100644
--- a/tests/qemu-iotests/096.out
+++ b/tests/qemu-iotests/096.out
@@ -9,7 +9,7 @@ read 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event":
"DEVICE_TRAY_MOVED", "data": {"device": "drv", "tray-open": true}}
{"return": {}}
-qemu-io: can't open device nbd://127.0.0.1:PORT/drv: Failed to read export
length
+qemu-io: can't open device nbd://127.0.0.1:PORT/drv: Failed to open export
no file open, try 'help open'
{"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event":
"SHUTDOWN"}
--
2.1.0
- [Qemu-devel] [PATCH 03/25] nbd: Fix nbd_establish_connection()'s return value, (continued)
- [Qemu-devel] [PATCH 03/25] nbd: Fix nbd_establish_connection()'s return value, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 05/25] nbd: Avoid generic -EINVAL, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 08/25] nbd: Handle blk_getlength() failure, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 01/25] util/uri: Add overflow check to rfc3986_parse_port, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 09/25] qemu-nbd: fork() can fail, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 14/25] coroutine: Add co_yield_timeout(), Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 06/25] nbd: Pass return value from nbd_handle_list(), Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 04/25] nbd: Fix response to invalid requests, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 15/25] coroutine-io: Return -errno in case of error, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 10/25] nbd: Fix potential signed overflow issues, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 07/25] nbd: Add "failed to open export" error message,
Max Reitz <=
- [Qemu-devel] [PATCH 12/25] nbd: Set block size to BDRV_SECTOR_SIZE, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 13/25] nbd: Enforce sector alignment, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 21/25] nbd: Drop unexpected data for NBD_OPT_LIST, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 11/25] qemu-nbd: Fix and improve input verification, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 16/25] coroutine-io: Add I/O functions with timeout, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 23/25] iotests: Add test for invalid qemu-nbd parameters, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 25/25] iotests: Add test for a non-existing NBD export, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 19/25] nbd: Fix interpretation of the export flags, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 20/25] block/nbd: Comment on discard/flush silently failing, Max Reitz, 2015/02/25
- [Qemu-devel] [PATCH 22/25] iotests: Add _timeout function, Max Reitz, 2015/02/25