• Max Reitz's avatar
    nbd: Fix filename generation · ec0de768
    Max Reitz authored
    Export names may be used with nbd+unix, too, fix nbd_refresh_filename()
    accordingly. Also, for nbd+tcp, the documented path schema is
    "nbd://host[:port]/export", so use it. Furthermore, as can be seen from
    that schema, the port is optional.
    That makes six single cases for how the filename can be formatted; it is
    not easy to generalize these cases without the resulting statement being
    completely unreadable, thus there is simply one snprintf() per case.
    Finally, taking the options from BDRVNBDState::socket_opts is wrong,
    because those will not contain the export name. Just use
    BlockDriverState::options instead.
    Reported-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
nbd.c 13.3 KB