mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
nbd: Minimal structured read for client
Minimal implementation: for structured error only error_report error message. Note that test 83 is now more verbose, because the implementation prints more warnings about unexpected communication errors; perhaps future patches should tone things down by using trace messages instead of traces, but the common case of successful communication is no noisier than before. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20171027104037.8319-13-eblake@redhat.com>
This commit is contained in:
committed by
Eric Blake
parent
56dc682bf5
commit
f140e30003
12
nbd/client.c
12
nbd/client.c
@@ -602,9 +602,11 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name,
|
||||
uint64_t magic;
|
||||
int rc;
|
||||
bool zeroes = true;
|
||||
bool structured_reply = info->structured_reply;
|
||||
|
||||
trace_nbd_receive_negotiate(tlscreds, hostname ? hostname : "<null>");
|
||||
|
||||
info->structured_reply = false;
|
||||
rc = -EINVAL;
|
||||
|
||||
if (outioc) {
|
||||
@@ -685,6 +687,16 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name,
|
||||
if (fixedNewStyle) {
|
||||
int result;
|
||||
|
||||
if (structured_reply) {
|
||||
result = nbd_request_simple_option(ioc,
|
||||
NBD_OPT_STRUCTURED_REPLY,
|
||||
errp);
|
||||
if (result < 0) {
|
||||
goto fail;
|
||||
}
|
||||
info->structured_reply = result == 1;
|
||||
}
|
||||
|
||||
/* Try NBD_OPT_GO first - if it works, we are done (it
|
||||
* also gives us a good message if the server requires
|
||||
* TLS). If it is not available, fall back to
|
||||
|
||||
Reference in New Issue
Block a user