On 7/7/20 11:26 AM, Richard W.M. Jones wrote:
On Tue, Jul 07, 2020 at 08:17:31AM -0500, Eric Blake wrote:
> With new enough libnbd, we already support vsock by virtue of uri=;
> however, it's also nice to allow direct exposure of the
> nbd_connect_vsock() api.
>
> @@ -320,7 +349,8 @@ nbdplug_after_fork (void)
> "[uri=]<URI> URI of an NBD socket to connect to (if
supported).\n" \
> "socket=<SOCKNAME> The Unix socket to connect to.\n" \
> "hostname=<HOST> The hostname for the TCP socket to connect
to.\n" \
> - "port=<PORT> TCP port or service name to use (default
10809).\n" \
> + "port=<PORT> TCP/VHOST port or service name to use (default
10809).\n" \
> + "vhost_cid=<CID> The cid for the VSOCK socket to connect
to.\n" \
> + else if (raw_cid)
> +#if !USE_VSOCK
> + abort ();
> +#else
> + r = nbd_connect_vsock (h->nbd, cid, vport);
> +#endif
> else if (command.size > 0)
> r = nbd_connect_systemd_socket_activation (h->nbd, (char **) command.ptr);
> else if (socket_fd >= 0)
I wonder if we should just call the flag "vsock=..."?
Sure, that makes sense. Doing that for nbdkit as client over vsock
matches 'nbdkit --vsock' in the other direction for offering server over
vsock.
However patch looks good, ACK.
It may be possible to add a test. See this example, especially the
line requires_linux_kernel_version.
https://github.com/libguestfs/nbdkit/blob/master/tests/test-vsock.sh
Thanks; the test will be a separate commit, but I'll play with the idea.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org