From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [RFC PATCH 02/13] migration: Normalize tls arguments
Date: Mon, 14 Apr 2025 17:30:25 +0100 [thread overview]
Message-ID: <Z_04IURkXQhVsP47@redhat.com> (raw)
In-Reply-To: <20250411191443.22565-3-farosas@suse.de>
On Fri, Apr 11, 2025 at 04:14:32PM -0300, Fabiano Rosas wrote:
> The tls_creds, tls_authz and tls_hostname arguments are strings that
> can be set by the user. They are allowed to be either a valid string,
> an empty string or NULL. The values "" and NULL are effectively
> treated the same by the code, but this is not entirely clear because
> the handling is not uniform.
>
> Make the 3 variables be handled the same and at the same place in
> options.c. Note that this affects only the internal usage of the
> variables.
>
> (migrate_tls() had to be moved to be able to use migrate_tls_creds())
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> migration/options.c | 81 ++++++++++++++++++++++++---------------------
> migration/tls.c | 2 +-
> 2 files changed, 44 insertions(+), 39 deletions(-)
>
> diff --git a/migration/options.c b/migration/options.c
> index cb8eec218f..7cd465ca94 100644
> --- a/migration/options.c
> +++ b/migration/options.c
> @@ -1184,18 +1200,27 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
> }
>
> if (params->tls_creds) {
> - assert(params->tls_creds->type == QTYPE_QSTRING);
> - dest->tls_creds = params->tls_creds->u.s;
> + if (params->tls_creds->type == QTYPE_QNULL) {
> + dest->tls_creds = NULL;
> + } else {
> + dest->tls_creds = params->tls_creds->u.s;
> + }
Feels like it is still worth having the assert(QTYPE_QSTRING)
in the else branch before we blindly reference the string pointer
> }
>
> if (params->tls_hostname) {
> - assert(params->tls_hostname->type == QTYPE_QSTRING);
> - dest->tls_hostname = params->tls_hostname->u.s;
> + if (params->tls_hostname->type == QTYPE_QNULL) {
> + dest->tls_hostname = NULL;
> + } else {
> + dest->tls_hostname = params->tls_hostname->u.s;
> + }
> }
>
> if (params->tls_authz) {
> - assert(params->tls_authz->type == QTYPE_QSTRING);
> - dest->tls_authz = params->tls_authz->u.s;
> + if (params->tls_authz->type == QTYPE_QNULL) {
> + dest->tls_authz = NULL;
> + } else {
> + dest->tls_authz = params->tls_authz->u.s;
> + }
> }
>
> if (params->has_max_bandwidth) {
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-04-14 16:31 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 19:14 [RFC PATCH 00/13] migration: Unify capabilities and parameters Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 01/13] migration: Fix latent bug in migrate_params_test_apply() Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 02/13] migration: Normalize tls arguments Fabiano Rosas
2025-04-14 16:30 ` Daniel P. Berrangé [this message]
2025-04-11 19:14 ` [RFC PATCH 03/13] migration: Run a post update routine after setting parameters Fabiano Rosas
2025-05-15 20:42 ` Peter Xu
2025-04-11 19:14 ` [RFC PATCH 04/13] migration: Fix parameter validation Fabiano Rosas
2025-05-15 20:59 ` Peter Xu
2025-05-22 16:39 ` Fabiano Rosas
2025-05-22 17:39 ` Fabiano Rosas
2025-05-26 13:09 ` Peter Xu
2025-05-26 15:41 ` Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 05/13] migration: Reduce a bit of duplication in migration.json Fabiano Rosas
2025-04-14 16:38 ` Daniel P. Berrangé
2025-04-14 17:02 ` Fabiano Rosas
2025-04-16 13:38 ` Markus Armbruster
2025-04-16 14:41 ` Fabiano Rosas
2025-04-17 5:56 ` Markus Armbruster
2025-04-17 18:45 ` Markus Armbruster
2025-04-18 6:40 ` Markus Armbruster
2025-04-11 19:14 ` [RFC PATCH 06/13] migration: Remove the parameters copy during validation Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 07/13] migration: Introduce new MigrationConfig structure Fabiano Rosas
2025-04-18 7:03 ` Markus Armbruster
2025-05-23 13:38 ` Fabiano Rosas
2025-05-26 7:37 ` Markus Armbruster
2025-04-11 19:14 ` [RFC PATCH 08/13] migration: Replace s->parameters with s->config Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 09/13] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 10/13] migration: Replace s->capabilities with s->config Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 11/13] migration: Merge parameters and capability checks Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 12/13] [PoC] migration: Add query/set commands for MigrationConfig Fabiano Rosas
2025-05-26 7:51 ` Markus Armbruster
2025-05-27 22:14 ` Fabiano Rosas
2025-04-11 19:14 ` [RFC PATCH 13/13] [PoC] migration: Allow migrate commands to provide the migration config Fabiano Rosas
2025-05-26 8:03 ` Markus Armbruster
2025-05-26 15:10 ` Peter Xu
2025-04-14 16:44 ` [RFC PATCH 00/13] migration: Unify capabilities and parameters Daniel P. Berrangé
2025-04-14 17:12 ` Fabiano Rosas
2025-04-14 17:20 ` Daniel P. Berrangé
2025-04-14 17:40 ` Fabiano Rosas
2025-04-14 19:06 ` Daniel P. Berrangé
2025-05-15 20:21 ` Peter Xu
2025-04-16 13:44 ` Markus Armbruster
2025-04-16 15:00 ` Fabiano Rosas
2025-04-24 9:35 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z_04IURkXQhVsP47@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=farosas@suse.de \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.