qemu-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]