On Tue, Jun 25, 2019 at 02:58:34PM +0200, Martin Kletzander wrote:
Here are few things I found out when using libnbd that might be
perfectly fine
or maybe just an oversight, but I wanted to point them out. It's nothing major.
When running a program with `nbdkit -U - --run ...`, the $nbd parameter gets
expanded to nbd:unix:/path/to/socket. When this string is passed to
nbd_connect_uri(), it does not return an error (even though it is not a valid
URL), but what's more it treats it as "nbd://localhost", which might be a
completely different server (that actually happened to me and it was kind of confusing).
There's a bit of magic in nbdkit about $nbd. It also predates our
standardization effort for NBD URLs which is going on upstream.
That needs to be fixed, but in the meantime just use $unixsocket
instead (see nbdkit-captive(1) man page for the full details).
When nbd_block_status() callback returns -1, the nbd_block_status()
function
reports:
command failed: Protocol error (errno = 71)
which is a bit confusing to me. I could be nicer to have that report that it
really was the callback that caused this.
Not sure about this one - Eric?
One last thing is that I could not find any definition for the flags
of "base:allocation" metadata (NBD_STATE_HOLE and NBD_STATE_ZERO).
It might just be things that are still missing due to an early stage
of libnbd, or it might not belong there or it might be me misusing
something.
Have a look at the NBD protocol doc:
https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/