On 04/05/2016 06:37 AM, Alex Bligh wrote: > proto.md is unclear on what export is selected when you use NBD_OPT_GO. I take it > that the selected export is the one previously selected using NBD_OPT_SELECT. Correct. It also says that using NBD_OPT_STARTTLS (whether successful or failed) or another NBD_OPT_SELECT (if failed) wipes out the current selection. > If that's the case, it should say that, and it should also say that > NBD_OPT_GO MUST NOT be used until NBD_OPT_SELECT has been used. It _does_ say that: the server MUST issue NBD_REP_ERR_INVALID if there is no recent active NBD_OPT_SELECT not wiped out by another action. > > But this got me thinking. Given the option has a length (which by default would > be zero), why not allow NBD_OPT_GO (optionally) to carry an export name itself? > Then it could be used instead of NBD_OPT_EXPORT_NAME completely. We could > (eventually) deprecate NBD_OPT_EXPORT_NAME. IE if no name is specified, use > the one from the last NBD_OPT_SELECT, but if one was specified, use that. > > WDYT? Not sure it is worth it. The REAL reason for making SELECT is so that we can probe whether an export needs TLS, as well as report errors if it is not present, without having to close the connection. NBD_OPT_GO _already_ takes the place of NBD_OPT_EXPORT_NAME. You transfer from handshake to transmission phase by either NBD_OPT_EXPORT_NAME (which cannot fail other than closing the connection), or by successful NBD_OPT_GO (which can only succeed if you previously used NBD_OPT_SELECT). Or are you proposing that you could use either NBD_OPT_SELECT followed by NBD_OPT_GO (no name), OR use NBD_OPT_GO+name (no NBD_OPT_SELECT), both as new ways to exit the handshake phase while still keeping the door open for error reporting? Okay, then in that case, it would allow one less back-and-forth between client and server if NBD_OPT_GO can include an optional name. But how does it play with the special case of "" as the name of the default export? NBD_OPT_SELECT can gracefully handle the empty name as selecting the default export, but NBD_OPT_GO would be ambiguous as to whether you are using it without a name option, or if you are using the optional name option to explicitly select the default export. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature