[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: FYI: Go implementation of the NBD protocol

On Tue, Nov 27, 2018 at 04:22:02PM +0100, Axel Wagner wrote:
> Hi Richard,
> no, I have only tested against nbd-{client,server} and the Linux kernel
> implementation. Compatibility simply hasn't been a huge priority for me :)
> Personally, it seems more efficient to me to have one reference
> implementation and testsuite to run against new implementations, than to
> require each new implementation to build a new testsuite for each existing
> one. For example, I don't know nbdkit at all and know very little about
> qemu. The thought of having to figure out how to run a client/server of
> each and actually observe the outcomes of a testsuite seems… dreadful.
> Whereas if you'd give me a binary that I can just point at my server and it
> gives me a list of protocol-violations, I'd be fine to fix them all.

I don't disagree but the chances of us having a reference
implementation which fully tests the protocol any time soon is slim.
In the meantime testing against lots of clients/servers is the best bet.

For reference here are the commands to test against qemu, qemu-nbd and

# Issue single read command using qemu client:

qemu-io -f raw -c 'read -v <offset> <len>' 'nbd+unix://?socket=sock'
qemu-io -f raw -c 'read -v <offset> <len>' 'nbd://localhost:10809/export'

# Write a test pattern using qemu client:

qemu-io -f raw -c 'write -P 11 <offset> <len>' 'nbd+unix://?socket=sock'
qemu-io -f raw -c 'write -P 11 <offset> <len>' 'nbd://localhost:10809/export'

# Boot a guest using qemu client:

qemu-system-x86_64 -machine accel=kvm:tcg -cpu host -m 2048 \
    -drive file=nbd:localhost:10809,format=raw,if=virtio

# Run qemu-nbd (server) on a local file on 10809/tcp:

qemu-nbd -x /export -t disk.img

# Run nbdkit (server) on a local file on 10809/tcp:

nbdkit file file=disk.img



Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.

Reply to: