• D
    nbd: always query export list in fixed new style protocol · 9344e5f5
    Daniel P. Berrange 提交于
    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: NDaniel P. Berrange <berrange@redhat.com>
    Message-Id: <1455129674-17255-12-git-send-email-berrange@redhat.com>
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    9344e5f5
143.out 280 字节