Skip to content

Commit

Permalink
Merge tag 'pull-request-2024-05-14' of https://gitlab.com/thuth/qemu
Browse files Browse the repository at this point in the history
…into staging

* Fix the "tsan-build" CI job on the shared gitlab CI runners
* Bump minimum glib version and use URI code from the newer glib
* Fix error message from "configure" when C compiler is not working

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmZDXcYRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbVPJw//bK/NuMKOHlnwgowkQ/x41t8nc0jAR38+
# aMhJBTSB+9EOlPd+/y7+IeFlD9lS2JzoX/CWeBrNlKc6juWQahABJYcvscmdGiYr
# a/dUy9iZoqJyY220TMjCWYwORRtNqPDXaiUIR8hBZZBmW51xs1hRc3aazxPm6dOD
# cj1yFKwWGY5g72SkRNTMWi3qWX1tXNOh7sbuhWKkZ3eiRCllHb0RwrhA341ze4TI
# ckmlSA6stMjls4XNAIAKVdRKLPE1BsJ/UKxpnOEO3F640cbe69B0+z13wIBNfTOY
# Mk3zSjrdLY6thSY+2iOb2FLt3wC5QCBjyRluv+0kwdSnz6xsafEDWNx5VneZH+Iu
# ZQWLGvN4qUUBBqHKY8eWnrsij3ABXioHLK8eHj2JuHidcG15tku/1cwAJvy/8P/O
# iup0elZ3MXaAk6ce3dwYY4t6QecuzqX9cdJkTuRNlzysK1xKQdBiYTdeZikfUAoM
# InuFUh732yPXDSiZcG+uMXUTAJXHWASr7bvPydDx/gL1tYGYBqYepfPF2uWYfNwg
# VZRgsN6WVDBGPyXv8Z7eQ9lye5JoAGYrSDxZE87q8RwRV5holiYDxtf10zeLz3Wf
# RI5L/bb2eFSHzi3quzOC1uLflLqNKwq+9UZEjdLv2z8zuhwVwxbcDV9+ox6zA8zi
# dnVC3Yp/3ik=
# =VRHz
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 14 May 2024 02:49:10 PM CEST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]

* tag 'pull-request-2024-05-14' of https://gitlab.com/thuth/qemu:
  util/uri: Remove the old URI parsing code
  block/ssh: Use URI parsing code from glib
  block/nfs: Use URI parsing code from glib
  block/nbd: Use URI parsing code from glib
  block/gluster: Use URI parsing code from glib
  Remove glib compatibility code that is not required anymore
  Bump minimum glib version to v2.66
  gitlab: use 'setarch -R' to workaround tsan bug
  gitlab: use $MAKE instead of 'make'
  dockerfiles: add 'MAKE' env variable to remaining containers
  configure: Fix error message when C compiler is not working

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed May 14, 2024
2 parents 9360070 + da79537 commit 3d48b6b
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 1,795 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.d/buildtest-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
then
pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ;
fi || exit 1;
- make -j"$JOBS"
- $MAKE -j"$JOBS"
- if test -n "$MAKE_CHECK_ARGS";
then
make -j"$JOBS" $MAKE_CHECK_ARGS ;
$MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
fi
- ccache --show-stats

Expand Down Expand Up @@ -60,7 +60,7 @@
- cd build
- find . -type f -exec touch {} +
# Avoid recompiling by hiding ninja with NINJA=":"
- make NINJA=":" $MAKE_CHECK_ARGS
- $MAKE NINJA=":" $MAKE_CHECK_ARGS

.native_test_job_template:
extends: .common_test_job_template
Expand Down
3 changes: 3 additions & 0 deletions .gitlab-ci.d/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,9 @@ tsan-build:
CONFIGURE_ARGS: --enable-tsan --cc=clang --cxx=clang++
--enable-trace-backends=ust --disable-slirp
TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
# Remove when we switch to a distro with clang >= 18
# https://github.com/google/sanitizers/issues/1716
MAKE: setarch -R make

# gcov is a GCC features
gcov:
Expand Down
69 changes: 34 additions & 35 deletions block/gluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
#include "qemu/uri.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
#include "qemu/option.h"
Expand Down Expand Up @@ -289,9 +288,9 @@ static void glfs_clear_preopened(glfs_t *fs)
}
}

static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path)
static int parse_volume_options(BlockdevOptionsGluster *gconf, const char *path)
{
char *p, *q;
const char *p, *q;

if (!path) {
return -EINVAL;
Expand Down Expand Up @@ -349,13 +348,13 @@ static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path)
static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
const char *filename)
{
g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL);
g_autoptr(GHashTable) qp = NULL;
SocketAddress *gsconf;
URI *uri;
QueryParams *qp = NULL;
bool is_unix = false;
int ret = 0;
const char *uri_scheme, *uri_query, *uri_server;
int uri_port, ret;

uri = uri_parse(filename);
if (!uri) {
return -EINVAL;
}
Expand All @@ -364,54 +363,54 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
QAPI_LIST_PREPEND(gconf->server, gsconf);

/* transport */
if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
uri_scheme = g_uri_get_scheme(uri);
if (!uri_scheme || !strcmp(uri_scheme, "gluster")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+tcp")) {
} else if (!strcmp(uri_scheme, "gluster+tcp")) {
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+unix")) {
} else if (!strcmp(uri_scheme, "gluster+unix")) {
gsconf->type = SOCKET_ADDRESS_TYPE_UNIX;
is_unix = true;
} else {
ret = -EINVAL;
goto out;
return -EINVAL;
}

