diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2016-02-10 18:41:09 +0000 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:45:29 -0600 |
commit | d7ceb0e38728e74ad1661fc02dcd91da065a3ca4 (patch) | |
tree | 007fc1b29005376c87dcfcb56254aeab6d2dc830 /nbd/server.c | |
parent | 5729e36c961795f2732dfe4b4caf017950469f9e (diff) | |
download | hqemu-d7ceb0e38728e74ad1661fc02dcd91da065a3ca4.zip hqemu-d7ceb0e38728e74ad1661fc02dcd91da065a3ca4.tar.gz |
nbd: always query export list in fixed new style protocol
With the new style protocol, the NBD client will currenetly
send NBD_OPT_EXPORT_NAME as the first (and indeed only)
option it wants. The problem is that the NBD protocol spec
does not allow for returning an error message with the
NBD_OPT_EXPORT_NAME option. So if the server mandates use
of TLS, the client will simply see an immediate connection
close after issuing NBD_OPT_EXPORT_NAME which is not user
friendly.
To improve this situation, if we have the fixed new style
protocol, we can sent NBD_OPT_LIST as the first option
to query the list of server exports. We can check for our
named export in this list and raise an error if it is not
found, instead of going ahead and sending NBD_OPT_EXPORT_NAME
with a name that we know will be rejected.
This improves the error reporting both in the case that the
server required TLS, and in the case that the client requested
export name does not exist on the server.
If the server does not support NBD_OPT_LIST, we just ignore
that and carry on with NBD_OPT_EXPORT_NAME as before.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-12-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'nbd/server.c')
-rw-r--r-- | nbd/server.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/nbd/server.c b/nbd/server.c index 074a1e6..3d2fb10 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -294,6 +294,8 @@ static int nbd_negotiate_handle_export_name(NBDClient *client, uint32_t length) } name[length] = '\0'; + TRACE("Client requested export '%s'", name); + client->exp = nbd_export_find(name); if (!client->exp) { LOG("export not found"); |