When trying to connect to nbdkit with imageio nbd client, I get this error: $ rm -f /tmp/nbd.sock && nbdkit file file=/var/tmp/fedora-27.img -e export -U /tmp/nbd.sock $ python -c "import logging; logging.basicConfig(level=logging.DEBUG); from ovirt_imageio_common import nbd; c = nbd.Client('/tmp/nbd.sock', 'export')" INFO:nbd:Connecting to '/tmp/nbd.sock' 'export' DEBUG:nbd:Received server flags: 3 DEBUG:nbd:Sending client flags: 1: DEBUG:nbd:Sending option: 'IHAVEOPT\x00\x00\x00\x07\x00\x00\x00\x0c' data: bytearray(b'\x00\x00\x00\x06export\x00\x00') DEBUG:nbd:Received reply [magic=3e889045565a9 option=7 type=80000001 len=0] Traceback (most recent call last): File "<string>", line 1, in <module> File "ovirt_imageio_common/nbd.py", line 126, in __init__ self._newstyle_handshake(export_name) File "ovirt_imageio_common/nbd.py", line 181, in _newstyle_handshake self._receive_go_reply() File "ovirt_imageio_common/nbd.py", line 206, in _receive_go_reply .format(ERROR_REPLY[reply], message)) ovirt_imageio_common.nbd.Error: The option sent by the client is unknown by this server implementation [message=]) According to the NBD protocol: For backwards compatibility, clients SHOULD be prepared to also handle NBD_REP_ERR_UNSUP by falling back to using NBD_OPT_EXPORT_NAME. Should I fall back to sending NBD_OPT_EXPORT_NAME, or nbkit needs to implement NBD_OPT_GO? The client code is here: https://gerrit.ovirt.org/c/93384/ Nir
On 08/02/2018 11:51 AM, Nir Soffer wrote:> When trying to connect to nbdkit with imageio nbd client, I get this error: > > $ rm -f /tmp/nbd.sock && nbdkit file file=/var/tmp/fedora-27.img -e export > -U /tmp/nbd.sock >> ovirt_imageio_common.nbd.Error: The option sent by the client is unknown by > this server implementation [message=])Correct, nbdkit has not yet implemented this extension. (It's on my list of things to add, someday...)> > According to the NBD protocol: > > For backwards compatibility, clients SHOULD be prepared to also handle > NBD_REP_ERR_UNSUP by falling back to using NBD_OPT_EXPORT_NAME. > > Should I fall back to sending NBD_OPT_EXPORT_NAME, or nbkit needs > to implement NBD_OPT_GO?Both. You need to implement the fallback to NBD_OPT_EXPORT_NAME regardless of whether nbdkit is fixed, because there are other servers that are also not fixed, and you want to interoperate with all such servers. But nbdkit should (eventually) learn how to support NBD_OPT_GO.> > The client code is here: > https://gerrit.ovirt.org/c/93384/ > > Nir >-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
On Thu, Aug 2, 2018 at 8:18 PM Eric Blake <eblake@redhat.com> wrote:> On 08/02/2018 11:51 AM, Nir Soffer wrote: > > When trying to connect to nbdkit with imageio nbd client, I get this > error: > > > > $ rm -f /tmp/nbd.sock && nbdkit file file=/var/tmp/fedora-27.img -e > export > > -U /tmp/nbd.sock > > > > > ovirt_imageio_common.nbd.Error: The option sent by the client is unknown > by > > this server implementation [message=]) > > Correct, nbdkit has not yet implemented this extension. (It's on my > list of things to add, someday...) > > > > > According to the NBD protocol: > > > > For backwards compatibility, clients SHOULD be prepared to also > handle > > NBD_REP_ERR_UNSUP by falling back to using NBD_OPT_EXPORT_NAME. > > > > Should I fall back to sending NBD_OPT_EXPORT_NAME, or nbkit needs > > to implement NBD_OPT_GO? > > Both. You need to implement the fallback to NBD_OPT_EXPORT_NAME > regardless of whether nbdkit is fixed, because there are other servers > that are also not fixed, and you want to interoperate with all such > servers. But nbdkit should (eventually) learn how to support NBD_OPT_GO. >Thanks, I'll add this to the todo list. My goal is to support qemu-nbd and qemu for incremental backup and virt-v2v. Supporting other servers is nice to have at this point. Nir