ret = parse_volume_options(gconf, uri->path);
ret = parse_volume_options(gconf, g_uri_get_path(uri));
if (ret < 0) {
goto out;
return ret;
}

qp = query_params_parse(uri->query);
if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {
ret = -EINVAL;
goto out;
uri_query = g_uri_get_query(uri);
if (uri_query) {
qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL);
if (!qp) {
return -EINVAL;
}
ret = g_hash_table_size(qp);
if (ret > 1 || (is_unix && !ret) || (!is_unix && ret)) {
return -EINVAL;
}
}

uri_server = g_uri_get_host(uri);
uri_port = g_uri_get_port(uri);

if (is_unix) {
if (uri->server || uri->port) {
ret = -EINVAL;
goto out;
}
if (strcmp(qp->p[0].name, "socket")) {
ret = -EINVAL;
goto out;
char *uri_socket = g_hash_table_lookup(qp, "socket");
if (uri_server || uri_port != -1 || !uri_socket) {
return -EINVAL;
}
gsconf->u.q_unix.path = g_strdup(qp->p[0].value);
gsconf->u.q_unix.path = g_strdup(uri_socket);
} else {
gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost");
if (uri->port) {
gsconf->u.inet.port = g_strdup_printf("%d", uri->port);
gsconf->u.inet.host = g_strdup(uri_server ? uri_server : "localhost");
if (uri_port > 0) {
gsconf->u.inet.port = g_strdup_printf("%d", uri_port);
} else {
gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT);
}
}

out:
if (qp) {
query_params_free(qp);
}
uri_free(uri);
return ret;
return 0;
}

static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
Expand Down
76 changes: 37 additions & 39 deletions block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "qemu/osdep.h"

#include "trace.h"
#include "qemu/uri.h"
#include "qemu/option.h"
#include "qemu/cutils.h"
#include "qemu/main-loop.h"
Expand Down Expand Up @@ -1514,83 +1513,82 @@ static void nbd_client_close(BlockDriverState *bs)

static int nbd_parse_uri(const char *filename, QDict *options)
{
URI *uri;
g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL);
g_autoptr(GHashTable) qp = NULL;
const char *p;
QueryParams *qp = NULL;
int ret = 0;
int qp_n;
bool is_unix;
const char *uri_scheme, *uri_query, *uri_server;
int uri_port;

uri = uri_parse(filename);
if (!uri) {
return -EINVAL;
}

/* transport */
if (!g_strcmp0(uri->scheme, "nbd")) {
uri_scheme = g_uri_get_scheme(uri);
if (!g_strcmp0(uri_scheme, "nbd")) {
is_unix = false;
} else if (!g_strcmp0(uri->scheme, "nbd+tcp")) {
} else if (!g_strcmp0(uri_scheme, "nbd+tcp")) {
is_unix = false;
} else if (!g_strcmp0(uri->scheme, "nbd+unix")) {
} else if (!g_strcmp0(uri_scheme, "nbd+unix")) {
is_unix = true;
} else {
ret = -EINVAL;
goto out;
return -EINVAL;
}

p = uri->path ? uri->path : "";
p = g_uri_get_path(uri) ?: "";
if (p[0] == '/') {
p++;
}
if (p[0]) {
qdict_put_str(options, "export", p);
}

qp = query_params_parse(uri->query);
if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {
ret = -EINVAL;
goto out;
uri_query = g_uri_get_query(uri);
if (uri_query) {
qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL);
if (!qp) {
return -EINVAL;
}
qp_n = g_hash_table_size(qp);
if (qp_n > 1 || (is_unix && !qp_n) || (!is_unix && qp_n)) {
return -EINVAL;
}
}

uri_server = g_uri_get_host(uri);
if (uri_server && !uri_server[0]) {
uri_server = NULL;
}
uri_port = g_uri_get_port(uri);

if (is_unix) {
/* nbd+unix:///export?socket=path */
if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) {
ret = -EINVAL;
goto out;
const char *uri_socket = g_hash_table_lookup(qp, "socket");
if (uri_server || uri_port != -1 || !uri_socket) {
return -EINVAL;
}
qdict_put_str(options, "server.type", "unix");
qdict_put_str(options, "server.path", qp->p[0].value);
qdict_put_str(options, "server.path", uri_socket);
} else {
QString *host;
char *port_str;

/* nbd[+tcp]://host[:port]/export */
if (!uri->server) {
ret = -EINVAL;
goto out;
}

/* strip braces from literal IPv6 address */
if (uri->server[0] == '[') {
host = qstring_from_substr(uri->server, 1,
strlen(uri->server) - 1);
} else {
host = qstring_from_str(uri->server);
if (!uri_server) {
return -EINVAL;
}

qdict_put_str(options, "server.type", "inet");
qdict_put(options, "server.host", host);
qdict_put_str(options, "server.host", uri_server);

port_str = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT);
port_str = g_strdup_printf("%d", uri_port > 0 ? uri_port
: NBD_DEFAULT_PORT);
qdict_put_str(options, "server.port", port_str);
g_free(port_str);
}

out:
if (qp) {
query_params_free(qp);
}
uri_free(uri);
return ret;
return 0;
}

static bool nbd_has_filename_options_conflict(QDict *options, Error **errp)
Expand Down

0 comments on commit 3d48b6b

Please sign in to comment.