[Libguestfs] [PATCH libnbd 1/2] interop: Use systemd socket activation with qemu-nbd.
Richard W.M. Jones
rjones at redhat.com
Tue Oct 1 16:15:47 UTC 2019
Now that we have implemented systemd socket activation we can use this
as a way to test qemu-nbd instead of having to use a TCP port.
---
interop/Makefile.am | 12 ++++++------
interop/interop.c | 8 +++++++-
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/interop/Makefile.am b/interop/Makefile.am
index d30cdf1..345be7c 100644
--- a/interop/Makefile.am
+++ b/interop/Makefile.am
@@ -85,9 +85,9 @@ endif
interop_qemu_nbd_SOURCES = interop.c
interop_qemu_nbd_CPPFLAGS = \
-I$(top_srcdir)/include \
- -DSERVE_OVER_TCP=1 \
+ -DSOCKET_ACTIVATION=1 \
-DSERVER=\"$(QEMU_NBD)\" \
- -DSERVER_PARAMS='"-f", "raw", "-x", "/", "-p", port_str, tmpfile' \
+ -DSERVER_PARAMS='"-f", "raw", "-x", "/", tmpfile' \
-DEXPORT_NAME='"/"' \
$(NULL)
interop_qemu_nbd_CFLAGS = $(WARNINGS_CFLAGS)
@@ -97,9 +97,9 @@ interop_qemu_nbd_LDADD = $(top_builddir)/lib/libnbd.la
interop_qemu_nbd_tls_certs_SOURCES = interop.c
interop_qemu_nbd_tls_certs_CPPFLAGS = \
-I$(top_srcdir)/include \
- -DSERVE_OVER_TCP=1 \
+ -DSOCKET_ACTIVATION=1 \
-DSERVER=\"$(QEMU_NBD)\" \
- -DSERVER_PARAMS='"--object", "tls-creds-x509,id=tls0,endpoint=server,dir=$(abs_top_builddir)/tests/pki", "--tls-creds", "tls0", "-f", "raw", "-x", "/", "-p", port_str, tmpfile' \
+ -DSERVER_PARAMS='"--object", "tls-creds-x509,id=tls0,endpoint=server,dir=$(abs_top_builddir)/tests/pki", "--tls-creds", "tls0", "-f", "raw", "-x", "/", tmpfile' \
-DEXPORT_NAME='"/"' \
-DCERTS=1 \
-DTLS_MODE=LIBNBD_TLS_REQUIRE \
@@ -111,9 +111,9 @@ interop_qemu_nbd_tls_certs_LDADD = $(top_builddir)/lib/libnbd.la
interop_qemu_nbd_tls_psk_SOURCES = interop.c
interop_qemu_nbd_tls_psk_CPPFLAGS = \
-I$(top_srcdir)/include \
- -DSERVE_OVER_TCP=1 \
+ -DSOCKET_ACTIVATION=1 \
-DSERVER=\"$(QEMU_NBD)\" \
- -DSERVER_PARAMS='"--object", "tls-creds-psk,id=tls0,endpoint=server,dir=$(abs_top_builddir)/tests", "--tls-creds", "tls0", "-f", "raw", "-x", "/", "-p", port_str, tmpfile' \
+ -DSERVER_PARAMS='"--object", "tls-creds-psk,id=tls0,endpoint=server,dir=$(abs_top_builddir)/tests", "--tls-creds", "tls0", "-f", "raw", "-x", "/", tmpfile' \
-DEXPORT_NAME='"/"' \
-DPSK=1 \
-DTLS_MODE=LIBNBD_TLS_REQUIRE \
diff --git a/interop/interop.c b/interop/interop.c
index 7ba0d0e..28b53d1 100644
--- a/interop/interop.c
+++ b/interop/interop.c
@@ -139,7 +139,13 @@ main (int argc, char *argv[])
#else /* !SERVE_OVER_TCP */
char *args[] = { SERVER, SERVER_PARAMS, NULL };
- if (nbd_connect_command (nbd, args) == -1) {
+ if (
+#if SOCKET_ACTIVATION
+ nbd_connect_socket_activation (nbd, args)
+#else
+ nbd_connect_command (nbd, args)
+#endif
+ == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
goto out;
}
--
2.23.0
More information about the Libguestfs
mailing list