[Libguestfs] [nbdkit PATCH] nbd: Add new nbd forwarding plugin
Eric Blake
eblake at redhat.com
Sun Nov 12 03:26:04 UTC 2017
On 11/11/2017 08:33 PM, Eric Blake wrote:
> This is a minimal implementation of an NBD forwarder; it lets us
> convert between old and newstyle connections (great if a client
> expects one style but the real server only provides the other),
> or add TLS safety on top of a server without having to rewrite
> that server. Right now, the real server is expected to live
> on a named Unix socket, and the transactions are serialized
> rather than interleaved; further enhancements could be made to
> also permit TCP servers or more efficient transmission.
>
> I also envision the possibility of enhancing our testsuite to
> use NBD forwarding as a great test of our server.
>
> Signed-off-by: Eric Blake <eblake at redhat.com>
>
> +
> +/* Free up the per-connection handle. */
> +static void
> +nbd_close (void *handle)
> +{
> + struct handle *h = handle;
> +
> + close (h->fd);
> + free (h);
> +}
Oh, I just realized: prior to dropping the socket, this should do:
if (!h->dead)
nbd_request (h, NBD_CMD_DISC, 0, 0, &cookie);
to let the real server get a cleaner shutdown.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171111/973eeb1d/attachment.sig>
More information about the Libguestfs
mailing list