On Sat, Sep 09, 2023 at 02:57:49PM +0100, Richard W.M. Jones wrote:
Previously there were two places where similiar-ish logic was used
to
decide if we are going to serve over a socket activation, -s, Unix
socket, AF_VSOCK or TCP/IP. Let's abstract that into a service_mode.
One place where we did this was when calculating the $uri variable for
--run. This change adjusts and fixes this calculation (revealed as I
made the above change). In particular if --port was not set then the
$uri would contain fairly bogus values in some cases:
$ nbdkit --vsock null 1M --run 'echo $uri ; nbdinfo $uri'
nbd
nbdinfo: nbd_connect_uri: NBD URI does not have a scheme: valid NBD URIs should start
with a scheme like nbd://, nbds:// or nbd+unix://: Invalid argument
(note uri='nbd')
After this commit:
$ nbdkit --vsock null 1M --run 'echo $uri ; nbdinfo $uri'
nbd+vsock://1
protocol: newstyle-fixed without TLS, using structured packets
export="":
export-size: 1048576 (1M)
content: data
uri: nbd+vsock://1:10809/
...
Nice.
---
server/internal.h | 11 +++++++
server/captive.c | 56 ++++++++++++++++++++---------------
server/main.c | 75 ++++++++++++++++++++++++++++++-----------------
3 files changed, 91 insertions(+), 51 deletions(-)
Reviewed-by: Eric Blake <eblake(a)redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:
qemu.org |
libguestfs.org