From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914761; cv=none; d=zohomail.com; s=zohoarc; b=n9mgkzNlHWnXpgc5jfsNB4X47m3Ezcx8f8vln7ZkOB8IUN/grC+Ud4G/xXGJoIqEHT4LNWVcq+oPkG8ZFUZml5uj6mk4O8PgC2qyKH5Kok9aAfJJ/0/UjtW7WlagIM5AI20hFM7LSVXEkji6ELUrgRWEj+v0PSN5TqfZMrUDXKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914761; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3xwhv7kZ76ctBgvWwEJwBH34oWjsd5YnGAL8IAiI5Sc=; b=V7nfAwEagjana3/83mT1nhaqmniX70f3qBz5JUpLA0Fbtm5Sfm/Lcicz/k48Y2gKLRM6TeQzWDZj3dZuI4RwKC58Xys27i3rXdQo7hxkyXMjTcsaUvOq7ffaJGm2tNPvkG54PapjEbrbxD57udM8iFJcERzCwtnwrts4gaNO7N8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914761597685.028598272888; Mon, 2 Jun 2025 18:39:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGbe-0006Pe-ID; Mon, 02 Jun 2025 21:38:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGbd-0006PA-2F for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:21 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGba-0001Pb-Kp for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:20 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 091FD1F38D; Tue, 3 Jun 2025 01:38:17 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7A72C13700; Tue, 3 Jun 2025 01:38:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yK67DgdSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3xwhv7kZ76ctBgvWwEJwBH34oWjsd5YnGAL8IAiI5Sc=; b=XPCEvjEKJxkvQA/VjhrqOyM3Xau/9VLGXMdireGj22D389OdL+mYEHRGjBfDTmpQwwNFT5 tmtpcbhUEAkiUd7XbOJA7utQETe3r//eWgYGLQFhKN2ZMarh9EI17YB2UKwOX+xPb8WkcD LMLJMWptMNgjpChClbCLRV/Jkg1Qevc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3xwhv7kZ76ctBgvWwEJwBH34oWjsd5YnGAL8IAiI5Sc=; b=KNC70mD5dickLlXouEhF4VtoAuSxzSXdSbBbvdy4IegNreVMMyfJAxb4MAK9DEKfeVgpSI y/sQ03unioDygDAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3xwhv7kZ76ctBgvWwEJwBH34oWjsd5YnGAL8IAiI5Sc=; b=XPCEvjEKJxkvQA/VjhrqOyM3Xau/9VLGXMdireGj22D389OdL+mYEHRGjBfDTmpQwwNFT5 tmtpcbhUEAkiUd7XbOJA7utQETe3r//eWgYGLQFhKN2ZMarh9EI17YB2UKwOX+xPb8WkcD LMLJMWptMNgjpChClbCLRV/Jkg1Qevc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3xwhv7kZ76ctBgvWwEJwBH34oWjsd5YnGAL8IAiI5Sc=; b=KNC70mD5dickLlXouEhF4VtoAuSxzSXdSbBbvdy4IegNreVMMyfJAxb4MAK9DEKfeVgpSI y/sQ03unioDygDAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 01/21] migration: Normalize tls arguments Date: Mon, 2 Jun 2025 22:37:50 -0300 Message-Id: <20250603013810.4772-2-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914763694116600 Content-Type: text/plain; charset="utf-8" The migration parameters tls_creds, tls_authz and tls_hostname currently have a non-uniform handling. When used as arguments to migrate-set-parameters, their type is StrOrNull and when used as return value from query-migrate-parameters, their type is a plain string. Not only having to convert between the types is cumbersome, but it also creates the issue of requiring two different QAPI types to be used, one for each command. MigrateSetParameters is used for migrate-set-parameters with the TLS arguments as StrOrNull while MigrationParameters is used for query-migrate-parameters with the TLS arguments as str. Since StrOrNull could be considered a superset of str, change the type of the TLS arguments in MigrationParameters to StrOrNull and add a helper to ensure they're never actually used as QTYPE_QNULL. This will allow the type duplication to be removed in the next patches. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/migration-hmp-cmds.c | 8 +- migration/migration.c | 2 + migration/options.c | 149 ++++++++++++++++++++------------- migration/options.h | 1 + migration/tls.c | 2 +- qapi/migration.json | 6 +- 6 files changed, 99 insertions(+), 69 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index e8a563c7d8..bc8179c582 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -276,14 +276,12 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) monitor_printf(mon, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_CPU_THROTTLE), params->max_cpu_throttle); - assert(params->tls_creds); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), - params->tls_creds); - assert(params->tls_hostname); + params->tls_creds ? params->tls_creds->u.s : ""); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), - params->tls_hostname); + params->tls_hostname ? params->tls_hostname->u.s : = ""); assert(params->has_max_bandwidth); monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), @@ -319,7 +317,7 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) params->max_postcopy_bandwidth); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz); + params->tls_authz ? params->tls_authz->u.s : ""); =20 if (params->has_block_bitmap_mapping) { const BitmapMigrationNodeAliasList *bmnal; diff --git a/migration/migration.c b/migration/migration.c index 4697732bef..f65cb81b6d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4053,6 +4053,8 @@ static void migration_instance_finalize(Object *obj) { MigrationState *ms =3D MIGRATION_OBJ(obj); =20 + migrate_tls_opts_free(&ms->parameters); + qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); diff --git a/migration/options.c b/migration/options.c index 162c72cda4..45a95dc6da 100644 --- a/migration/options.c +++ b/migration/options.c @@ -162,9 +162,11 @@ const Property migration_properties[] =3D { DEFINE_PROP_SIZE("announce-step", MigrationState, parameters.announce_step, DEFAULT_MIGRATE_ANNOUNCE_STEP), - DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), - DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), - DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), + /* + * tls-creds, tls-hostname and tls-authz are of type StrOrNull, + * which can't be easily handled (if at all) by qdev. So these + * will not be exposed as global migration options (-global). + */ DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, parameters.x_vcpu_dirty_limit_period, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), @@ -379,13 +381,6 @@ bool migrate_rdma(void) return s->rdma_migration; } =20 -bool migrate_tls(void) -{ - MigrationState *s =3D migrate_get_current(); - - return s->parameters.tls_creds && *s->parameters.tls_creds; -} - typedef enum WriteTrackingSupport { WT_SUPPORT_UNKNOWN =3D 0, WT_SUPPORT_ABSENT, @@ -834,21 +829,44 @@ const char *migrate_tls_authz(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_authz; + if (s->parameters.tls_authz && + s->parameters.tls_authz->type =3D=3D QTYPE_QSTRING && + *s->parameters.tls_authz->u.s) { + return s->parameters.tls_authz->u.s; + } + + return NULL; } =20 const char *migrate_tls_creds(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_creds; + if (s->parameters.tls_creds && + s->parameters.tls_creds->type =3D=3D QTYPE_QSTRING && + *s->parameters.tls_creds->u.s) { + return s->parameters.tls_creds->u.s; + } + + return NULL; } =20 const char *migrate_tls_hostname(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_hostname; + if (s->parameters.tls_hostname && + s->parameters.tls_hostname->type =3D=3D QTYPE_QSTRING && + *s->parameters.tls_hostname->u.s) { + return s->parameters.tls_hostname->u.s; + } + + return NULL; +} + +bool migrate_tls(void) +{ + return !!migrate_tls_creds(); } =20 uint64_t migrate_vcpu_dirty_limit_period(void) @@ -888,6 +906,36 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 +void migrate_tls_opts_free(MigrationParameters *params) +{ + qapi_free_StrOrNull(params->tls_creds); + qapi_free_StrOrNull(params->tls_hostname); + qapi_free_StrOrNull(params->tls_authz); +} + +/* needs BQL if dst is part of s->parameters */ +static void tls_option_set_str(StrOrNull **dstp, StrOrNull *src) +{ + StrOrNull *dst =3D *dstp; + + assert(!dst); + + dst =3D *dstp =3D g_new0(StrOrNull, 1); + dst->type =3D QTYPE_QSTRING; + + if (!src) { + dst->u.s =3D g_strdup(""); + return; + } + + if (src->type =3D=3D QTYPE_QSTRING) { + dst->u.s =3D g_strdup(src->u.s); + } else { + assert(src->type =3D=3D QTYPE_QNULL); + dst->u.s =3D g_strdup(""); + } +} + MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; @@ -903,10 +951,11 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; params->has_cpu_throttle_tailslow =3D true; params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; - params->tls_creds =3D g_strdup(s->parameters.tls_creds); - params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); - params->tls_authz =3D g_strdup(s->parameters.tls_authz ? - s->parameters.tls_authz : ""); + + tls_option_set_str(¶ms->tls_creds, s->parameters.tls_creds); + tls_option_set_str(¶ms->tls_hostname, s->parameters.tls_hostname); + tls_option_set_str(¶ms->tls_authz, s->parameters.tls_authz); + params->has_max_bandwidth =3D true; params->max_bandwidth =3D s->parameters.max_bandwidth; params->has_avail_switchover_bandwidth =3D true; @@ -963,9 +1012,6 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **errp) =20 void migrate_params_init(MigrationParameters *params) { - params->tls_hostname =3D g_strdup(""); - params->tls_creds =3D g_strdup(""); - /* Set has_* up only for parameter checks */ params->has_throttle_trigger_threshold =3D true; params->has_cpu_throttle_initial =3D true; @@ -1142,7 +1188,8 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) #ifdef CONFIG_LINUX if (migrate_zero_copy_send() && ((params->has_multifd_compression && params->multifd_compression) = || - (params->tls_creds && *params->tls_creds))) { + (params->tls_creds && params->tls_creds->type =3D=3D QTYPE_QSTRIN= G && + *params->tls_creds->u.s))) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; @@ -1204,18 +1251,24 @@ static void migrate_params_test_apply(MigrateSetPar= ameters *params, } =20 if (params->tls_creds) { - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - dest->tls_creds =3D params->tls_creds->u.s; + tls_option_set_str(&dest->tls_creds, params->tls_creds); + } else { + /* drop the reference, it's owned by s->parameters */ + dest->tls_creds =3D NULL; } =20 if (params->tls_hostname) { - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - dest->tls_hostname =3D params->tls_hostname->u.s; + tls_option_set_str(&dest->tls_hostname, params->tls_hostname); + } else { + /* drop the reference, it's owned by s->parameters */ + dest->tls_hostname =3D NULL; } =20 if (params->tls_authz) { - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - dest->tls_authz =3D params->tls_authz->u.s; + tls_option_set_str(&dest->tls_authz, params->tls_authz); + } else { + /* drop the reference, it's owned by s->parameters */ + dest->tls_authz =3D NULL; } =20 if (params->has_max_bandwidth) { @@ -1320,21 +1373,18 @@ static void migrate_params_apply(MigrateSetParamete= rs *params, Error **errp) } =20 if (params->tls_creds) { - g_free(s->parameters.tls_creds); - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); + qapi_free_StrOrNull(s->parameters.tls_creds); + tls_option_set_str(&s->parameters.tls_creds, params->tls_creds); } =20 if (params->tls_hostname) { - g_free(s->parameters.tls_hostname); - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); + qapi_free_StrOrNull(s->parameters.tls_hostname); + tls_option_set_str(&s->parameters.tls_hostname, params->tls_hostna= me); } =20 if (params->tls_authz) { - g_free(s->parameters.tls_authz); - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); + qapi_free_StrOrNull(s->parameters.tls_authz); + tls_option_set_str(&s->parameters.tls_authz, params->tls_authz); } =20 if (params->has_max_bandwidth) { @@ -1433,32 +1483,11 @@ void qmp_migrate_set_parameters(MigrateSetParameter= s *params, Error **errp) { MigrationParameters tmp; =20 - /* TODO Rewrite "" to null instead for all three tls_* parameters */ - if (params->tls_creds - && params->tls_creds->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_creds->u.n); - params->tls_creds->type =3D QTYPE_QSTRING; - params->tls_creds->u.s =3D strdup(""); - } - if (params->tls_hostname - && params->tls_hostname->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_hostname->u.n); - params->tls_hostname->type =3D QTYPE_QSTRING; - params->tls_hostname->u.s =3D strdup(""); - } - if (params->tls_authz - && params->tls_authz->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_authz->u.n); - params->tls_authz->type =3D QTYPE_QSTRING; - params->tls_authz->u.s =3D strdup(""); - } - migrate_params_test_apply(params, &tmp); =20 - if (!migrate_params_check(&tmp, errp)) { - /* Invalid parameter */ - return; + if (migrate_params_check(&tmp, errp)) { + migrate_params_apply(params, errp); } =20 - migrate_params_apply(params, errp); + migrate_tls_opts_free(&tmp); } diff --git a/migration/options.h b/migration/options.h index 82d839709e..999eee6f3b 100644 --- a/migration/options.h +++ b/migration/options.h @@ -91,4 +91,5 @@ ZeroPageDetection migrate_zero_page_detection(void); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); +void migrate_tls_opts_free(MigrationParameters *params); #endif diff --git a/migration/tls.c b/migration/tls.c index 5cbf952383..8a89d3f767 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -126,7 +126,7 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *= ioc, } =20 const char *tls_hostname =3D migrate_tls_hostname(); - if (tls_hostname && *tls_hostname) { + if (tls_hostname) { hostname =3D tls_hostname; } =20 diff --git a/qapi/migration.json b/qapi/migration.json index 41826bde45..fa42d94810 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1293,9 +1293,9 @@ '*cpu-throttle-initial': 'uint8', '*cpu-throttle-increment': 'uint8', '*cpu-throttle-tailslow': 'bool', - '*tls-creds': 'str', - '*tls-hostname': 'str', - '*tls-authz': 'str', + '*tls-creds': 'StrOrNull', + '*tls-hostname': 'StrOrNull', + '*tls-authz': 'StrOrNull', '*max-bandwidth': 'size', '*avail-switchover-bandwidth': 'size', '*downtime-limit': 'uint64', --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914745; cv=none; d=zohomail.com; s=zohoarc; b=W7K1MKUYAhJwUDPQRgXkkTuzsodEufgoF3KhGiM3mJZ6F2pHzeTkgKNjKxSL+rT52Pe9oy++qysxqHs8iduKQ5KkdTVOZbrz04ZDNFzqJ8B6UM1DKWIic6RnRF790lEXLMaoWSBn+GkxR4UTRINmMLHfGNrXjhEFbxoTorh0Oow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914745; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Emz6VfGoqGNfedlBhFvIhjpWzv6jwU1UASWytFDdA/c=; b=kZDj1cv87iFB1/bKHg9uUJWTmeRXePa9dO50h5XpKp7+56pvd9tgajwXJ//ZQ7ERV7lv1cvPWodHnvqZjeDSdkK8JEYKUW0Ub8h51E0W212Z1uo7pB6OGtIIJi3gffkdM66fqHQdiU/nvZW1aY9znNHdeR7B1KAp7fOObpnNNPc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914745682431.3959536295222; Mon, 2 Jun 2025 18:39:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGbk-0006Qa-FW; Mon, 02 Jun 2025 21:38:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGbj-0006QB-8L for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:27 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGbg-0001Qn-NY for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:27 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0D63A1F394; Tue, 3 Jun 2025 01:38:19 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8058B13700; Tue, 3 Jun 2025 01:38:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2FFIEAlSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914699; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Emz6VfGoqGNfedlBhFvIhjpWzv6jwU1UASWytFDdA/c=; b=PG8BQhz+qSTsZ50HzWao/dDAqIBFOndU6gbXQ/EzffTz+U6teuVfnlZW9k9FGZ9iA3JS1c ROWMB33HiMIZ9AIM7U5O0WQut0dESoI5Nrib+VxHQ1pAGB2E7aLkuJEwdBAcMr+B3ZPKEM 987kNXDZSLI+xbRbfXUbmf5NbBoRrh8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914699; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Emz6VfGoqGNfedlBhFvIhjpWzv6jwU1UASWytFDdA/c=; b=wO9XHVaDuUL48pIM9eE1Gk0S8cEFbiyCf/4quiHSJrzNHWPCjqA8TfGw8flJYl2MKB4FTJ niK1r8DNRTUwnuDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=PG8BQhz+; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=wO9XHVaD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914699; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Emz6VfGoqGNfedlBhFvIhjpWzv6jwU1UASWytFDdA/c=; b=PG8BQhz+qSTsZ50HzWao/dDAqIBFOndU6gbXQ/EzffTz+U6teuVfnlZW9k9FGZ9iA3JS1c ROWMB33HiMIZ9AIM7U5O0WQut0dESoI5Nrib+VxHQ1pAGB2E7aLkuJEwdBAcMr+B3ZPKEM 987kNXDZSLI+xbRbfXUbmf5NbBoRrh8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914699; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Emz6VfGoqGNfedlBhFvIhjpWzv6jwU1UASWytFDdA/c=; b=wO9XHVaDuUL48pIM9eE1Gk0S8cEFbiyCf/4quiHSJrzNHWPCjqA8TfGw8flJYl2MKB4FTJ niK1r8DNRTUwnuDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 02/21] migration: Remove MigrateSetParameters Date: Mon, 2 Jun 2025 22:37:51 -0300 Message-Id: <20250603013810.4772-3-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 0D63A1F394 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914747724116600 Content-Type: text/plain; charset="utf-8" Now that the TLS options have been made the same between migrate-set-parameters and query-migrate-parameters, a single type can be used. Remove MigrateSetParameters. The TLS options documentation from MigrationParameters were replaced with the ones from MigrateSetParameters which was more complete. I'm choosing to somewhat ignore any ambiguity between "query" and "set" because other options' docs are already ambiguous in that regard. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/migration-hmp-cmds.c | 4 +- migration/options.c | 6 +- qapi/migration.json | 221 +++------------------------------ 3 files changed, 20 insertions(+), 211 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index bc8179c582..aacffdc532 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -490,7 +490,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDic= t *qdict) const char *param =3D qdict_get_str(qdict, "parameter"); const char *valuestr =3D qdict_get_str(qdict, "value"); Visitor *v =3D string_input_visitor_new(valuestr); - MigrateSetParameters *p =3D g_new0(MigrateSetParameters, 1); + MigrationParameters *p =3D g_new0(MigrationParameters, 1); uint64_t valuebw =3D 0; uint64_t cache_size; Error *err =3D NULL; @@ -656,7 +656,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDic= t *qdict) qmp_migrate_set_parameters(p, &err); =20 cleanup: - qapi_free_MigrateSetParameters(p); + qapi_free_MigrationParameters(p); visit_free(v); hmp_handle_error(mon, err); } diff --git a/migration/options.c b/migration/options.c index 45a95dc6da..e49d584a99 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1227,7 +1227,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return true; } =20 -static void migrate_params_test_apply(MigrateSetParameters *params, +static void migrate_params_test_apply(MigrationParameters *params, MigrationParameters *dest) { *dest =3D migrate_get_current()->parameters; @@ -1350,7 +1350,7 @@ static void migrate_params_test_apply(MigrateSetParam= eters *params, } } =20 -static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) +static void migrate_params_apply(MigrationParameters *params, Error **errp) { MigrationState *s =3D migrate_get_current(); =20 @@ -1479,7 +1479,7 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) } } =20 -void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) +void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { MigrationParameters tmp; =20 diff --git a/qapi/migration.json b/qapi/migration.json index fa42d94810..080968993a 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -914,202 +914,6 @@ 'zero-page-detection', 'direct-io'] } =20 -## -# @MigrateSetParameters: -# -# @announce-initial: Initial delay (in milliseconds) before sending -# the first announce (Since 4.0) -# -# @announce-max: Maximum delay (in milliseconds) between packets in -# the announcement (Since 4.0) -# -# @announce-rounds: Number of self-announce packets sent after -# migration (Since 4.0) -# -# @announce-step: Increase in delay (in milliseconds) between -# subsequent packets in the announcement (Since 4.0) -# -# @throttle-trigger-threshold: The ratio of bytes_dirty_period and -# bytes_xfer_period to trigger throttling. It is expressed as -# percentage. The default value is 50. (Since 5.0) -# -# @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttled when migration auto-converge is activated. The -# default value is 20. (Since 2.7) -# -# @cpu-throttle-increment: throttle percentage increase each time -# auto-converge detects that migration is not making progress. -# The default value is 10. (Since 2.7) -# -# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At -# the tail stage of throttling, the Guest is very sensitive to CPU -# percentage while the @cpu-throttle -increment is excessive -# usually at tail stage. If this parameter is true, we will -# compute the ideal CPU percentage used by the Guest, which may -# exactly make the dirty rate match the dirty rate threshold. -# Then we will choose a smaller throttle increment between the one -# specified by @cpu-throttle-increment and the one generated by -# ideal CPU percentage. Therefore, it is compatible to -# traditional throttling, meanwhile the throttle increment won't -# be excessive at tail stage. The default value is false. (Since -# 5.1) -# -# @tls-creds: ID of the 'tls-creds' object that provides credentials -# for establishing a TLS connection over the migration data -# channel. On the outgoing side of the migration, the credentials -# must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. Setting this to a -# non-empty string enables TLS for all migrations. An empty -# string means that QEMU will use plain text mode for migration, -# rather than TLS. This is the default. (Since 2.7) -# -# @tls-hostname: migration target's hostname for validating the -# server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. A non-empty value is -# required when using x509 based TLS credentials and the migration -# URI does not include a hostname, such as fd: or exec: based -# migration. (Since 2.7) -# -# Note: empty value works only since 2.9. -# -# @tls-authz: ID of the 'authz' object subclass that provides access -# control checking of the TLS x509 certificate distinguished name. -# This object is only resolved at time of use, so can be deleted -# and recreated on the fly while the migration server is active. -# If missing, it will default to denying access (Since 4.0) -# -# @max-bandwidth: maximum speed for migration, in bytes per second. -# (Since 2.8) -# -# @avail-switchover-bandwidth: to set the available bandwidth that -# migration can use during switchover phase. NOTE! This does not -# limit the bandwidth during switchover, but only for calculations -# when making decisions to switchover. By default, this value is -# zero, which means QEMU will estimate the bandwidth -# automatically. This can be set when the estimated value is not -# accurate, while the user is able to guarantee such bandwidth is -# available when switching over. When specified correctly, this -# can make the switchover decision much more accurate. -# (Since 8.2) -# -# @downtime-limit: set maximum tolerated downtime for migration. -# maximum downtime in milliseconds (Since 2.8) -# -# @x-checkpoint-delay: The delay time (in ms) between two COLO -# checkpoints in periodic mode. (Since 2.8) -# -# @multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the number of sockets -# used for migration. The default value is 2 (since 4.0) -# -# @xbzrle-cache-size: cache size to be used by XBZRLE migration. It -# needs to be a multiple of the target page size and a power of 2 -# (Since 2.11) -# -# @max-postcopy-bandwidth: Background transfer bandwidth during -# postcopy. Defaults to 0 (unlimited). In bytes per second. -# (Since 3.0) -# -# @max-cpu-throttle: maximum cpu throttle percentage. Defaults to 99. -# (Since 3.1) -# -# @multifd-compression: Which compression method to use. Defaults to -# none. (Since 5.0) -# -# @multifd-zlib-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 9, -# where 0 means no compression, 1 means the best compression -# speed, and 9 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @multifd-qatzip-level: Set the compression level to be used in live -# migration. The level is an integer between 1 and 9, where 1 means -# the best compression speed, and 9 means the best compression -# ratio which will consume more CPU. Defaults to 1. (Since 9.2) -# -# @multifd-zstd-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 20, -# where 0 means no compression, 1 means the best compression -# speed, and 20 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @block-bitmap-mapping: Maps block nodes and bitmaps on them to -# aliases for the purpose of dirty bitmap migration. Such aliases -# may for example be the corresponding names on the opposite site. -# The mapping must be one-to-one, but not necessarily complete: On -# the source, unmapped bitmaps and all bitmaps on unmapped nodes -# will be ignored. On the destination, encountering an unmapped -# alias in the incoming migration stream will result in a report, -# and all further bitmap migration data will then be discarded. -# Note that the destination does not know about bitmaps it does -# not receive, so there is no limitation or requirement regarding -# the number of bitmaps received, or how they are named, or on -# which nodes they are placed. By default (when this parameter -# has never been set), bitmap names are mapped to themselves. -# Nodes are mapped to their block device name if there is one, and -# to their node name otherwise. (Since 5.2) -# -# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty -# limit during live migration. Should be in the range 1 to -# 1000ms. Defaults to 1000ms. (Since 8.1) -# -# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. -# Defaults to 1. (Since 8.1) -# -# @mode: Migration mode. See description in @MigMode. Default is -# 'normal'. (Since 8.2) -# -# @zero-page-detection: Whether and how to detect zero pages. -# See description in @ZeroPageDetection. Default is 'multifd'. -# (since 9.0) -# -# @direct-io: Open migration files with O_DIRECT when possible. This -# only has effect if the @mapped-ram capability is enabled. -# (Since 9.1) -# -# Features: -# -# @unstable: Members @x-checkpoint-delay and -# @x-vcpu-dirty-limit-period are experimental. -# -# TODO: either fuse back into MigrationParameters, or make -# MigrationParameters members mandatory -# -# Since: 2.4 -## -{ 'struct': 'MigrateSetParameters', - 'data': { '*announce-initial': 'size', - '*announce-max': 'size', - '*announce-rounds': 'size', - '*announce-step': 'size', - '*throttle-trigger-threshold': 'uint8', - '*cpu-throttle-initial': 'uint8', - '*cpu-throttle-increment': 'uint8', - '*cpu-throttle-tailslow': 'bool', - '*tls-creds': 'StrOrNull', - '*tls-hostname': 'StrOrNull', - '*tls-authz': 'StrOrNull', - '*max-bandwidth': 'size', - '*avail-switchover-bandwidth': 'size', - '*downtime-limit': 'uint64', - '*x-checkpoint-delay': { 'type': 'uint32', - 'features': [ 'unstable' ] }, - '*multifd-channels': 'uint8', - '*xbzrle-cache-size': 'size', - '*max-postcopy-bandwidth': 'size', - '*max-cpu-throttle': 'uint8', - '*multifd-compression': 'MultiFDCompression', - '*multifd-zlib-level': 'uint8', - '*multifd-qatzip-level': 'uint8', - '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], - '*x-vcpu-dirty-limit-period': { 'type': 'uint64', - 'features': [ 'unstable' ] }, - '*vcpu-dirty-limit': 'uint64', - '*mode': 'MigMode', - '*zero-page-detection': 'ZeroPageDetection', - '*direct-io': 'bool' } } - ## # @migrate-set-parameters: # @@ -1124,12 +928,13 @@ # <- { "return": {} } ## { 'command': 'migrate-set-parameters', 'boxed': true, - 'data': 'MigrateSetParameters' } + 'data': 'MigrationParameters' } =20 ## # @MigrationParameters: # -# The optional members aren't actually optional. +# Migration parameters. Optional members are optional when used with +# an input command, otherwise mandatory. # # @announce-initial: Initial delay (in milliseconds) before sending # the first announce (Since 4.0) @@ -1172,21 +977,25 @@ # for establishing a TLS connection over the migration data # channel. On the outgoing side of the migration, the credentials # must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. An empty string -# means that QEMU will use plain text mode for migration, rather -# than TLS. (Since 2.7) -# -# Note: 2.8 omits empty @tls-creds instead. +# credentials must be for a 'server' endpoint. Setting this to a +# non-empty string enables TLS for all migrations. An empty +# string means that QEMU will use plain text mode for migration, +# rather than TLS. This is the default. (Since 2.7) # # @tls-hostname: migration target's hostname for validating the # server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. (Since 2.7) +# hostname from the migration URI, if any. A non-empty value is +# required when using x509 based TLS credentials and the migration +# URI does not include a hostname, such as fd: or exec: based +# migration. (Since 2.7) # -# Note: 2.8 omits empty @tls-hostname instead. +# Note: empty value works only since 2.9. # # @tls-authz: ID of the 'authz' object subclass that provides access # control checking of the TLS x509 certificate distinguished name. -# (Since 4.0) +# This object is only resolved at time of use, so can be deleted +# and recreated on the fly while the migration server is active. +# If missing, it will default to denying access (Since 4.0) # # @max-bandwidth: maximum speed for migration, in bytes per second. # (Since 2.8) --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914760; cv=none; d=zohomail.com; s=zohoarc; b=Mhicp7adFnGln4KjFfux6PsJ6ZUBuOY41CwX4iVNDx57IVs3UsmDlnQbgmQc5t3Hh4fibTm4V0Lvpn8cq/pbiv2Rodx2/c+lSfVJlOnr4FI2S1dFj87w3jJNSw93lBC7T5Wm14Q+Pj/HAYiTm/Asn7BOF/6UyMh+MP/HF4Iar6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914760; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HZiChYRCokoaodw33wlx/YS1OZ3Lr7Ka+lZ1U2wYHt8=; b=X1TLds3YKwNd0rJWbQSqxYxP64eLAhjyZy3tXcUUWLOF7MVFOozhIN9uwR8LomMzRkJRKpMbE+zN0+9ujzcfZPvJ9zS+goZfktqbTZ19YoM12hsAH+WO+ZoMn4K4Y/s1ORBgSDi4luZx2WYSUX8rDkAKLC3oiVBKy4uWzO9bWcQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914760603998.9447986433695; Mon, 2 Jun 2025 18:39:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGbi-0006QA-O9; Mon, 02 Jun 2025 21:38:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGbg-0006Pw-Hc for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:24 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGbe-0001QO-Ge for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:24 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 13256218E7; Tue, 3 Jun 2025 01:38:21 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 854F413700; Tue, 3 Jun 2025 01:38:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id YPWnEQtSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914701; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HZiChYRCokoaodw33wlx/YS1OZ3Lr7Ka+lZ1U2wYHt8=; b=pYeW9bvZubJqw5qECvEeFLOAxAixZzHUWeg0suZQykoQTMYa5Q+CNi7JbFm2ygWxIzGqbD tnFpk5JUd93nOyuLjffndnYr90quMIR6EiFlUWZWKMzWEwU9g2/8zFR09m2Pflhthru798 Gi2mwqck4O1YdwEIlaeJLVHMKC8ZlPY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914701; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HZiChYRCokoaodw33wlx/YS1OZ3Lr7Ka+lZ1U2wYHt8=; b=RfPjfgUnGoc6RU3tlidcT0PoNPB1SrkL94YhOzaTMAxVLyawd2OFinfjYl7DI103Z+KhND 4z7Y2NzgrldNDoBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914701; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HZiChYRCokoaodw33wlx/YS1OZ3Lr7Ka+lZ1U2wYHt8=; b=pYeW9bvZubJqw5qECvEeFLOAxAixZzHUWeg0suZQykoQTMYa5Q+CNi7JbFm2ygWxIzGqbD tnFpk5JUd93nOyuLjffndnYr90quMIR6EiFlUWZWKMzWEwU9g2/8zFR09m2Pflhthru798 Gi2mwqck4O1YdwEIlaeJLVHMKC8ZlPY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914701; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HZiChYRCokoaodw33wlx/YS1OZ3Lr7Ka+lZ1U2wYHt8=; b=RfPjfgUnGoc6RU3tlidcT0PoNPB1SrkL94YhOzaTMAxVLyawd2OFinfjYl7DI103Z+KhND 4z7Y2NzgrldNDoBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 03/21] qapi/migration: Don't document MigrationParameter Date: Mon, 2 Jun 2025 22:37:52 -0300 Message-Id: <20250603013810.4772-4-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914761473116600 Content-Type: text/plain; charset="utf-8" The MigrationParameter (singular) enumeration is not part of the migration QMP API, it's only used for nicely converting HMP strings into MigrationParameters (plural) members and for providing readline completion. Documenting this enum only serves to duplicate documentation between MigrationParameter and MigrationParameters. Add an exception to QAPIs pragma.json and stop documenting it. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- qapi/migration.json | 152 +------------------------------------------- qapi/pragma.json | 3 +- 2 files changed, 3 insertions(+), 152 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 080968993a..452e6dedaa 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -734,157 +734,7 @@ ## # @MigrationParameter: # -# Migration parameters enumeration -# -# @announce-initial: Initial delay (in milliseconds) before sending -# the first announce (Since 4.0) -# -# @announce-max: Maximum delay (in milliseconds) between packets in -# the announcement (Since 4.0) -# -# @announce-rounds: Number of self-announce packets sent after -# migration (Since 4.0) -# -# @announce-step: Increase in delay (in milliseconds) between -# subsequent packets in the announcement (Since 4.0) -# -# @throttle-trigger-threshold: The ratio of bytes_dirty_period and -# bytes_xfer_period to trigger throttling. It is expressed as -# percentage. The default value is 50. (Since 5.0) -# -# @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttled when migration auto-converge is activated. The -# default value is 20. (Since 2.7) -# -# @cpu-throttle-increment: throttle percentage increase each time -# auto-converge detects that migration is not making progress. -# The default value is 10. (Since 2.7) -# -# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At -# the tail stage of throttling, the Guest is very sensitive to CPU -# percentage while the @cpu-throttle -increment is excessive -# usually at tail stage. If this parameter is true, we will -# compute the ideal CPU percentage used by the Guest, which may -# exactly make the dirty rate match the dirty rate threshold. -# Then we will choose a smaller throttle increment between the one -# specified by @cpu-throttle-increment and the one generated by -# ideal CPU percentage. Therefore, it is compatible to -# traditional throttling, meanwhile the throttle increment won't -# be excessive at tail stage. The default value is false. (Since -# 5.1) -# -# @tls-creds: ID of the 'tls-creds' object that provides credentials -# for establishing a TLS connection over the migration data -# channel. On the outgoing side of the migration, the credentials -# must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. Setting this to a -# non-empty string enables TLS for all migrations. An empty -# string means that QEMU will use plain text mode for migration, -# rather than TLS. (Since 2.7) -# -# @tls-hostname: migration target's hostname for validating the -# server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. A non-empty value is -# required when using x509 based TLS credentials and the migration -# URI does not include a hostname, such as fd: or exec: based -# migration. (Since 2.7) -# -# Note: empty value works only since 2.9. -# -# @tls-authz: ID of the 'authz' object subclass that provides access -# control checking of the TLS x509 certificate distinguished name. -# This object is only resolved at time of use, so can be deleted -# and recreated on the fly while the migration server is active. -# If missing, it will default to denying access (Since 4.0) -# -# @max-bandwidth: maximum speed for migration, in bytes per second. -# (Since 2.8) -# -# @avail-switchover-bandwidth: to set the available bandwidth that -# migration can use during switchover phase. NOTE! This does not -# limit the bandwidth during switchover, but only for calculations -# when making decisions to switchover. By default, this value is -# zero, which means QEMU will estimate the bandwidth -# automatically. This can be set when the estimated value is not -# accurate, while the user is able to guarantee such bandwidth is -# available when switching over. When specified correctly, this -# can make the switchover decision much more accurate. -# (Since 8.2) -# -# @downtime-limit: set maximum tolerated downtime for migration. -# maximum downtime in milliseconds (Since 2.8) -# -# @x-checkpoint-delay: The delay time (in ms) between two COLO -# checkpoints in periodic mode. (Since 2.8) -# -# @multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the number of sockets -# used for migration. The default value is 2 (since 4.0) -# -# @xbzrle-cache-size: cache size to be used by XBZRLE migration. It -# needs to be a multiple of the target page size and a power of 2 -# (Since 2.11) -# -# @max-postcopy-bandwidth: Background transfer bandwidth during -# postcopy. Defaults to 0 (unlimited). In bytes per second. -# (Since 3.0) -# -# @max-cpu-throttle: maximum cpu throttle percentage. Defaults to 99. -# (Since 3.1) -# -# @multifd-compression: Which compression method to use. Defaults to -# none. (Since 5.0) -# -# @multifd-zlib-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 9, -# where 0 means no compression, 1 means the best compression -# speed, and 9 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @multifd-qatzip-level: Set the compression level to be used in live -# migration. The level is an integer between 1 and 9, where 1 means -# the best compression speed, and 9 means the best compression -# ratio which will consume more CPU. Defaults to 1. (Since 9.2) -# -# @multifd-zstd-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 20, -# where 0 means no compression, 1 means the best compression -# speed, and 20 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @block-bitmap-mapping: Maps block nodes and bitmaps on them to -# aliases for the purpose of dirty bitmap migration. Such aliases -# may for example be the corresponding names on the opposite site. -# The mapping must be one-to-one, but not necessarily complete: On -# the source, unmapped bitmaps and all bitmaps on unmapped nodes -# will be ignored. On the destination, encountering an unmapped -# alias in the incoming migration stream will result in a report, -# and all further bitmap migration data will then be discarded. -# Note that the destination does not know about bitmaps it does -# not receive, so there is no limitation or requirement regarding -# the number of bitmaps received, or how they are named, or on -# which nodes they are placed. By default (when this parameter -# has never been set), bitmap names are mapped to themselves. -# Nodes are mapped to their block device name if there is one, and -# to their node name otherwise. (Since 5.2) -# -# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty -# limit during live migration. Should be in the range 1 to -# 1000ms. Defaults to 1000ms. (Since 8.1) -# -# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. -# Defaults to 1. (Since 8.1) -# -# @mode: Migration mode. See description in @MigMode. Default is -# 'normal'. (Since 8.2) -# -# @zero-page-detection: Whether and how to detect zero pages. -# See description in @ZeroPageDetection. Default is 'multifd'. -# (since 9.0) -# -# @direct-io: Open migration files with O_DIRECT when possible. This -# only has effect if the @mapped-ram capability is enabled. -# (Since 9.1) +# Migration parameters enumeration. See @MigrationParameters for more info. # # Features: # diff --git a/qapi/pragma.json b/qapi/pragma.json index 023a2ef7bc..58133907b6 100644 --- a/qapi/pragma.json +++ b/qapi/pragma.json @@ -76,7 +76,8 @@ 'X86CPURegister32', 'XDbgBlockGraph', 'YankInstanceType', - 'blockdev-reopen' ], + 'blockdev-reopen', + 'MigrationParameter'], # Externally visible types whose member names may use uppercase 'member-name-exceptions': [ # visible in: 'ACPISlotType', # query-acpi-ospm-status --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914745; cv=none; d=zohomail.com; s=zohoarc; b=cfp2NB6VAvqcVRHmyk5ciqMzrT7QX+TU0um9aO0WHpVP2yHKDas4LwNfwUNc/RFV1gwX1byF5pTBzzvcgNe81Fq9pCobIkgTjOCuP/vb1DSuH0Y7/36qX11nMXXIMDVfvZ3s9P427Esr6Dbk3pYfK6Ho7F3cUzhNOkKHwLc4AYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914745; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m1NmJOzistgkewZvj5rcGicm2xwzriSt4DaxoQcJ+lg=; b=dM6oZN2l/PMCxQrvZUsbHUJdqOpvaHkNdSLHJcU3cni4pN9xscS5KADP4DISpByYLvAB5gK/NfdWgxtM0VTZdRoazWt9Ms9HGu/WvLwe6mrbFF/UMiM+uL6GEG6+YPNSbdaTGtEntQ37p6nGUBvHs5SpqQQ1OLA7CZermRQaABY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914745298161.04244815220443; Mon, 2 Jun 2025 18:39:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGbq-0006RP-4j; Mon, 02 Jun 2025 21:38:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGbn-0006Qz-ST for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:31 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGbm-0001RQ-3i for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:31 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 171D0218E8; Tue, 3 Jun 2025 01:38:23 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 89CF013700; Tue, 3 Jun 2025 01:38:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aB2pEg1SPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914703; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m1NmJOzistgkewZvj5rcGicm2xwzriSt4DaxoQcJ+lg=; b=h4XVeCQGlnT1Crtxrwu3mNQHmEnwNC6ia5/Ghk2lvuMS+XMGfNW0r3H6Umtcq7HX6RSb/6 iWGCRu/ebYW7bMu+36u/ARmBg4cJ/2UGUPMB2Sj3aJBlz1mqgzzFJLDbQrMWxmA7COcP4k pPgh8h/ASokCQnq8BJAx9GUEO0xR4wM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914703; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m1NmJOzistgkewZvj5rcGicm2xwzriSt4DaxoQcJ+lg=; b=mtBT+01NhfRvuGziUe9tJEOo9llbvro4NtMG2bkvKbDHbC2pa4aS/thBbS3k3b4pO1+v8X iDlK0rww3MvSkeDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914703; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m1NmJOzistgkewZvj5rcGicm2xwzriSt4DaxoQcJ+lg=; b=h4XVeCQGlnT1Crtxrwu3mNQHmEnwNC6ia5/Ghk2lvuMS+XMGfNW0r3H6Umtcq7HX6RSb/6 iWGCRu/ebYW7bMu+36u/ARmBg4cJ/2UGUPMB2Sj3aJBlz1mqgzzFJLDbQrMWxmA7COcP4k pPgh8h/ASokCQnq8BJAx9GUEO0xR4wM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914703; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m1NmJOzistgkewZvj5rcGicm2xwzriSt4DaxoQcJ+lg=; b=mtBT+01NhfRvuGziUe9tJEOo9llbvro4NtMG2bkvKbDHbC2pa4aS/thBbS3k3b4pO1+v8X iDlK0rww3MvSkeDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 04/21] migration: Run a post update routine after setting parameters Date: Mon, 2 Jun 2025 22:37:53 -0300 Message-Id: <20250603013810.4772-5-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914747568116600 Content-Type: text/plain; charset="utf-8" Some migration parameters are updated immediately once they are set via migrate-set-parameters. Move that work outside of migrate_params_apply() and leave that function with the single responsibility of setting s->parameters and not doing any side-effects. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/options.c | 38 ++++++++++++++++++++++++++++---------- migration/ram.c | 2 +- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/migration/options.c b/migration/options.c index e49d584a99..f64e141394 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1039,6 +1039,31 @@ void migrate_params_init(MigrationParameters *params) params->has_direct_io =3D true; } =20 +static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) +{ + MigrationState *s =3D migrate_get_current(); + + if (new->has_max_bandwidth) { + if (s->to_dst_file && !migration_in_postcopy()) { + migration_rate_set(new->max_bandwidth); + } + } + + if (new->has_x_checkpoint_delay) { + colo_checkpoint_delay_set(); + } + + if (new->has_xbzrle_cache_size) { + xbzrle_cache_resize(new->xbzrle_cache_size, errp); + } + + if (new->has_max_postcopy_bandwidth) { + if (s->to_dst_file && migration_in_postcopy()) { + migration_rate_set(new->max_postcopy_bandwidth); + } + } +} + /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. @@ -1350,7 +1375,7 @@ static void migrate_params_test_apply(MigrationParame= ters *params, } } =20 -static void migrate_params_apply(MigrationParameters *params, Error **errp) +static void migrate_params_apply(MigrationParameters *params) { MigrationState *s =3D migrate_get_current(); =20 @@ -1389,9 +1414,6 @@ static void migrate_params_apply(MigrationParameters = *params, Error **errp) =20 if (params->has_max_bandwidth) { s->parameters.max_bandwidth =3D params->max_bandwidth; - if (s->to_dst_file && !migration_in_postcopy()) { - migration_rate_set(s->parameters.max_bandwidth); - } } =20 if (params->has_avail_switchover_bandwidth) { @@ -1404,7 +1426,6 @@ static void migrate_params_apply(MigrationParameters = *params, Error **errp) =20 if (params->has_x_checkpoint_delay) { s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - colo_checkpoint_delay_set(); } =20 if (params->has_multifd_channels) { @@ -1424,13 +1445,9 @@ static void migrate_params_apply(MigrationParameters= *params, Error **errp) } if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - xbzrle_cache_resize(params->xbzrle_cache_size, errp); } if (params->has_max_postcopy_bandwidth) { s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - if (s->to_dst_file && migration_in_postcopy()) { - migration_rate_set(s->parameters.max_postcopy_bandwidth); - } } if (params->has_max_cpu_throttle) { s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; @@ -1486,7 +1503,8 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) migrate_params_test_apply(params, &tmp); =20 if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(params, errp); + migrate_params_apply(params); + migrate_post_update_params(params, errp); } =20 migrate_tls_opts_free(&tmp); diff --git a/migration/ram.c b/migration/ram.c index d26dbd37c4..22e462bf72 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -174,7 +174,7 @@ static void XBZRLE_cache_unlock(void) /** * xbzrle_cache_resize: resize the xbzrle cache * - * This function is called from migrate_params_apply in main + * This function is called from migrate_post_update_config in main * thread, possibly while a migration is in progress. A running * migration may be using the cache and might finish during this call, * hence changes to the cache are protected by XBZRLE.lock(). --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914894; cv=none; d=zohomail.com; s=zohoarc; b=ZVhCaPweTDPjYvum0QiCR9zA9dNZu3zuIDFTXgZ7YtX04GiZrGeZfxfaxT9PCR/tCvg7DRq2geG1QoYtFJ6fGsne4wAO8ISxJ5qh+h2rJ9EcCbIxyJMLaqpnhDs8lTP8hiDTQjidIeP+YDZKo/AfD3zUVnHwkzOqble1Pusejuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914894; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VejkIVv0zcF0IoW2WMiP2MpgZf8Ky81lWE39y2/0xhU=; b=OGoxGcOw/Ww4d5CKg1WEtaRg10PajGX5PPkL26oSEOHjWp/lugc7xaUT2PQyhsRQqY10TSZGoYWTlLfCLjXrJMJkwcAKijTcfGWqOfr1bp35/svgEUJ1rbju6bONXx45O+TmqrcgZgaQk8GJa6BhcY0rbxIEvm+QDsRLGxn3zs0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17489148948991022.4606205040185; Mon, 2 Jun 2025 18:41:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGbr-0006S4-Vv; Mon, 02 Jun 2025 21:38:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGbp-0006RO-9A for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:34 -0400 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGbn-0001S0-8m for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:32 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1C00B1F38D; Tue, 3 Jun 2025 01:38:25 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8CB6713700; Tue, 3 Jun 2025 01:38:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id CHFuEw9SPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914705; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VejkIVv0zcF0IoW2WMiP2MpgZf8Ky81lWE39y2/0xhU=; b=lttpkKKIb3MgECjo4hDObre7KNjoL5Z+r6Zug3vdt8T7hjrI0WIIUPOaiG1ijBRJa/+ITV PE19eoCRzshMBAHbuxdlbEIqScBXwnydpOODdoW0Pp45VcISiHsSf/vgDADuZIJ/Z16jKF jhUd53GBBUideG7+ZrIsABwP5h1rKyk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914705; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VejkIVv0zcF0IoW2WMiP2MpgZf8Ky81lWE39y2/0xhU=; b=TciV3uEfyZnZix/qBRxyq2GVWb02oTiEp7Qtf7+PSgEFvnob3ChBSqIKwNdbRtGDckrynp wctdh518UgZmhTDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=lttpkKKI; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=TciV3uEf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914705; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VejkIVv0zcF0IoW2WMiP2MpgZf8Ky81lWE39y2/0xhU=; b=lttpkKKIb3MgECjo4hDObre7KNjoL5Z+r6Zug3vdt8T7hjrI0WIIUPOaiG1ijBRJa/+ITV PE19eoCRzshMBAHbuxdlbEIqScBXwnydpOODdoW0Pp45VcISiHsSf/vgDADuZIJ/Z16jKF jhUd53GBBUideG7+ZrIsABwP5h1rKyk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914705; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VejkIVv0zcF0IoW2WMiP2MpgZf8Ky81lWE39y2/0xhU=; b=TciV3uEfyZnZix/qBRxyq2GVWb02oTiEp7Qtf7+PSgEFvnob3ChBSqIKwNdbRtGDckrynp wctdh518UgZmhTDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 05/21] migration: Add a flag to track block-bitmap-mapping input Date: Mon, 2 Jun 2025 22:37:54 -0300 Message-Id: <20250603013810.4772-6-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 1C00B1F38D X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914895221116600 Content-Type: text/plain; charset="utf-8" The QAPI converts an empty list on the block-bitmap-mapping input into a NULL BitmapMigrationNodeAliasList. The empty list is a valid input for the block-bitmap-mapping option, so commit 3cba22c9ad ("migration: Fix block_bitmap_mapping migration") started using the s->parameters.has_block_bitmap_mapping field to tell when the user has passed in an empty list vs. when no list has been passed at all. However, using the has_block_bitmap_mapping field of s->parameters is only possible because MigrationParameters has had its members made optional due to historical reasons. In order to make improvements to the way configuration options are set for a migration, we'd like to reduce the usage of the has_* fields of the global configuration object (s->parameters). Add a separate boolean to track the status of the block_bitmap_mapping option. (this was verified to not regress iotest 300, which is the test that 3cba22c9ad refers to) Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/migration.h | 7 +++++++ migration/options.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index d53f7cad84..ab797540b0 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -510,6 +510,13 @@ struct MigrationState { bool rdma_migration; =20 GSource *hup_source; + + /* + * The block-bitmap-mapping option is allowed to be an emtpy list, + * therefore we need a way to know wheter the user has given + * anything as input. + */ + bool has_block_bitmap_mapping; }; =20 void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, diff --git a/migration/options.c b/migration/options.c index f64e141394..cf77826204 100644 --- a/migration/options.c +++ b/migration/options.c @@ -685,7 +685,7 @@ bool migrate_has_block_bitmap_mapping(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.has_block_bitmap_mapping; + return s->has_block_bitmap_mapping; } =20 uint32_t migrate_checkpoint_delay(void) @@ -989,7 +989,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->has_announce_step =3D true; params->announce_step =3D s->parameters.announce_step; =20 - if (s->parameters.has_block_bitmap_mapping) { + if (s->has_block_bitmap_mapping) { params->has_block_bitmap_mapping =3D true; params->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, @@ -1469,7 +1469,7 @@ static void migrate_params_apply(MigrationParameters = *params) qapi_free_BitmapMigrationNodeAliasList( s->parameters.block_bitmap_mapping); =20 - s->parameters.has_block_bitmap_mapping =3D true; + s->has_block_bitmap_mapping =3D true; s->parameters.block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, params->block_bitmap_mapping); --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914814; cv=none; d=zohomail.com; s=zohoarc; b=fajC2naV4k7eDGsIdxyb3HejXf/hYaTx4Qak1MgPDF62mWEZlUzJO7SZ6gly1AJx+yQhqnKxzh6KvPbNxCyB2meftqTnXEmN/a4AXUI4islezBzYcoag9HNt3h9COj9ogMRaB1Q3tVwAfSG7WMUgnGvu2hunobKg8lNdY4Vk4Co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914814; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=50koTDEu3SbHwfE5G0Yi9mfEqL36JaorNyta18sQiX0=; b=jdIi2MNWDKOhzaspnvQ6aBTxPsTfVk0neDHEgRLywKASPKhS0Vyjz++MWdwgNfchLpUhNQPSHdbV0yNjEPMF0cBPJdG7j7vGj9a+sXrYWFZQLcXSQBWNj/AoUDciUmWmJIuPYYFIuoiUP7UwtaP/GGfbxVAxeetylRpuUbuKB/k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914814352833.8760968207425; Mon, 2 Jun 2025 18:40:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGby-0006W4-9X; Mon, 02 Jun 2025 21:38:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGbw-0006Vk-DA for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:40 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGbt-0001TC-SK for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:39 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1ED231F394; Tue, 3 Jun 2025 01:38:27 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9152813700; Tue, 3 Jun 2025 01:38:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cOuyFBFSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914707; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50koTDEu3SbHwfE5G0Yi9mfEqL36JaorNyta18sQiX0=; b=azV5RHIl+/EJD0Dbc6bFmFbv6Q6bqelN+mvATvQeuimU1psJb0af5J9LyzInJ951ucTaqD At+daiirBykexQg5v+ZKpQhfM78oaHJMn9ayCpJZcqHcFr9UsdzrVLAfkzPO0/09xo8XwM Iz3273b9x6bZNBaua9iIaQLK4WTYypM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914707; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50koTDEu3SbHwfE5G0Yi9mfEqL36JaorNyta18sQiX0=; b=RqqsfM6HTV+xW9rbYheg51lRs1b1uB/lC3s25cZ5i2cKM3TiqrbtXcv3ogXixTwKudLyf8 BjB6L3MPblS+QWAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914707; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50koTDEu3SbHwfE5G0Yi9mfEqL36JaorNyta18sQiX0=; b=azV5RHIl+/EJD0Dbc6bFmFbv6Q6bqelN+mvATvQeuimU1psJb0af5J9LyzInJ951ucTaqD At+daiirBykexQg5v+ZKpQhfM78oaHJMn9ayCpJZcqHcFr9UsdzrVLAfkzPO0/09xo8XwM Iz3273b9x6bZNBaua9iIaQLK4WTYypM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914707; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50koTDEu3SbHwfE5G0Yi9mfEqL36JaorNyta18sQiX0=; b=RqqsfM6HTV+xW9rbYheg51lRs1b1uB/lC3s25cZ5i2cKM3TiqrbtXcv3ogXixTwKudLyf8 BjB6L3MPblS+QWAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 06/21] migration: Remove checks for s->parameters has_* fields Date: Mon, 2 Jun 2025 22:37:55 -0300 Message-Id: <20250603013810.4772-7-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914816308116600 Content-Type: text/plain; charset="utf-8" The migration parameters validation produces a temporary structure which is the merge of the current parameter values (s->parameters, MigrationParameters) with the new parameters set by the user (MigrateSetParameters). When copying the values from s->parameters into the temporary structure, the has_* fields are copied along, but when merging the user-input values (MigrateSetParameters) they are not. During migrate_params_check(), only the parameters that have the corresponding has_* field will be checked, so only the parameters that were initialized in migrate_params_init() will be validated. This causes (almost) all of the migration parameters to be validated every time a parameter is set, regardless of which fields the user touched, but it also skips validation of any values that are not set in migrate_params_init(). It's not clear what was the intention of the original code, whether to validate all fields always, or only validate what the user input changed. Since the current situation is closer to the former option, make the choice of validating all parameters by removing the checks for the has_* fields when validating. Note that bringing the user input into the temporary structure for validation still needs to look at the has_* fields, otherwise any parameters not set by the user (i.e. 0) would override the corresponding value in s->parameters. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Tested-by: Mario Casquero --- migration/migration.c | 2 - migration/options.c | 104 ++++++++++++------------------------------ 2 files changed, 29 insertions(+), 77 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f65cb81b6d..45e15ffeb6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4077,8 +4077,6 @@ static void migration_instance_init(Object *obj) qemu_sem_init(&ms->pause_sem, 0); qemu_mutex_init(&ms->error_mutex); =20 - migrate_params_init(&ms->parameters); - qemu_sem_init(&ms->postcopy_pause_sem, 0); qemu_sem_init(&ms->rp_state.rp_sem, 0); qemu_sem_init(&ms->rp_state.rp_pong_acks, 0); diff --git a/migration/options.c b/migration/options.c index cf77826204..d4021bc520 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1010,35 +1010,6 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) return params; } =20 -void migrate_params_init(MigrationParameters *params) -{ - /* Set has_* up only for parameter checks */ - params->has_throttle_trigger_threshold =3D true; - params->has_cpu_throttle_initial =3D true; - params->has_cpu_throttle_increment =3D true; - params->has_cpu_throttle_tailslow =3D true; - params->has_max_bandwidth =3D true; - params->has_downtime_limit =3D true; - params->has_x_checkpoint_delay =3D true; - params->has_multifd_channels =3D true; - params->has_multifd_compression =3D true; - params->has_multifd_zlib_level =3D true; - params->has_multifd_qatzip_level =3D true; - params->has_multifd_zstd_level =3D true; - params->has_xbzrle_cache_size =3D true; - params->has_max_postcopy_bandwidth =3D true; - params->has_max_cpu_throttle =3D true; - params->has_announce_initial =3D true; - params->has_announce_max =3D true; - params->has_announce_rounds =3D true; - params->has_announce_step =3D true; - params->has_x_vcpu_dirty_limit_period =3D true; - params->has_vcpu_dirty_limit =3D true; - params->has_mode =3D true; - params->has_zero_page_detection =3D true; - params->has_direct_io =3D true; -} - static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) { MigrationState *s =3D migrate_get_current(); @@ -1072,34 +1043,31 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) { ERRP_GUARD(); =20 - if (params->has_throttle_trigger_threshold && - (params->throttle_trigger_threshold < 1 || - params->throttle_trigger_threshold > 100)) { + if (params->throttle_trigger_threshold < 1 || + params->throttle_trigger_threshold > 100) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "throttle_trigger_threshold", "an integer in the range of 1 to 100"); return false; } =20 - if (params->has_cpu_throttle_initial && - (params->cpu_throttle_initial < 1 || - params->cpu_throttle_initial > 99)) { + if (params->cpu_throttle_initial < 1 || + params->cpu_throttle_initial > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); return false; } =20 - if (params->has_cpu_throttle_increment && - (params->cpu_throttle_increment < 1 || - params->cpu_throttle_increment > 99)) { + if (params->cpu_throttle_increment < 1 || + params->cpu_throttle_increment > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); return false; } =20 - if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { + if (params->max_bandwidth > SIZE_MAX) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "max_bandwidth", "an integer in the range of 0 to "stringify(SIZE_MAX) @@ -1107,8 +1075,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return false; } =20 - if (params->has_avail_switchover_bandwidth && - (params->avail_switchover_bandwidth > SIZE_MAX)) { + if (params->avail_switchover_bandwidth > SIZE_MAX) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "avail_switchover_bandwidth", "an integer in the range of 0 to "stringify(SIZE_MAX) @@ -1116,8 +1083,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return false; } =20 - if (params->has_downtime_limit && - (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { + if (params->downtime_limit > MAX_MIGRATE_DOWNTIME) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "downtime_limit", "an integer in the range of 0 to " @@ -1127,92 +1093,82 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) =20 /* x_checkpoint_delay is now always positive */ =20 - if (params->has_multifd_channels && (params->multifd_channels < 1)) { + if (params->multifd_channels < 1) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_channels", "a value between 1 and 255"); return false; } =20 - if (params->has_multifd_zlib_level && - (params->multifd_zlib_level > 9)) { + if (params->multifd_zlib_level > 9) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", "a value between 0 and 9"); return false; } =20 - if (params->has_multifd_qatzip_level && - ((params->multifd_qatzip_level > 9) || - (params->multifd_qatzip_level < 1))) { + if (params->multifd_qatzip_level > 9 || + params->multifd_qatzip_level < 1) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_qatzip_lev= el", "a value between 1 and 9"); return false; } =20 - if (params->has_multifd_zstd_level && - (params->multifd_zstd_level > 20)) { + if (params->multifd_zstd_level > 20) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", "a value between 0 and 20"); return false; } =20 - if (params->has_xbzrle_cache_size && - (params->xbzrle_cache_size < qemu_target_page_size() || - !is_power_of_2(params->xbzrle_cache_size))) { + if (params->xbzrle_cache_size < qemu_target_page_size() || + !is_power_of_2(params->xbzrle_cache_size)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "xbzrle_cache_size", "a power of two no less than the target page size"); return false; } =20 - if (params->has_max_cpu_throttle && - (params->max_cpu_throttle < params->cpu_throttle_initial || - params->max_cpu_throttle > 99)) { + if (params->max_cpu_throttle < params->cpu_throttle_initial || + params->max_cpu_throttle > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "max_cpu_throttle", "an integer in the range of cpu_throttle_initial to 99"= ); return false; } =20 - if (params->has_announce_initial && - params->announce_initial > 100000) { + if (params->announce_initial > 100000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_initial", "a value between 0 and 100000"); return false; } - if (params->has_announce_max && - params->announce_max > 100000) { + if (params->announce_max > 100000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_max", "a value between 0 and 100000"); return false; } - if (params->has_announce_rounds && - params->announce_rounds > 1000) { + if (params->announce_rounds > 1000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_rounds", "a value between 0 and 1000"); return false; } - if (params->has_announce_step && - (params->announce_step < 1 || - params->announce_step > 10000)) { + if (params->announce_step < 1 || + params->announce_step > 10000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_step", "a value between 0 and 10000"); return false; } =20 - if (params->has_block_bitmap_mapping && - !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { + if (!check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); return false; } =20 #ifdef CONFIG_LINUX if (migrate_zero_copy_send() && - ((params->has_multifd_compression && params->multifd_compression) = || + (params->multifd_compression || (params->tls_creds && params->tls_creds->type =3D=3D QTYPE_QSTRIN= G && *params->tls_creds->u.s))) { error_setg(errp, @@ -1228,23 +1184,21 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) return false; } =20 - if (params->has_x_vcpu_dirty_limit_period && - (params->x_vcpu_dirty_limit_period < 1 || - params->x_vcpu_dirty_limit_period > 1000)) { + if (params->x_vcpu_dirty_limit_period < 1 || + params->x_vcpu_dirty_limit_period > 1000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "x-vcpu-dirty-limit-period", "a value between 1 and 1000"); return false; } =20 - if (params->has_vcpu_dirty_limit && - (params->vcpu_dirty_limit < 1)) { + if (params->vcpu_dirty_limit < 1) { error_setg(errp, "Parameter 'vcpu_dirty_limit' must be greater than 1 MB= /s"); return false; } =20 - if (params->has_direct_io && params->direct_io && !qemu_has_direct_io(= )) { + if (params->direct_io && !qemu_has_direct_io()) { error_setg(errp, "No build-time support for direct-io"); return false; } --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914892; cv=none; d=zohomail.com; s=zohoarc; b=Bg5HIz/1/WveRp3iMHGN1TBqhSiw/xIXzZ3DYe9pN0pz8sO5hkD35saZ8I213pYU2bOR4mq7YTz5zOm7kQcGDWLTIEqtAAdo8harezTSGdcj8QgCiz1a9NKZv7UEbg12nLw+rl0BJ50LqDKL2W7sBeRD18FYs1n6Ti623s+n/BM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914892; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1HSojfG//HAWlMfDLj1Grw57riRmTWe09NMmrKcaUY4=; b=KJnNuiyaPdairTp7wmT97uJRkxEpGKvNJcV2WYsvMFItYmubLx65TTyv5kY6kIKHhtSsGH0rwC/3VNT0T36+BwQcf4Ums71Jy7Q2XfNJf1HilYa+ZM/oMjPRy1ameVGofmwjVg95so13Wf4w3SIyal6SHgpWayXF7jYQ4/GZU8Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914892506816.2878488401512; Mon, 2 Jun 2025 18:41:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGc3-0006Ym-ML; Mon, 02 Jun 2025 21:38:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGc2-0006YX-64 for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:46 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGc0-0001Ua-KP for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:45 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2E50F1F441; Tue, 3 Jun 2025 01:38:29 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9550913700; Tue, 3 Jun 2025 01:38:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sBKCFRNSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914709; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1HSojfG//HAWlMfDLj1Grw57riRmTWe09NMmrKcaUY4=; b=U2M+sIoIfSxVH+7z+u169Y+sTLh1bWaA5edlTB2g5dTz2gmONZdrPjBjVww4mnw8VOT0aQ gfZWf0D94hLSykonmDBPxLcdj4LjpTlahPSmRktkR6iwKTOAmXUlhwD9pqJ444K03d2lvI JcCydiDfJtHRTWamf0paq/wXPUVEDeg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914709; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1HSojfG//HAWlMfDLj1Grw57riRmTWe09NMmrKcaUY4=; b=1ZIGDDxkAlCzhu26EqSnc+CbxmcxVtVFwBId1L+bw0Nhl0DtV9z8xlZTA32R5LeCIe22Qf AvTnRYebDcPHBdAQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914709; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1HSojfG//HAWlMfDLj1Grw57riRmTWe09NMmrKcaUY4=; b=U2M+sIoIfSxVH+7z+u169Y+sTLh1bWaA5edlTB2g5dTz2gmONZdrPjBjVww4mnw8VOT0aQ gfZWf0D94hLSykonmDBPxLcdj4LjpTlahPSmRktkR6iwKTOAmXUlhwD9pqJ444K03d2lvI JcCydiDfJtHRTWamf0paq/wXPUVEDeg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914709; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1HSojfG//HAWlMfDLj1Grw57riRmTWe09NMmrKcaUY4=; b=1ZIGDDxkAlCzhu26EqSnc+CbxmcxVtVFwBId1L+bw0Nhl0DtV9z8xlZTA32R5LeCIe22Qf AvTnRYebDcPHBdAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 07/21] migration: Set block_bitmap_mapping unconditionally in query-migrate-parameters Date: Mon, 2 Jun 2025 22:37:56 -0300 Message-Id: <20250603013810.4772-8-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914893209116600 Content-Type: text/plain; charset="utf-8" The response type of query-migrate-parameters is MigrationParameters, the members of which are marked as optional in migration.json. However, the design of query-migrate-parameters is that all members are to be non-optional. The optionality is an attempt at compatibility with MigrateSetParameters, which needs it to allow migrate-set-parameters to be given only a subset of parameters. To satisfy the design of query-migrate-parameters, the qmp_query_migrate_parameters function sets all (but one) has_* fields of MigrationParameters to true before returning. The block-bitmap-mapping parameter is instead set conditionally. This is incorrect. Since block-bitmap-mapping is allowed to be passed as input by the user as an empty list, technically the empty list value output in query-migrate-parameters has always been valid for that parameter. Make the parameter non-optional like the rest of MigrationParameters. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/migration-hmp-cmds.c | 36 ++++++++++++++++------------------ migration/options.c | 10 ++++------ 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index aacffdc532..685c8ebd53 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -240,6 +240,7 @@ void hmp_info_migrate_capabilities(Monitor *mon, const = QDict *qdict) void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) { MigrationParameters *params; + const BitmapMigrationNodeAliasList *bmnal; =20 params =3D qmp_query_migrate_parameters(NULL); =20 @@ -319,29 +320,26 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), params->tls_authz ? params->tls_authz->u.s : ""); =20 - if (params->has_block_bitmap_mapping) { - const BitmapMigrationNodeAliasList *bmnal; + assert(params->has_block_bitmap_mapping); + monitor_printf(mon, "%s:\n", + MigrationParameter_str( + MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); =20 - monitor_printf(mon, "%s:\n", - MigrationParameter_str( - MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); + for (bmnal =3D params->block_bitmap_mapping; + bmnal; + bmnal =3D bmnal->next) + { + const BitmapMigrationNodeAlias *bmna =3D bmnal->value; + const BitmapMigrationBitmapAliasList *bmbal; =20 - for (bmnal =3D params->block_bitmap_mapping; - bmnal; - bmnal =3D bmnal->next) - { - const BitmapMigrationNodeAlias *bmna =3D bmnal->value; - const BitmapMigrationBitmapAliasList *bmbal; + monitor_printf(mon, " '%s' -> '%s'\n", + bmna->node_name, bmna->alias); =20 - monitor_printf(mon, " '%s' -> '%s'\n", - bmna->node_name, bmna->alias); + for (bmbal =3D bmna->bitmaps; bmbal; bmbal =3D bmbal->next) { + const BitmapMigrationBitmapAlias *bmba =3D bmbal->value; =20 - for (bmbal =3D bmna->bitmaps; bmbal; bmbal =3D bmbal->next= ) { - const BitmapMigrationBitmapAlias *bmba =3D bmbal->valu= e; - - monitor_printf(mon, " '%s' -> '%s'\n", - bmba->name, bmba->alias); - } + monitor_printf(mon, " '%s' -> '%s'\n", + bmba->name, bmba->alias); } } =20 diff --git a/migration/options.c b/migration/options.c index d4021bc520..190001f8ac 100644 --- a/migration/options.c +++ b/migration/options.c @@ -989,12 +989,10 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) params->has_announce_step =3D true; params->announce_step =3D s->parameters.announce_step; =20 - if (s->has_block_bitmap_mapping) { - params->has_block_bitmap_mapping =3D true; - params->block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); - } + params->has_block_bitmap_mapping =3D true; + params->block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + s->parameters.block_bitmap_mapping); =20 params->has_x_vcpu_dirty_limit_period =3D true; params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914794; cv=none; d=zohomail.com; s=zohoarc; b=ORs/boRAks+zQw8I/DVCri84rULeNlLCsIisSBkijkVABPEf+f3EpLnMsx3pMqg6eFZBayCO/KQeD7CPaXbUwk5Fb6cLCv7KnyMco1JJeczMMct7sgeapr7fXWcgUEQGSPKjCR4dcxK30PdGAPgA1FbT2vUXw73mShl6eo1fAXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914794; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Kv5UzWIb24uq8YVYQbRsL4/GG/CRHmF3CMCDj5uIRS4=; b=f9Bp0FXGUEy6FAWb/C/WhwTqQL1MTifQSsM0Vel18OJHk53YevFvwlC4/CRBp9SiXzxeCFUywnRwPWpQVolitcniuqZJCqifkbiw7p18zjht1ZHqjrQUHYYXShuBQNGh+UfV2V4jL7VkbbfDkQks92BcFlFtRSnObTrE2tiKwuM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914794806965.232341914805; Mon, 2 Jun 2025 18:39:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcB-0006aF-04; Mon, 02 Jun 2025 21:38:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGc8-0006Ze-Pd for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:53 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGc6-0001Vr-RA for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:52 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 306051F452; Tue, 3 Jun 2025 01:38:31 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A107813700; Tue, 3 Jun 2025 01:38:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sMkTGBVSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914711; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kv5UzWIb24uq8YVYQbRsL4/GG/CRHmF3CMCDj5uIRS4=; b=utyzIyqrTYZ+7cj++yfOe8OPKaZcq4nVEJyfItRh3pOtLpwt4SFhIp/XVFN54iKtEoVvKH LaJunmgTjN5XtuIiFYvGVz5ACl0DLQ5QkFNw5Ay1Xc7fNcKfG+pcA8bWokT0IWkuGSsgjz Dc+dhjzT1EMnnxJD/OrVl9jA2L5V6GY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914711; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kv5UzWIb24uq8YVYQbRsL4/GG/CRHmF3CMCDj5uIRS4=; b=OXihunDGRGFz0/AwVw9HTShTRfIA0wTndUXYKkRl12X+Nnq/CjhvWG9Q1GCGB38eyvID19 PXXNnGM2nHrvMpAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=utyzIyqr; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=OXihunDG DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914711; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kv5UzWIb24uq8YVYQbRsL4/GG/CRHmF3CMCDj5uIRS4=; b=utyzIyqrTYZ+7cj++yfOe8OPKaZcq4nVEJyfItRh3pOtLpwt4SFhIp/XVFN54iKtEoVvKH LaJunmgTjN5XtuIiFYvGVz5ACl0DLQ5QkFNw5Ay1Xc7fNcKfG+pcA8bWokT0IWkuGSsgjz Dc+dhjzT1EMnnxJD/OrVl9jA2L5V6GY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914711; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kv5UzWIb24uq8YVYQbRsL4/GG/CRHmF3CMCDj5uIRS4=; b=OXihunDGRGFz0/AwVw9HTShTRfIA0wTndUXYKkRl12X+Nnq/CjhvWG9Q1GCGB38eyvID19 PXXNnGM2nHrvMpAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 08/21] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Date: Mon, 2 Jun 2025 22:37:57 -0300 Message-Id: <20250603013810.4772-9-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: 306051F452 X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914795960116600 Content-Type: text/plain; charset="utf-8" The QERR_INVALID_PARAMETER_VALUE macro is documented as not to be used in new code. Remove the usage from migration/options.c. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Tested-by: Mario Casquero --- migration/migration.c | 3 +-- migration/options.c | 56 +++++++++++++++--------------------------- migration/page_cache.c | 6 ++--- migration/ram.c | 3 +-- 4 files changed, 24 insertions(+), 44 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 45e15ffeb6..031a5f8ede 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2302,8 +2302,7 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { file_start_outgoing_migration(s, &addr->u.file, &local_err); } else { - error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", - "a valid migration protocol"); + error_setg(&local_err, "uri is not a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); } diff --git a/migration/options.c b/migration/options.c index 190001f8ac..e2e3ab717f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1043,120 +1043,105 @@ bool migrate_params_check(MigrationParameters *pa= rams, Error **errp) =20 if (params->throttle_trigger_threshold < 1 || params->throttle_trigger_threshold > 100) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "throttle_trigger_threshold", + error_setg(errp, "Option throttle_trigger_threshold expects " "an integer in the range of 1 to 100"); return false; } =20 if (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_initial", + error_setg(errp, "Option cpu_throttle_initial expects " "an integer in the range of 1 to 99"); return false; } =20 if (params->cpu_throttle_increment < 1 || params->cpu_throttle_increment > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_increment", + error_setg(errp, "Option cpu_throttle_increment expects " "an integer in the range of 1 to 99"); return false; } =20 if (params->max_bandwidth > SIZE_MAX) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_bandwidth", + error_setg(errp, "Option max_bandwidth expects " "an integer in the range of 0 to "stringify(SIZE_MAX) " bytes/second"); return false; } =20 if (params->avail_switchover_bandwidth > SIZE_MAX) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "avail_switchover_bandwidth", + error_setg(errp, "Option avail_switchover_bandwidth expects " "an integer in the range of 0 to "stringify(SIZE_MAX) " bytes/second"); return false; } =20 if (params->downtime_limit > MAX_MIGRATE_DOWNTIME) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "downtime_limit", + error_setg(errp, "Option downtime_limit expects " "an integer in the range of 0 to " stringify(MAX_MIGRATE_DOWNTIME)" ms"); return false; } =20 - /* x_checkpoint_delay is now always positive */ - if (params->multifd_channels < 1) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_channels", + error_setg(errp, "Option multifd_channels expects " "a value between 1 and 255"); return false; } =20 if (params->multifd_zlib_level > 9) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", + error_setg(errp, "Option multifd_zlib_level expects " "a value between 0 and 9"); return false; } =20 if (params->multifd_qatzip_level > 9 || params->multifd_qatzip_level < 1) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_qatzip_lev= el", + error_setg(errp, "Option multifd_qatzip_level expects " "a value between 1 and 9"); return false; } =20 if (params->multifd_zstd_level > 20) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", + error_setg(errp, "Option multifd_zstd_level expects " "a value between 0 and 20"); return false; } =20 if (params->xbzrle_cache_size < qemu_target_page_size() || !is_power_of_2(params->xbzrle_cache_size)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "xbzrle_cache_size", + error_setg(errp, "Option xbzrle_cache_size expects " "a power of two no less than the target page size"); return false; } =20 if (params->max_cpu_throttle < params->cpu_throttle_initial || params->max_cpu_throttle > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_cpu_throttle", + error_setg(errp, "max_Option cpu_throttle expects " "an integer in the range of cpu_throttle_initial to 99"= ); return false; } =20 if (params->announce_initial > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_initial", + error_setg(errp, "Option announce_initial expects " "a value between 0 and 100000"); return false; } if (params->announce_max > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_max", + error_setg(errp, "Option announce_max expects " "a value between 0 and 100000"); - return false; + return false; } if (params->announce_rounds > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_rounds", + error_setg(errp, "Option announce_rounds expects " "a value between 0 and 1000"); - return false; + return false; } if (params->announce_step < 1 || params->announce_step > 10000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_step", + error_setg(errp, "Option announce_step expects " "a value between 0 and 10000"); - return false; + return false; } =20 if (!check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { @@ -1184,8 +1169,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) =20 if (params->x_vcpu_dirty_limit_period < 1 || params->x_vcpu_dirty_limit_period > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "x-vcpu-dirty-limit-period", + error_setg(errp, "Option x-vcpu-dirty-limit-period expects " "a value between 1 and 1000"); return false; } diff --git a/migration/page_cache.c b/migration/page_cache.c index 6d4f7a9bbc..650b15e48c 100644 --- a/migration/page_cache.c +++ b/migration/page_cache.c @@ -45,15 +45,13 @@ PageCache *cache_init(uint64_t new_size, size_t page_si= ze, Error **errp) PageCache *cache; =20 if (new_size < page_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "is smaller than one target page size"); + error_setg(errp, "cache size is smaller than target page size"); return NULL; } =20 /* round down to the nearest power of 2 */ if (!is_power_of_2(num_pages)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "is not a power of two number of pages"); + error_setg(errp, "number of pages is not a power of two"); return NULL; } =20 diff --git a/migration/ram.c b/migration/ram.c index 22e462bf72..028358ef0d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -191,8 +191,7 @@ int xbzrle_cache_resize(uint64_t new_size, Error **errp) =20 /* Check for truncation */ if (new_size !=3D (size_t)new_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "exceeding address space"); + error_setg(errp, "xbzrle cache size integer overflow"); return -1; } =20 --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914862; cv=none; d=zohomail.com; s=zohoarc; b=ZJISgGZWiz2YqDQM80vbptCgg1jDCqdyGfZAzT2O11oxgymF66wJBTTFmJSX08HyZJTh+8PvO+0BMHFJK6n+GLakUeQQ0kgSk05bO/Rtx/+Q7y+oJfnBk5kw4tn0QxFU2r1BBiRBegktng7pYZcXZGfskUSazOzJMn1Jms94wcc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914862; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EHnx5M5HxA90aoDKwj6ABbbajp1kkSlJooZkthwqkIY=; b=EBbMECLNbBg1NUuvv9TJtijMQW5nJr7gc9jYczyrvILekZw/NCMQJR8clnv4gmF+vWwkNOIFpfaiX85tabYaOqLbBNtxH0BXUBDFnIYRFvm4hMZazXWdemh0YlxXc8Iqc6U1I+0am/3GStZH1meFtwWSweYM4oNMAiLE9ile+uc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914862093377.69766769556793; Mon, 2 Jun 2025 18:41:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGbv-0006TP-K5; Mon, 02 Jun 2025 21:38:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGbt-0006SG-87 for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:37 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGbr-0001So-Av for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:36 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3483121201; Tue, 3 Jun 2025 01:38:33 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A6FE713700; Tue, 3 Jun 2025 01:38:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UCPSGRdSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EHnx5M5HxA90aoDKwj6ABbbajp1kkSlJooZkthwqkIY=; b=F4CxUiWkg1oKD9yO5xwUYgAMEcJimJAPfnD3j4LqY+R3RGLRk3PYVUkR/ySWwkmza6O2UT Mk5b7v+gM4RpaMKEMOs4ophGh11t4fAr5mq5O0MphaIwyP5f85ZzHE3eHvLqAoHRPDZWhQ h8twYAoJ8SxYpY5662rl/WxK5V8n1aI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EHnx5M5HxA90aoDKwj6ABbbajp1kkSlJooZkthwqkIY=; b=jb69BCnAO0IPp1HCEwA53sLXWrLf4EbrneiCq1cNhCvTOZCMvHi1AEHkqjdeCB2TZlRlH0 dSe76+HPXWaNTQAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=F4CxUiWk; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=jb69BCnA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EHnx5M5HxA90aoDKwj6ABbbajp1kkSlJooZkthwqkIY=; b=F4CxUiWkg1oKD9yO5xwUYgAMEcJimJAPfnD3j4LqY+R3RGLRk3PYVUkR/ySWwkmza6O2UT Mk5b7v+gM4RpaMKEMOs4ophGh11t4fAr5mq5O0MphaIwyP5f85ZzHE3eHvLqAoHRPDZWhQ h8twYAoJ8SxYpY5662rl/WxK5V8n1aI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EHnx5M5HxA90aoDKwj6ABbbajp1kkSlJooZkthwqkIY=; b=jb69BCnAO0IPp1HCEwA53sLXWrLf4EbrneiCq1cNhCvTOZCMvHi1AEHkqjdeCB2TZlRlH0 dSe76+HPXWaNTQAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 09/21] migration: Extract code to mark all parameters as present Date: Mon, 2 Jun 2025 22:37:58 -0300 Message-Id: <20250603013810.4772-10-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 3483121201 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914862830116600 Content-Type: text/plain; charset="utf-8" MigrationParameters needs to have all of its has_* fields marked as true when used as the return of query_migrate_parameters because the corresponding QMP command has all of its members non-optional by design, despite them being marked as optional in migration.json. Extract this code into a function and make it assert if any field is missing. With this we ensure future changes will not inadvertently leave any parameters missing. Also assert that s->parameters _does not_ have any of its has_* fields set. This structure is internal to the migration code and it should not rely on the QAPI-generate has_* fields. We might want to store migration parameters differently in the future. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/options.c | 74 ++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/migration/options.c b/migration/options.c index e2e3ab717f..dd62e726cb 100644 --- a/migration/options.c +++ b/migration/options.c @@ -936,6 +936,40 @@ static void tls_option_set_str(StrOrNull **dstp, StrOr= Null *src) } } =20 +static void migrate_mark_all_params_present(MigrationParameters *p) +{ + int len, n_str_args =3D 3; /* tls-creds, tls-hostname, tls-authz */ + bool *has_fields[] =3D { + &p->has_throttle_trigger_threshold, &p->has_cpu_throttle_initial, + &p->has_cpu_throttle_increment, &p->has_cpu_throttle_tailslow, + &p->has_max_bandwidth, &p->has_avail_switchover_bandwidth, + &p->has_downtime_limit, &p->has_x_checkpoint_delay, + &p->has_multifd_channels, &p->has_multifd_compression, + &p->has_multifd_zlib_level, &p->has_multifd_qatzip_level, + &p->has_multifd_zstd_level, &p->has_xbzrle_cache_size, + &p->has_max_postcopy_bandwidth, &p->has_max_cpu_throttle, + &p->has_announce_initial, &p->has_announce_max, &p->has_announce_r= ounds, + &p->has_announce_step, &p->has_block_bitmap_mapping, + &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, + &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, + }; + + /* + * The has_* fields of MigrationParameters are used by QAPI to + * inform whether an optional struct member is present. Keep this + * decoupled from the internal usage (not QAPI) by leaving the + * has_* fields of s->parameters unused. + */ + assert(p !=3D &(migrate_get_current())->parameters); + + len =3D ARRAY_SIZE(has_fields); + assert(len + n_str_args =3D=3D MIGRATION_PARAMETER__MAX); + + for (int i =3D 0; i < len; i++) { + *has_fields[i] =3D true; + } +} + MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; @@ -943,68 +977,52 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 /* TODO use QAPI_CLONE() instead of duplicating it inline */ params =3D g_malloc0(sizeof(*params)); - params->has_throttle_trigger_threshold =3D true; + params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; - params->has_cpu_throttle_initial =3D true; params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; - params->has_cpu_throttle_increment =3D true; params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; - params->has_cpu_throttle_tailslow =3D true; params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; =20 tls_option_set_str(¶ms->tls_creds, s->parameters.tls_creds); tls_option_set_str(¶ms->tls_hostname, s->parameters.tls_hostname); tls_option_set_str(¶ms->tls_authz, s->parameters.tls_authz); =20 - params->has_max_bandwidth =3D true; params->max_bandwidth =3D s->parameters.max_bandwidth; - params->has_avail_switchover_bandwidth =3D true; params->avail_switchover_bandwidth =3D s->parameters.avail_switchover_= bandwidth; - params->has_downtime_limit =3D true; params->downtime_limit =3D s->parameters.downtime_limit; - params->has_x_checkpoint_delay =3D true; params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; - params->has_multifd_channels =3D true; params->multifd_channels =3D s->parameters.multifd_channels; - params->has_multifd_compression =3D true; params->multifd_compression =3D s->parameters.multifd_compression; - params->has_multifd_zlib_level =3D true; params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; - params->has_multifd_qatzip_level =3D true; params->multifd_qatzip_level =3D s->parameters.multifd_qatzip_level; - params->has_multifd_zstd_level =3D true; params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; - params->has_xbzrle_cache_size =3D true; params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; - params->has_max_postcopy_bandwidth =3D true; params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; - params->has_max_cpu_throttle =3D true; params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; - params->has_announce_initial =3D true; params->announce_initial =3D s->parameters.announce_initial; - params->has_announce_max =3D true; params->announce_max =3D s->parameters.announce_max; - params->has_announce_rounds =3D true; params->announce_rounds =3D s->parameters.announce_rounds; - params->has_announce_step =3D true; params->announce_step =3D s->parameters.announce_step; - - params->has_block_bitmap_mapping =3D true; params->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, s->parameters.block_bitmap_mapping); - - params->has_x_vcpu_dirty_limit_period =3D true; params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; - params->has_vcpu_dirty_limit =3D true; params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; - params->has_mode =3D true; params->mode =3D s->parameters.mode; - params->has_zero_page_detection =3D true; params->zero_page_detection =3D s->parameters.zero_page_detection; - params->has_direct_io =3D true; params->direct_io =3D s->parameters.direct_io; =20 + /* + * query-migrate-parameters expects all members of + * MigrationParameters to be present, but we cannot mark them + * non-optional in QAPI because the structure is also used for + * migrate-set-parameters, which needs the optionality. Force all + * parameters to be seen as present now. Note that this depends on + * some form of default being set for every member of + * MigrationParameters, currently done during qdev init using + * migration_properties defined in this file. + */ + migrate_mark_all_params_present(params); return params; } =20 --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914778; cv=none; d=zohomail.com; s=zohoarc; b=Gc+v5cHi9lAs9czervxwJw/AxEu6diwtwPKhBRkChFEdvQHzPTC7qqyf9AanlVVygafyLoXoxAzaOaQILjMosKnunH8UL+hNg3XeYBzOyvoD8pjvHR3JhsodSo0Fkj/68Oz8rRKuv0EVXxcAc7pZcFgJOgOLgKIFpuOSM39nf38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914778; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UVPvDwK/cwUWk0r7xb0UxvXzlrJhpqrz5XX83nElAXM=; b=ibjc5M6tLJl0seCUnwMenzaTYCjr+kkpYiSMda6xECtEI4oGeb6TMndBCLuxH69lIMrRr/NMyWR3ZiU/o0Qd0V0WLohn8Mgvuq5B8UViSYgTr0kkcfQmP6o4sKwo5pXGoJHmqBf6VvJ0HGQN2PQ/OUwJwWikLaKCtfsB0vCgihc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914778325393.0907411742853; Mon, 2 Jun 2025 18:39:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcF-0006if-La; Mon, 02 Jun 2025 21:38:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcE-0006iN-GB for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:58 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcC-0001X7-Tm for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:58 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 382711F38D; Tue, 3 Jun 2025 01:38:35 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A9F0E13700; Tue, 3 Jun 2025 01:38:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EMuWGhlSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914715; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UVPvDwK/cwUWk0r7xb0UxvXzlrJhpqrz5XX83nElAXM=; b=jnKjGrGZagbFm+6WYykb7JCftwF8GSvfK3gJw+H4DmiNP/PeHI6X3l+SCyap+Q+v1BROTf BSwHhXD4UKQdPDn1VVt3EaOeRNZ8DADwiQOG12xIgvtJFn7Lh/hiBJnWuenmt/CSRYbJg1 NLBXs2k5xnVCYyEJSkVVxMfNUN0Ndrc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914715; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UVPvDwK/cwUWk0r7xb0UxvXzlrJhpqrz5XX83nElAXM=; b=r+0e6nUmC3UvfopI8WjL3JdoUDWXJj08M7+5kFryASZdoAWtM3EfYO93eAfnt4oSjD0xfL X/gqTr8BqQLOuZCw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=jnKjGrGZ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=r+0e6nUm DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914715; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UVPvDwK/cwUWk0r7xb0UxvXzlrJhpqrz5XX83nElAXM=; b=jnKjGrGZagbFm+6WYykb7JCftwF8GSvfK3gJw+H4DmiNP/PeHI6X3l+SCyap+Q+v1BROTf BSwHhXD4UKQdPDn1VVt3EaOeRNZ8DADwiQOG12xIgvtJFn7Lh/hiBJnWuenmt/CSRYbJg1 NLBXs2k5xnVCYyEJSkVVxMfNUN0Ndrc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914715; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UVPvDwK/cwUWk0r7xb0UxvXzlrJhpqrz5XX83nElAXM=; b=r+0e6nUmC3UvfopI8WjL3JdoUDWXJj08M7+5kFryASZdoAWtM3EfYO93eAfnt4oSjD0xfL X/gqTr8BqQLOuZCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 10/21] migration: Use QAPI_CLONE_MEMBERS in query_migrate_parameters Date: Mon, 2 Jun 2025 22:37:59 -0300 Message-Id: <20250603013810.4772-11-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: 382711F38D X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914779718116600 Content-Type: text/plain; charset="utf-8" QAPI_CLONE_MEMBERS is a better option than copying parameters one by one because it operates on the entire struct and follows pointers. It also avoids the need to alter this function every time a new parameter is added. Note, since this is a deep clone, now we must free the TLS strings before assignment. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/options.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/migration/options.c b/migration/options.c index dd62e726cb..0a2a3050ec 100644 --- a/migration/options.c +++ b/migration/options.c @@ -918,7 +918,9 @@ static void tls_option_set_str(StrOrNull **dstp, StrOrN= ull *src) { StrOrNull *dst =3D *dstp; =20 - assert(!dst); + if (dst) { + qapi_free_StrOrNull(dst); + } =20 dst =3D *dstp =3D g_new0(StrOrNull, 1); dst->type =3D QTYPE_QSTRING; @@ -975,42 +977,17 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) MigrationParameters *params; MigrationState *s =3D migrate_get_current(); =20 - /* TODO use QAPI_CLONE() instead of duplicating it inline */ params =3D g_malloc0(sizeof(*params)); =20 - params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; - params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; - params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; - params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; + QAPI_CLONE_MEMBERS(MigrationParameters, params, &s->parameters); =20 tls_option_set_str(¶ms->tls_creds, s->parameters.tls_creds); tls_option_set_str(¶ms->tls_hostname, s->parameters.tls_hostname); tls_option_set_str(¶ms->tls_authz, s->parameters.tls_authz); =20 - params->max_bandwidth =3D s->parameters.max_bandwidth; - params->avail_switchover_bandwidth =3D s->parameters.avail_switchover_= bandwidth; - params->downtime_limit =3D s->parameters.downtime_limit; - params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; - params->multifd_channels =3D s->parameters.multifd_channels; - params->multifd_compression =3D s->parameters.multifd_compression; - params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; - params->multifd_qatzip_level =3D s->parameters.multifd_qatzip_level; - params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; - params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; - params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; - params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; - params->announce_initial =3D s->parameters.announce_initial; - params->announce_max =3D s->parameters.announce_max; - params->announce_rounds =3D s->parameters.announce_rounds; - params->announce_step =3D s->parameters.announce_step; params->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, s->parameters.block_bitmap_mapping); - params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; - params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; - params->mode =3D s->parameters.mode; - params->zero_page_detection =3D s->parameters.zero_page_detection; - params->direct_io =3D s->parameters.direct_io; =20 /* * query-migrate-parameters expects all members of --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914805; cv=none; d=zohomail.com; s=zohoarc; b=DVQRycmX4eAHhupvCtVpPg/yPCmCtI5KhQA8hH1T7SEg+1lTg/piF4qwgr++KHg7RWUtVs3wgWwPIKxU7JOgbt8PXS63u28DqNlusgYFatcW2JHQe3AP2QpzL7WX6Ct3gYblX726qJPhj+Z6uvBylYWB/3jPWKNh+7l5muUn5No= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914805; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rXxUO4VhMzXX59uYuhoKrhuKn8G6BCv3FLIVeTsxJsc=; b=HuN68HgJnqd1XYtYXBBGZf9b4/ID+fAYYb7PAzmQclxEc6JqPsxtnbM5L+2Qus+5u4p/LbnxljTDLdYfss42fkz/HGv2ge5nJZ2oQICaT4wlaP5vz4J837HjoOFLjV9iIIR2d9cRFccT/h2t1QqZBIQxSHfvosqlchgKZpMYl5o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914805883295.6077569909195; Mon, 2 Jun 2025 18:40:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGc1-0006Xm-4f; Mon, 02 Jun 2025 21:38:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGby-0006WI-Mn for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:42 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGbx-0001To-3Q for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:42 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3BCB321201; Tue, 3 Jun 2025 01:38:37 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id AE3CE13700; Tue, 3 Jun 2025 01:38:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +G+LGxtSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914717; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXxUO4VhMzXX59uYuhoKrhuKn8G6BCv3FLIVeTsxJsc=; b=j1HCwB4RoqoGdAYmSbWg4oqxbGlMIMSKc/eyoods3WCzn33cPAYo0MPMjvtJ5/PhbxSXRL JWTY/o4IDrTPBs6hkAnihIWTxB3gfgXWHteEvvo7ktPZHelDGrfQn05IatAm3P6lhbWbwD LGkoYR42PT6ADW/GE+9aezokwOmVeEE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914717; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXxUO4VhMzXX59uYuhoKrhuKn8G6BCv3FLIVeTsxJsc=; b=emrWaQoI/fas8CAHhVnLVA8apLz3GSsE6KQTvKrCJG4HA9oZ5s5aqV0O+9ZIP14ez6AmIP JML/ySaQqzmwyKBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914717; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXxUO4VhMzXX59uYuhoKrhuKn8G6BCv3FLIVeTsxJsc=; b=j1HCwB4RoqoGdAYmSbWg4oqxbGlMIMSKc/eyoods3WCzn33cPAYo0MPMjvtJ5/PhbxSXRL JWTY/o4IDrTPBs6hkAnihIWTxB3gfgXWHteEvvo7ktPZHelDGrfQn05IatAm3P6lhbWbwD LGkoYR42PT6ADW/GE+9aezokwOmVeEE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914717; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXxUO4VhMzXX59uYuhoKrhuKn8G6BCv3FLIVeTsxJsc=; b=emrWaQoI/fas8CAHhVnLVA8apLz3GSsE6KQTvKrCJG4HA9oZ5s5aqV0O+9ZIP14ez6AmIP JML/ySaQqzmwyKBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 11/21] migration: Use QAPI_CLONE_MEMBERS in migrate_params_test_apply Date: Mon, 2 Jun 2025 22:38:00 -0300 Message-Id: <20250603013810.4772-12-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914808015116600 Content-Type: text/plain; charset="utf-8" Use QAPI_CLONE_MEMBERS instead of making an assignment. The QAPI method makes the handling of the TLS strings more intuitive because it clones them as well. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/options.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/migration/options.c b/migration/options.c index 0a2a3050ec..4453933c4c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1186,9 +1186,9 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) static void migrate_params_test_apply(MigrationParameters *params, MigrationParameters *dest) { - *dest =3D migrate_get_current()->parameters; + MigrationState *s =3D migrate_get_current(); =20 - /* TODO use QAPI_CLONE() instead of duplicating it inline */ + QAPI_CLONE_MEMBERS(MigrationParameters, dest, &s->parameters); =20 if (params->has_throttle_trigger_threshold) { dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; @@ -1208,23 +1208,14 @@ static void migrate_params_test_apply(MigrationPara= meters *params, =20 if (params->tls_creds) { tls_option_set_str(&dest->tls_creds, params->tls_creds); - } else { - /* drop the reference, it's owned by s->parameters */ - dest->tls_creds =3D NULL; } =20 if (params->tls_hostname) { tls_option_set_str(&dest->tls_hostname, params->tls_hostname); - } else { - /* drop the reference, it's owned by s->parameters */ - dest->tls_hostname =3D NULL; } =20 if (params->tls_authz) { tls_option_set_str(&dest->tls_authz, params->tls_authz); - } else { - /* drop the reference, it's owned by s->parameters */ - dest->tls_authz =3D NULL; } =20 if (params->has_max_bandwidth) { @@ -1281,7 +1272,6 @@ static void migrate_params_test_apply(MigrationParame= ters *params, } =20 if (params->has_block_bitmap_mapping) { - dest->has_block_bitmap_mapping =3D true; dest->block_bitmap_mapping =3D params->block_bitmap_mapping; } =20 @@ -1433,6 +1423,14 @@ void qmp_migrate_set_parameters(MigrationParameters = *params, Error **errp) =20 migrate_params_test_apply(params, &tmp); =20 + /* + * Mark block_bitmap_mapping as present now while we have the + * params structure with the user input around. + */ + if (params->has_block_bitmap_mapping) { + migrate_get_current()->has_block_bitmap_mapping =3D true; + } + if (migrate_params_check(&tmp, errp)) { migrate_params_apply(params); migrate_post_update_params(params, errp); --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914755; cv=none; d=zohomail.com; s=zohoarc; b=bmVY6M8QjnAzN4LwaUjCOtnV8L0jKlfg6sNrGgN0Jmz8s12hDPcgruDADENf55mD8u2WA4ccgmP98RrU3SivN36wMMNE/O2o5jRzS3XRn6Ws/rbfKVhl/JwoD1UKNuK0fIsqc77We1629xRDDo7FqclNLn0s2VL2llzqyEMPpYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914755; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9TLW7YZUYD3GOzE+ke98V+QSleNCcRF8eNr5e1MWulE=; b=LoxUE+kaPihJcnG90T6Wm7iTnhlt8OnG/ync0FVdi5sdiPw/oRgRt/K4hX32/g0Be5U5uw7/uql82t3rI+KmSJperikRvvh6dh3em/9iSj0QVQ95mwmhf2DGTXBpadxwN61qlr80S5KEX0va3GIKSrQT3CWJHY3OWrGXx/r611M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914755726370.5779077014064; Mon, 2 Jun 2025 18:39:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGc5-0006ZB-O6; Mon, 02 Jun 2025 21:38:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGc4-0006Yz-G3 for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:48 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGc2-0001Uw-JX for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:48 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 43DE0218A3; Tue, 3 Jun 2025 01:38:39 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B333813700; Tue, 3 Jun 2025 01:38:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ABm2HB1SPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914719; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9TLW7YZUYD3GOzE+ke98V+QSleNCcRF8eNr5e1MWulE=; b=TUc9ZQ1EXha7KKTQf+DLz8tZ2pNKsy08qy63j8xQ72XeoDXcHwBkLFi2Nag048JYphdRAL BXGtyZ3E1UjukCN/WCm1APB3s3ZDlh37DYTHZv+QyMIrbDZwPOXgXfQw+JWhP+kyCsPgRy nH4FIseux1Bk7qrlH5a6viDMarzsEfo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914719; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9TLW7YZUYD3GOzE+ke98V+QSleNCcRF8eNr5e1MWulE=; b=Kl6CFC8bYxo4V/Hp3A9MzVmj69DpUQ7AnPxYsLph24ix1BFZ22sQNtAg7tnELHZeM3A93V CFZl3vkH+ta02wDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=TUc9ZQ1E; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Kl6CFC8b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914719; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9TLW7YZUYD3GOzE+ke98V+QSleNCcRF8eNr5e1MWulE=; b=TUc9ZQ1EXha7KKTQf+DLz8tZ2pNKsy08qy63j8xQ72XeoDXcHwBkLFi2Nag048JYphdRAL BXGtyZ3E1UjukCN/WCm1APB3s3ZDlh37DYTHZv+QyMIrbDZwPOXgXfQw+JWhP+kyCsPgRy nH4FIseux1Bk7qrlH5a6viDMarzsEfo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914719; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9TLW7YZUYD3GOzE+ke98V+QSleNCcRF8eNr5e1MWulE=; b=Kl6CFC8bYxo4V/Hp3A9MzVmj69DpUQ7AnPxYsLph24ix1BFZ22sQNtAg7tnELHZeM3A93V CFZl3vkH+ta02wDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 12/21] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Date: Mon, 2 Jun 2025 22:38:01 -0300 Message-Id: <20250603013810.4772-13-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: 43DE0218A3 X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914757482116600 Content-Type: text/plain; charset="utf-8" Instead of setting parameters one by one, use the temporary object, which already contains the current migration parameters plus the new ones and was just validated by migration_params_check(). Use cloning to overwrite it. This avoids the need to alter this function every time a new parameter is added. Note that s->parameters is part of MigrationState, so it doesn't require freeing, but the TLS strings do. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/options.c | 122 ++++---------------------------------------- 1 file changed, 9 insertions(+), 113 deletions(-) diff --git a/migration/options.c b/migration/options.c index 4453933c4c..27b5f549f9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qemu/main-loop.h" #include "exec/target_page.h" #include "qapi/clone-visitor.h" #include "qapi/error.h" @@ -1299,122 +1300,17 @@ static void migrate_params_test_apply(MigrationPar= ameters *params, static void migrate_params_apply(MigrationParameters *params) { MigrationState *s =3D migrate_get_current(); + MigrationParameters *cur =3D &s->parameters; =20 - /* TODO use QAPI_CLONE() instead of duplicating it inline */ + assert(bql_locked()); =20 - if (params->has_throttle_trigger_threshold) { - s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; - } + migrate_tls_opts_free(cur); + qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); =20 - if (params->has_cpu_throttle_initial) { - s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; - } + QAPI_CLONE_MEMBERS(MigrationParameters, cur, params); =20 - if (params->has_cpu_throttle_increment) { - s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; - } - - if (params->has_cpu_throttle_tailslow) { - s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; - } - - if (params->tls_creds) { - qapi_free_StrOrNull(s->parameters.tls_creds); - tls_option_set_str(&s->parameters.tls_creds, params->tls_creds); - } - - if (params->tls_hostname) { - qapi_free_StrOrNull(s->parameters.tls_hostname); - tls_option_set_str(&s->parameters.tls_hostname, params->tls_hostna= me); - } - - if (params->tls_authz) { - qapi_free_StrOrNull(s->parameters.tls_authz); - tls_option_set_str(&s->parameters.tls_authz, params->tls_authz); - } - - if (params->has_max_bandwidth) { - s->parameters.max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_avail_switchover_bandwidth) { - s->parameters.avail_switchover_bandwidth =3D params->avail_switcho= ver_bandwidth; - } - - if (params->has_downtime_limit) { - s->parameters.downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_multifd_channels) { - s->parameters.multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - s->parameters.multifd_compression =3D params->multifd_compression; - } - if (params->has_multifd_qatzip_level) { - s->parameters.multifd_qatzip_level =3D params->multifd_qatzip_leve= l; - } - if (params->has_multifd_zlib_level) { - s->parameters.multifd_zlib_level =3D params->multifd_zlib_level; - } - if (params->has_multifd_zstd_level) { - s->parameters.multifd_zstd_level =3D params->multifd_zstd_level; - } - if (params->has_xbzrle_cache_size) { - s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - } - if (params->has_max_postcopy_bandwidth) { - s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - } - if (params->has_max_cpu_throttle) { - s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - s->parameters.announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - s->parameters.announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - s->parameters.announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - s->parameters.announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - qapi_free_BitmapMigrationNodeAliasList( - s->parameters.block_bitmap_mapping); - - s->has_block_bitmap_mapping =3D true; - s->parameters.block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - params->block_bitmap_mapping); - } - - if (params->has_x_vcpu_dirty_limit_period) { - s->parameters.x_vcpu_dirty_limit_period =3D - params->x_vcpu_dirty_limit_period; - } - if (params->has_vcpu_dirty_limit) { - s->parameters.vcpu_dirty_limit =3D params->vcpu_dirty_limit; - } - - if (params->has_mode) { - s->parameters.mode =3D params->mode; - } - - if (params->has_zero_page_detection) { - s->parameters.zero_page_detection =3D params->zero_page_detection; - } - - if (params->has_direct_io) { - s->parameters.direct_io =3D params->direct_io; - } + cur->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, + params->block_bitmap_mapping); } =20 void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) @@ -1432,7 +1328,7 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) } =20 if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(params); + migrate_params_apply(&tmp); migrate_post_update_params(params, errp); } =20 --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914770; cv=none; d=zohomail.com; s=zohoarc; b=Lf/EtMp6EhLCK9E6WFeeblQYqS/ydUi2GZ7wWHz5FZy9v4CDoWqNMvAwrv37upMuO3ink3w8T97JN1tvHYyIdZJLn4QatsfYCDn2o5G0qYDW9d0WYLdBAuNLbi8+kXzehtxdRdTHJeG0wg+EKKHoaj+opsmtGPYT/jHgVvoTyLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914770; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7mgq3Nz6Cs/i/2dv8VCv+yMPeRGuaJeqkTVyNzmqY+0=; b=LaMVGnxi1OYfbsQ0UWl3GRJVfHDVe8RWmq3GRtq/NYCFbok6tnmJqaRViyLg9q0UECgWtRl/OviT6BNo2SA8M7y9ow18+RVcneJJXnvASIHYR1LKvWRaPja/5oRSVUvyS56+F+bw+kOtc06AWcZO9LdKv0EDOLYuWOq11P3xzVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914770599329.57226801940953; Mon, 2 Jun 2025 18:39:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcB-0006dO-Bl; Mon, 02 Jun 2025 21:38:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGc9-0006Zn-Us for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:54 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGc8-0001W8-75 for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:53 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 488B7218E0; Tue, 3 Jun 2025 01:38:41 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BAAC213700; Tue, 3 Jun 2025 01:38:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QLupHh9SPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914721; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7mgq3Nz6Cs/i/2dv8VCv+yMPeRGuaJeqkTVyNzmqY+0=; b=tSVZjrFVs9J7+DovTL0mM+obJxEUjOJgd1r8oGqzV8TG0OLMsZ4rqxzu+RahDyKcq9PrwF P+i+2AzZB57C9YMyx43dfPg3hBb13QKUDhgOe7J+8EPGjY7biO35ZW7t1S1RNODxqAcZWp ocr3252NbumMNb2+cAAaSmgOp6zQ8n8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914721; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7mgq3Nz6Cs/i/2dv8VCv+yMPeRGuaJeqkTVyNzmqY+0=; b=7ul6BJNFBSN4fi3VpSzDy9ZCOiPyu9fonE+qIizr1Sm4PimqQntYBBhlvCtC76a8g17lyV +XGFlahMJ8MEPfDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914721; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7mgq3Nz6Cs/i/2dv8VCv+yMPeRGuaJeqkTVyNzmqY+0=; b=tSVZjrFVs9J7+DovTL0mM+obJxEUjOJgd1r8oGqzV8TG0OLMsZ4rqxzu+RahDyKcq9PrwF P+i+2AzZB57C9YMyx43dfPg3hBb13QKUDhgOe7J+8EPGjY7biO35ZW7t1S1RNODxqAcZWp ocr3252NbumMNb2+cAAaSmgOp6zQ8n8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914721; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7mgq3Nz6Cs/i/2dv8VCv+yMPeRGuaJeqkTVyNzmqY+0=; b=7ul6BJNFBSN4fi3VpSzDy9ZCOiPyu9fonE+qIizr1Sm4PimqQntYBBhlvCtC76a8g17lyV +XGFlahMJ8MEPfDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 13/21] migration: Use visitors in migrate_params_test_apply Date: Mon, 2 Jun 2025 22:38:02 -0300 Message-Id: <20250603013810.4772-14-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914773653116600 Content-Type: text/plain; charset="utf-8" Convert the code in migrate_params_test_apply() from an open-coded copy of every migration parameter to a copy using visitors. This hides the details of QAPI from the migration code and avoids the need to update migrate_params_test_apply() every time a new migration parameter is added. Both were very confusing and while the visitor code can become a bit involved, there is no need for new contributors to ever touch it. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/options.c | 143 ++++++++++++-------------------------------- 1 file changed, 39 insertions(+), 104 deletions(-) diff --git a/migration/options.c b/migration/options.c index 27b5f549f9..ac4b06da7e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -20,6 +20,10 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qerror.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/qobject-output-visitor.h" +#include "qapi/visitor.h" +#include "qobject/qdict.h" #include "qobject/qnull.h" #include "system/runstate.h" #include "migration/colo.h" @@ -1184,117 +1188,46 @@ bool migrate_params_check(MigrationParameters *par= ams, Error **errp) return true; } =20 -static void migrate_params_test_apply(MigrationParameters *params, - MigrationParameters *dest) +static bool migrate_params_test_apply(MigrationParameters *params, + MigrationParameters *dest, Error **e= rrp) { MigrationState *s =3D migrate_get_current(); + QObject *ret_out =3D NULL; + Visitor *v; + bool ok; =20 QAPI_CLONE_MEMBERS(MigrationParameters, dest, &s->parameters); =20 - if (params->has_throttle_trigger_threshold) { - dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; + /* read in from params */ + v =3D qobject_output_visitor_new(&ret_out); + ok =3D visit_type_MigrationParameters(v, NULL, ¶ms, errp); + if (!ok) { + goto out; } + visit_complete(v, &ret_out); + visit_free(v); =20 - if (params->has_cpu_throttle_initial) { - dest->cpu_throttle_initial =3D params->cpu_throttle_initial; + /* write out to dest */ + v =3D qobject_input_visitor_new(ret_out); + ok =3D visit_start_struct(v, NULL, NULL, 0, errp); + if (!ok) { + goto out; } - - if (params->has_cpu_throttle_increment) { - dest->cpu_throttle_increment =3D params->cpu_throttle_increment; - } - - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; - } - - if (params->tls_creds) { - tls_option_set_str(&dest->tls_creds, params->tls_creds); - } - - if (params->tls_hostname) { - tls_option_set_str(&dest->tls_hostname, params->tls_hostname); - } - - if (params->tls_authz) { - tls_option_set_str(&dest->tls_authz, params->tls_authz); - } - - if (params->has_max_bandwidth) { - dest->max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_avail_switchover_bandwidth) { - dest->avail_switchover_bandwidth =3D params->avail_switchover_band= width; - } - - if (params->has_downtime_limit) { - dest->downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - dest->x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_multifd_channels) { - dest->multifd_channels =3D params->multifd_channels; + ok =3D visit_type_MigrationParameters_members(v, dest, errp); + if (!ok) { + goto out; } - if (params->has_multifd_compression) { - dest->multifd_compression =3D params->multifd_compression; - } - if (params->has_multifd_qatzip_level) { - dest->multifd_qatzip_level =3D params->multifd_qatzip_level; - } - if (params->has_multifd_zlib_level) { - dest->multifd_zlib_level =3D params->multifd_zlib_level; - } - if (params->has_multifd_zstd_level) { - dest->multifd_zstd_level =3D params->multifd_zstd_level; - } - if (params->has_xbzrle_cache_size) { - dest->xbzrle_cache_size =3D params->xbzrle_cache_size; - } - if (params->has_max_postcopy_bandwidth) { - dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; - } - if (params->has_max_cpu_throttle) { - dest->max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - dest->announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - dest->announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - dest->announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - dest->announce_step =3D params->announce_step; + ok =3D visit_check_struct(v, errp); + visit_end_struct(v, NULL); + if (!ok) { + goto out; } =20 - if (params->has_block_bitmap_mapping) { - dest->block_bitmap_mapping =3D params->block_bitmap_mapping; - } +out: + visit_free(v); + qobject_unref(ret_out); =20 - if (params->has_x_vcpu_dirty_limit_period) { - dest->x_vcpu_dirty_limit_period =3D - params->x_vcpu_dirty_limit_period; - } - if (params->has_vcpu_dirty_limit) { - dest->vcpu_dirty_limit =3D params->vcpu_dirty_limit; - } - - if (params->has_mode) { - dest->mode =3D params->mode; - } - - if (params->has_zero_page_detection) { - dest->zero_page_detection =3D params->zero_page_detection; - } - - if (params->has_direct_io) { - dest->direct_io =3D params->direct_io; - } + return ok; } =20 static void migrate_params_apply(MigrationParameters *params) @@ -1315,9 +1248,11 @@ static void migrate_params_apply(MigrationParameters= *params) =20 void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { - MigrationParameters tmp; + MigrationParameters *tmp =3D g_new0(MigrationParameters, 1); =20 - migrate_params_test_apply(params, &tmp); + if (!migrate_params_test_apply(params, tmp, errp)) { + return; + } =20 /* * Mark block_bitmap_mapping as present now while we have the @@ -1327,10 +1262,10 @@ void qmp_migrate_set_parameters(MigrationParameters= *params, Error **errp) migrate_get_current()->has_block_bitmap_mapping =3D true; } =20 - if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(&tmp); + if (migrate_params_check(tmp, errp)) { + migrate_params_apply(tmp); migrate_post_update_params(params, errp); } =20 - migrate_tls_opts_free(&tmp); + qapi_free_MigrationParameters(tmp); } --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914795; cv=none; d=zohomail.com; s=zohoarc; b=GWUTGS2Pytb4932AP1kWJ+Jmb1zy9hR6GjVdLB7gBDP/G+ekSIgAICq4sphphTr+wsd0s+QEpGbXAvG2Z4SrnnlfbveB6oLoWcfQhFC5pkClWF7mgsvH4IwpGY//av/ZG/hw0qXUmYV3QOyC5eFQ8Jrd/TbujPtAILhl+IWPIlQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914795; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3Sqno2A+jYx4k9Arw8UvRW4fu+tVoJPUKAO0Ry/+Ocg=; b=RmmR/ExbgPlRRrB5EwjhhEmf6t66YEpeDUvDcEQJLAqkaaVPhgjuVtr1C6Lh0dX/uj1M10boTgBwkqN1Lumw5FCriDcZUj87/Vih7ME5YzCCwO5EWMu33v+9iepztcvN44ObVrEBLQTxj/YlY40a92dFdt29HImpzi694/SUgYo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914795436687.4984471461777; Mon, 2 Jun 2025 18:39:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcM-0006ot-43; Mon, 02 Jun 2025 21:39:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcK-0006jd-8Q for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:04 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcI-0001YH-5b for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:04 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 59F261F394; Tue, 3 Jun 2025 01:38:43 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C063E13700; Tue, 3 Jun 2025 01:38:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2N4PICFSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914723; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Sqno2A+jYx4k9Arw8UvRW4fu+tVoJPUKAO0Ry/+Ocg=; b=nDjw3s0B7N9OsgaSWeOY9qzrkQRO2HEhW+LbnnG0aaX+BPb/uE5jssancyVdkuMkv2Odax k2SNze8sN5Y3OHpCdIzZiAYqU5/zsIkGqmx5WdNXb5sLQfBOwwhtsQx+H62M0b8POtOKtj nyrKe5tw0UxhNP2dyP8QzL0/PDpjpUo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914723; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Sqno2A+jYx4k9Arw8UvRW4fu+tVoJPUKAO0Ry/+Ocg=; b=azBolPXSExs+lE1pcbRALehXHH0LtvMDpgvT+WyKtgWHDvovGq+OAV0Pf8WLTyUQbXgokU ur7OhbIWt2RsqMAw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=nDjw3s0B; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=azBolPXS DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914723; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Sqno2A+jYx4k9Arw8UvRW4fu+tVoJPUKAO0Ry/+Ocg=; b=nDjw3s0B7N9OsgaSWeOY9qzrkQRO2HEhW+LbnnG0aaX+BPb/uE5jssancyVdkuMkv2Odax k2SNze8sN5Y3OHpCdIzZiAYqU5/zsIkGqmx5WdNXb5sLQfBOwwhtsQx+H62M0b8POtOKtj nyrKe5tw0UxhNP2dyP8QzL0/PDpjpUo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914723; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Sqno2A+jYx4k9Arw8UvRW4fu+tVoJPUKAO0Ry/+Ocg=; b=azBolPXSExs+lE1pcbRALehXHH0LtvMDpgvT+WyKtgWHDvovGq+OAV0Pf8WLTyUQbXgokU ur7OhbIWt2RsqMAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 14/21] migration: Cleanup hmp_info_migrate_parameters Date: Mon, 2 Jun 2025 22:38:03 -0300 Message-Id: <20250603013810.4772-15-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 59F261F394 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914798083116600 Content-Type: text/plain; charset="utf-8" Do a cleanup of hmp_info_migrate_parameters() before adding more lines into it: - Make sure every parameter asserts that the has_* field is set. qmp_query_migrate_parameters should have set them all. - Remove the if (params), qmp_query_migrate_parameters never returns NULL. - Add a macro to encapsulate boilerplate. - Line breaks for legibility. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Tested-by: Mario Casquero --- migration/migration-hmp-cmds.c | 265 ++++++++++++++++++--------------- 1 file changed, 148 insertions(+), 117 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 685c8ebd53..4f68719eda 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -33,6 +33,11 @@ #include "options.h" #include "migration.h" =20 +#define PARAM_INFO(_a, _f, _e, _v) do { \ + assert(_a); \ + monitor_printf(mon, _f, MigrationParameter_str(_e), _v); \ + } while (0) + static void migration_global_dump(Monitor *mon) { MigrationState *ms =3D migrate_get_current(); @@ -243,127 +248,153 @@ void hmp_info_migrate_parameters(Monitor *mon, cons= t QDict *qdict) const BitmapMigrationNodeAliasList *bmnal; =20 params =3D qmp_query_migrate_parameters(NULL); + assert(params); =20 - if (params) { - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_INITIAL), - params->announce_initial); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_MAX), - params->announce_max); - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_ROUNDS), - params->announce_rounds); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_STEP), - params->announce_step); - assert(params->has_throttle_trigger_threshold); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_THROTTLE_TRIGGER_TH= RESHOLD), - params->throttle_trigger_threshold); - assert(params->has_cpu_throttle_initial); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIA= L), - params->cpu_throttle_initial); - assert(params->has_cpu_throttle_increment); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREM= ENT), - params->cpu_throttle_increment); - assert(params->has_cpu_throttle_tailslow); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_TAILSL= OW), - params->cpu_throttle_tailslow ? "on" : "off"); - assert(params->has_max_cpu_throttle); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_CPU_THROTTLE), - params->max_cpu_throttle); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), - params->tls_creds ? params->tls_creds->u.s : ""); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), - params->tls_hostname ? params->tls_hostname->u.s : = ""); - assert(params->has_max_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), - params->max_bandwidth); - assert(params->has_avail_switchover_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", - MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BA= NDWIDTH), - params->avail_switchover_bandwidth); - assert(params->has_downtime_limit); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT), - params->downtime_limit); - assert(params->has_x_checkpoint_delay); - monitor_printf(mon, "%s: %u ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY), - params->x_checkpoint_delay); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_CHANNELS), - params->multifd_channels); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_COMPRESSION= ), - MultiFDCompression_str(params->multifd_compression)); - assert(params->has_zero_page_detection); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_ZERO_PAGE_DETECTION= ), - qapi_enum_lookup(&ZeroPageDetection_lookup, - params->zero_page_detection)); - monitor_printf(mon, "%s: %" PRIu64 " bytes\n", - MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), - params->xbzrle_cache_size); - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), - params->max_postcopy_bandwidth); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz ? params->tls_authz->u.s : ""); - - assert(params->has_block_bitmap_mapping); - monitor_printf(mon, "%s:\n", - MigrationParameter_str( - MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); - - for (bmnal =3D params->block_bitmap_mapping; - bmnal; - bmnal =3D bmnal->next) - { - const BitmapMigrationNodeAlias *bmna =3D bmnal->value; - const BitmapMigrationBitmapAliasList *bmbal; - - monitor_printf(mon, " '%s' -> '%s'\n", - bmna->node_name, bmna->alias); - - for (bmbal =3D bmna->bitmaps; bmbal; bmbal =3D bmbal->next) { - const BitmapMigrationBitmapAlias *bmba =3D bmbal->value; - - monitor_printf(mon, " '%s' -> '%s'\n", - bmba->name, bmba->alias); - } - } - - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), - params->x_vcpu_dirty_limit_period); - - monitor_printf(mon, "%s: %" PRIu64 " MB/s\n", - MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), - params->vcpu_dirty_limit); - - assert(params->has_mode); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_MODE), - qapi_enum_lookup(&MigMode_lookup, params->mode)); - - if (params->has_direct_io) { - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str( - MIGRATION_PARAMETER_DIRECT_IO), - params->direct_io ? "on" : "off"); + PARAM_INFO(params->has_announce_initial, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_ANNOUNCE_INITIAL, + params->announce_initial); + + PARAM_INFO(params->has_announce_max, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_ANNOUNCE_MAX, + params->announce_max); + + PARAM_INFO(params->has_announce_rounds, + "%s: %" PRIu64 "\n", + MIGRATION_PARAMETER_ANNOUNCE_ROUNDS, + params->announce_rounds); + + PARAM_INFO(params->has_announce_step, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_ANNOUNCE_STEP, + params->announce_step); + + PARAM_INFO(params->has_throttle_trigger_threshold, + "%s: %u\n", + MIGRATION_PARAMETER_THROTTLE_TRIGGER_THRESHOLD, + params->throttle_trigger_threshold); + + PARAM_INFO(params->has_cpu_throttle_initial, + "%s: %u\n", + MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL, + params->cpu_throttle_initial); + + PARAM_INFO(params->has_cpu_throttle_increment, + "%s: %u\n", + MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT, + params->cpu_throttle_increment); + + PARAM_INFO(params->has_cpu_throttle_tailslow, + "%s: %s\n", + MIGRATION_PARAMETER_CPU_THROTTLE_TAILSLOW, + params->cpu_throttle_tailslow ? "on" : "off"); + + PARAM_INFO(params->has_max_cpu_throttle, + "%s: %u\n", + MIGRATION_PARAMETER_MAX_CPU_THROTTLE, + params->max_cpu_throttle); + + PARAM_INFO(params->tls_creds, + "%s: '%s'\n", + MIGRATION_PARAMETER_TLS_CREDS, + params->tls_creds->u.s); + + PARAM_INFO(params->tls_hostname, + "%s: '%s'\n", + MIGRATION_PARAMETER_TLS_HOSTNAME, + params->tls_hostname->u.s); + + PARAM_INFO(params->has_max_bandwidth, + "%s: %" PRIu64 " bytes/second\n", + MIGRATION_PARAMETER_MAX_BANDWIDTH, + params->max_bandwidth); + + PARAM_INFO(params->has_avail_switchover_bandwidth, + "%s: %" PRIu64 " bytes/second\n", + MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BANDWIDTH, + params->avail_switchover_bandwidth); + + PARAM_INFO(params->has_downtime_limit, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_DOWNTIME_LIMIT, + params->downtime_limit); + + PARAM_INFO(params->has_x_checkpoint_delay, + "%s: %u ms\n", + MIGRATION_PARAMETER_X_CHECKPOINT_DELAY, + params->x_checkpoint_delay); + + PARAM_INFO(params->has_multifd_channels, + "%s: %u\n", + MIGRATION_PARAMETER_MULTIFD_CHANNELS, + params->multifd_channels); + + PARAM_INFO(params->has_multifd_compression, + "%s: %s\n", + MIGRATION_PARAMETER_MULTIFD_COMPRESSION, + qapi_enum_lookup(&MultiFDCompression_lookup, + params->multifd_compression)); + + PARAM_INFO(params->has_zero_page_detection, + "%s: %s\n", + MIGRATION_PARAMETER_ZERO_PAGE_DETECTION, + qapi_enum_lookup(&ZeroPageDetection_lookup, + params->zero_page_detection)); + + PARAM_INFO(params->has_xbzrle_cache_size, + "%s: %" PRIu64 " bytes\n", + MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE, + params->xbzrle_cache_size); + + PARAM_INFO(params->has_max_postcopy_bandwidth, + "%s: %" PRIu64 "\n", + MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWIDTH, + params->max_postcopy_bandwidth); + + PARAM_INFO(params->tls_authz, + "%s: '%s'\n", + MIGRATION_PARAMETER_TLS_AUTHZ, + params->tls_authz->u.s); + + PARAM_INFO(params->has_block_bitmap_mapping, + "%s:%s\n", + MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING, + ""); + + for (bmnal =3D params->block_bitmap_mapping; bmnal; bmnal =3D bmnal->n= ext) { + const BitmapMigrationNodeAlias *bmna =3D bmnal->value; + const BitmapMigrationBitmapAliasList *bmbal; + + monitor_printf(mon, " '%s' -> '%s'\n", bmna->node_name, bmna->ali= as); + + for (bmbal =3D bmna->bitmaps; bmbal; bmbal =3D bmbal->next) { + const BitmapMigrationBitmapAlias *bmba =3D bmbal->value; + + monitor_printf(mon, " '%s' -> '%s'\n", bmba->name, bmba->al= ias); } } =20 + PARAM_INFO(params->has_x_vcpu_dirty_limit_period, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERIOD, + params->x_vcpu_dirty_limit_period); + + PARAM_INFO(params->has_vcpu_dirty_limit, + "%s: %" PRIu64 " MB/s\n", + MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT, + params->vcpu_dirty_limit); + + PARAM_INFO(params->has_mode, + "%s: %s\n", + MIGRATION_PARAMETER_MODE, + qapi_enum_lookup(&MigMode_lookup, params->mode)); + + PARAM_INFO(params->has_direct_io, + "%s: %s\n", + MIGRATION_PARAMETER_DIRECT_IO, + params->direct_io ? "on" : "off"); + qapi_free_MigrationParameters(params); } =20 --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914816; cv=none; d=zohomail.com; s=zohoarc; b=cc/sEqUcCIAUytzr3yH1MxA6ZevVWipg75mnxsoHSx+vud8foaYoqSL1EO5v59rwh3iRBBqCPGmIZN/7F51hClboOq2sWDSC1kDu3Lb5fR9WZRCqHKWPZIVTVrWRuiRbhWlwMDRCb8EXpquNgAfja72KQnMSrhm2R1X1ZuAbckE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914816; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=50nRTnBPxKyjS2L8JAqN01QmnTxyw269nz/g/knqUAQ=; b=E9EYLVl6n7HkYzId6bDD0mLZzC6C9DECSsdOX3H3tQsQ1/Um+mcdS9poy+bDA8gd8hsO6/IKOB6lZSFdW+aDm//mF+O0E9cQfs+3slQ4vDdDmjRM9M5uNwnDodNT+zX29X/tVLwzuf4g3PaEm9353FjTTabB44VTsjDtKcJZf3U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914816890173.9228478213672; Mon, 2 Jun 2025 18:40:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcU-0007Y8-Ao; Mon, 02 Jun 2025 21:39:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcR-0007IZ-Uy for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:12 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcO-0001aM-W3 for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:11 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 586011F460; Tue, 3 Jun 2025 01:38:45 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C5E6D13700; Tue, 3 Jun 2025 01:38:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id GMplISNSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914725; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50nRTnBPxKyjS2L8JAqN01QmnTxyw269nz/g/knqUAQ=; b=Vbp3e2Eu1MKnXTfaFU5qN7G9w8Jx5MLOp/THIJvLO6CkmOrn7zlZWueh1H8/nBsBavBi3k L14AZFMZ/QFXGk9nX4put5QGpwFSl/hnKeWxiiAtaqlREkiv+A+pLW+e+wFxtyuGfuXn9n hPGCyQpG8yqmm0cAzuUFKcWevavLe7A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914725; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50nRTnBPxKyjS2L8JAqN01QmnTxyw269nz/g/knqUAQ=; b=J2K+fc78BbRlUaLmaOXiJw7oGKZ+gGEFtxcDSTl+Kwes1UC7wMAJfyq97TWQZ/MXnfDCiw qhru4jNa+IliXuBA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914725; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50nRTnBPxKyjS2L8JAqN01QmnTxyw269nz/g/knqUAQ=; b=Vbp3e2Eu1MKnXTfaFU5qN7G9w8Jx5MLOp/THIJvLO6CkmOrn7zlZWueh1H8/nBsBavBi3k L14AZFMZ/QFXGk9nX4put5QGpwFSl/hnKeWxiiAtaqlREkiv+A+pLW+e+wFxtyuGfuXn9n hPGCyQpG8yqmm0cAzuUFKcWevavLe7A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914725; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50nRTnBPxKyjS2L8JAqN01QmnTxyw269nz/g/knqUAQ=; b=J2K+fc78BbRlUaLmaOXiJw7oGKZ+gGEFtxcDSTl+Kwes1UC7wMAJfyq97TWQZ/MXnfDCiw qhru4jNa+IliXuBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 15/21] migration: Add capabilities into MigrationParameters Date: Mon, 2 Jun 2025 22:38:04 -0300 Message-Id: <20250603013810.4772-16-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914818368116600 Content-Type: text/plain; charset="utf-8" Add capabilities to MigrationParameters. This structure will hold all migration options. Capabilities will go away in the next patch. Also add capabilities to MigrationParameter as the enum needs to be kept in sync with MigrationParameters. This affects the parsing of migration HMP commands so make the necessary additions there too. From this point on, both QMP and HMP versions of migrate-set-parameters and query-migrate-parameters gain the ability to work with capabilities. With MigrationParameters now having members for each capability, the migration capabilities commands (query-migrate-capabilities, migrate-set-capabilities) will soon be deprecated. Add a set of helpers to convert between the old MigrationCapability representation and the new representation as members of MigrationParameters. Signed-off-by: Fabiano Rosas Acked-by: Peter Xu Tested-by: Mario Casquero --- migration/migration-hmp-cmds.c | 198 +++++++++++++++++++++++++++++++++ migration/migration.c | 8 ++ migration/options.c | 130 ++++++++++++++++++++++ migration/options.h | 5 + qapi/migration.json | 135 +++++++++++++++++++++- 5 files changed, 472 insertions(+), 4 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 4f68719eda..6d8d189b81 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -395,6 +395,116 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) MIGRATION_PARAMETER_DIRECT_IO, params->direct_io ? "on" : "off"); =20 + PARAM_INFO(params->has_xbzrle, + "%s: %s\n", + MIGRATION_PARAMETER_XBZRLE, + params->xbzrle ? "on" : "off"); + + PARAM_INFO(params->has_rdma_pin_all, + "%s: %s\n", + MIGRATION_PARAMETER_RDMA_PIN_ALL, + params->rdma_pin_all ? "on" : "off"); + + PARAM_INFO(params->has_auto_converge, + "%s: %s\n", + MIGRATION_PARAMETER_AUTO_CONVERGE, + params->auto_converge ? "on" : "off"); + + PARAM_INFO(params->has_zero_blocks, + "%s: %s\n", + MIGRATION_PARAMETER_ZERO_BLOCKS, + params->zero_blocks ? "on" : "off"); + + PARAM_INFO(params->has_events, + "%s: %s\n", + MIGRATION_PARAMETER_EVENTS, + params->events ? "on" : "off"); + + PARAM_INFO(params->has_postcopy_ram, + "%s: %s\n", + MIGRATION_PARAMETER_POSTCOPY_RAM, + params->postcopy_ram ? "on" : "off"); + + PARAM_INFO(params->has_x_colo, + "%s: %s\n", + MIGRATION_PARAMETER_X_COLO, + params->x_colo ? "on" : "off"); + + PARAM_INFO(params->has_release_ram, + "%s: %s\n", + MIGRATION_PARAMETER_RELEASE_RAM, + params->release_ram ? "on" : "off"); + + PARAM_INFO(params->has_return_path, + "%s: %s\n", + MIGRATION_PARAMETER_RETURN_PATH, + params->return_path ? "on" : "off"); + + PARAM_INFO(params->has_pause_before_switchover, + "%s: %s\n", + MIGRATION_PARAMETER_PAUSE_BEFORE_SWITCHOVER, + params->pause_before_switchover ? "on" : "off"); + + PARAM_INFO(params->has_multifd, + "%s: %s\n", + MIGRATION_PARAMETER_MULTIFD, + params->multifd ? "on" : "off"); + + PARAM_INFO(params->has_dirty_bitmaps, + "%s: %s\n", + MIGRATION_PARAMETER_DIRTY_BITMAPS, + params->dirty_bitmaps ? "on" : "off"); + + PARAM_INFO(params->has_postcopy_blocktime, + "%s: %s\n", + MIGRATION_PARAMETER_POSTCOPY_BLOCKTIME, + params->postcopy_blocktime ? "on" : "off"); + + PARAM_INFO(params->has_late_block_activate, + "%s: %s\n", + MIGRATION_PARAMETER_LATE_BLOCK_ACTIVATE, + params->late_block_activate ? "on" : "off"); + + PARAM_INFO(params->has_x_ignore_shared, + "%s: %s\n", + MIGRATION_PARAMETER_X_IGNORE_SHARED, + params->x_ignore_shared ? "on" : "off"); + + PARAM_INFO(params->has_validate_uuid, + "%s: %s\n", + MIGRATION_PARAMETER_VALIDATE_UUID, + params->validate_uuid ? "on" : "off"); + + PARAM_INFO(params->has_background_snapshot, + "%s: %s\n", + MIGRATION_PARAMETER_BACKGROUND_SNAPSHOT, + params->background_snapshot ? "on" : "off"); + + PARAM_INFO(params->has_zero_copy_send, + "%s: %s\n", + MIGRATION_PARAMETER_ZERO_COPY_SEND, + params->zero_copy_send ? "on" : "off"); + + PARAM_INFO(params->has_postcopy_preempt, + "%s: %s\n", + MIGRATION_PARAMETER_POSTCOPY_PREEMPT, + params->postcopy_preempt ? "on" : "off"); + + PARAM_INFO(params->has_switchover_ack, + "%s: %s\n", + MIGRATION_PARAMETER_SWITCHOVER_ACK, + params->switchover_ack ? "on" : "off"); + + PARAM_INFO(params->has_dirty_limit, + "%s: %s\n", + MIGRATION_PARAMETER_DIRTY_LIMIT, + params->dirty_limit ? "on" : "off"); + + PARAM_INFO(params->has_mapped_ram, + "%s: %s\n", + MIGRATION_PARAMETER_MAPPED_RAM, + params->mapped_ram ? "on" : "off"); + qapi_free_MigrationParameters(params); } =20 @@ -674,6 +784,94 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) p->has_direct_io =3D true; visit_type_bool(v, param, &p->direct_io, &err); break; + case MIGRATION_PARAMETER_XBZRLE: + p->has_xbzrle =3D true; + visit_type_bool(v, param, &p->xbzrle, &err); + break; + case MIGRATION_PARAMETER_RDMA_PIN_ALL: + p->has_rdma_pin_all =3D true; + visit_type_bool(v, param, &p->rdma_pin_all, &err); + break; + case MIGRATION_PARAMETER_AUTO_CONVERGE: + p->has_auto_converge =3D true; + visit_type_bool(v, param, &p->auto_converge, &err); + break; + case MIGRATION_PARAMETER_ZERO_BLOCKS: + p->has_zero_blocks =3D true; + visit_type_bool(v, param, &p->zero_blocks, &err); + break; + case MIGRATION_PARAMETER_EVENTS: + p->has_events =3D true; + visit_type_bool(v, param, &p->events, &err); + break; + case MIGRATION_PARAMETER_POSTCOPY_RAM: + p->has_postcopy_ram =3D true; + visit_type_bool(v, param, &p->postcopy_ram, &err); + break; + case MIGRATION_PARAMETER_X_COLO: + p->has_x_colo =3D true; + visit_type_bool(v, param, &p->x_colo, &err); + break; + case MIGRATION_PARAMETER_RELEASE_RAM: + p->has_release_ram =3D true; + visit_type_bool(v, param, &p->release_ram, &err); + break; + case MIGRATION_PARAMETER_RETURN_PATH: + p->has_return_path =3D true; + visit_type_bool(v, param, &p->return_path, &err); + break; + case MIGRATION_PARAMETER_PAUSE_BEFORE_SWITCHOVER: + p->has_pause_before_switchover =3D true; + visit_type_bool(v, param, &p->pause_before_switchover, &err); + break; + case MIGRATION_PARAMETER_MULTIFD: + p->has_multifd =3D true; + visit_type_bool(v, param, &p->multifd, &err); + break; + case MIGRATION_PARAMETER_DIRTY_BITMAPS: + p->has_dirty_bitmaps =3D true; + visit_type_bool(v, param, &p->dirty_bitmaps, &err); + break; + case MIGRATION_PARAMETER_POSTCOPY_BLOCKTIME: + p->has_postcopy_blocktime =3D true; + visit_type_bool(v, param, &p->postcopy_blocktime, &err); + break; + case MIGRATION_PARAMETER_LATE_BLOCK_ACTIVATE: + p->has_late_block_activate =3D true; + visit_type_bool(v, param, &p->late_block_activate, &err); + break; + case MIGRATION_PARAMETER_X_IGNORE_SHARED: + p->has_x_ignore_shared =3D true; + visit_type_bool(v, param, &p->x_ignore_shared, &err); + break; + case MIGRATION_PARAMETER_VALIDATE_UUID: + p->has_validate_uuid =3D true; + visit_type_bool(v, param, &p->validate_uuid, &err); + break; + case MIGRATION_PARAMETER_BACKGROUND_SNAPSHOT: + p->has_background_snapshot =3D true; + visit_type_bool(v, param, &p->background_snapshot, &err); + break; + case MIGRATION_PARAMETER_ZERO_COPY_SEND: + p->has_zero_copy_send =3D true; + visit_type_bool(v, param, &p->zero_copy_send, &err); + break; + case MIGRATION_PARAMETER_POSTCOPY_PREEMPT: + p->has_postcopy_preempt =3D true; + visit_type_bool(v, param, &p->postcopy_preempt, &err); + break; + case MIGRATION_PARAMETER_SWITCHOVER_ACK: + p->has_switchover_ack =3D true; + visit_type_bool(v, param, &p->switchover_ack, &err); + break; + case MIGRATION_PARAMETER_DIRTY_LIMIT: + p->has_dirty_limit =3D true; + visit_type_bool(v, param, &p->dirty_limit, &err); + break; + case MIGRATION_PARAMETER_MAPPED_RAM: + p->has_mapped_ram =3D true; + visit_type_bool(v, param, &p->mapped_ram, &err); + break; default: g_assert_not_reached(); } diff --git a/migration/migration.c b/migration/migration.c index 031a5f8ede..efb1dbb0c4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4098,6 +4098,14 @@ static bool migration_object_check(MigrationState *m= s, Error **errp) return false; } =20 + /* + * FIXME: Temporarily while -global capabilties are still using + * s->capabilities. Will be gone by the end of the series. + */ + for (int i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { + migrate_capability_set_compat(&ms->parameters, i, ms->capabilities= [i]); + } + return migrate_caps_check(old_caps, ms->capabilities, errp); } =20 diff --git a/migration/options.c b/migration/options.c index ac4b06da7e..5808bea53f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -634,6 +634,111 @@ bool migrate_caps_check(bool *old_caps, bool *new_cap= s, Error **errp) return true; } =20 +static bool *migrate_capability_get_addr(MigrationParameters *params, int = i) +{ + bool *cap_addr =3D NULL; + + switch (i) { + case MIGRATION_CAPABILITY_XBZRLE: + cap_addr =3D ¶ms->xbzrle; + break; + case MIGRATION_CAPABILITY_RDMA_PIN_ALL: + cap_addr =3D ¶ms->rdma_pin_all; + break; + case MIGRATION_CAPABILITY_AUTO_CONVERGE: + cap_addr =3D ¶ms->auto_converge; + break; + case MIGRATION_CAPABILITY_ZERO_BLOCKS: + cap_addr =3D ¶ms->zero_blocks; + break; + case MIGRATION_CAPABILITY_EVENTS: + cap_addr =3D ¶ms->events; + break; + case MIGRATION_CAPABILITY_POSTCOPY_RAM: + cap_addr =3D ¶ms->postcopy_ram; + break; + case MIGRATION_CAPABILITY_X_COLO: + cap_addr =3D ¶ms->x_colo; + break; + case MIGRATION_CAPABILITY_RELEASE_RAM: + cap_addr =3D ¶ms->release_ram; + break; + case MIGRATION_CAPABILITY_RETURN_PATH: + cap_addr =3D ¶ms->return_path; + break; + case MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER: + cap_addr =3D ¶ms->pause_before_switchover; + break; + case MIGRATION_CAPABILITY_MULTIFD: + cap_addr =3D ¶ms->multifd; + break; + case MIGRATION_CAPABILITY_DIRTY_BITMAPS: + cap_addr =3D ¶ms->dirty_bitmaps; + break; + case MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME: + cap_addr =3D ¶ms->postcopy_blocktime; + break; + case MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE: + cap_addr =3D ¶ms->late_block_activate; + break; + case MIGRATION_CAPABILITY_X_IGNORE_SHARED: + cap_addr =3D ¶ms->x_ignore_shared; + break; + case MIGRATION_CAPABILITY_VALIDATE_UUID: + cap_addr =3D ¶ms->validate_uuid; + break; + case MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT: + cap_addr =3D ¶ms->background_snapshot; + break; + case MIGRATION_CAPABILITY_ZERO_COPY_SEND: + cap_addr =3D ¶ms->zero_copy_send; + break; + case MIGRATION_CAPABILITY_POSTCOPY_PREEMPT: + cap_addr =3D ¶ms->postcopy_preempt; + break; + case MIGRATION_CAPABILITY_SWITCHOVER_ACK: + cap_addr =3D ¶ms->switchover_ack; + break; + case MIGRATION_CAPABILITY_DIRTY_LIMIT: + cap_addr =3D ¶ms->dirty_limit; + break; + case MIGRATION_CAPABILITY_MAPPED_RAM: + cap_addr =3D ¶ms->mapped_ram; + break; + default: + g_assert_not_reached(); + } + + return cap_addr; +} + +/* Compatibility for code that reads capabilities in a loop */ +bool migrate_capability_get_compat(MigrationParameters *params, int i) +{ + return *(migrate_capability_get_addr(params, i)); +} + +/* Compatibility for code that writes capabilities in a loop */ +void migrate_capability_set_compat(MigrationParameters *params, int i, boo= l val) +{ + *(migrate_capability_get_addr(params, i)) =3D val; +} + +/* + * Set capabilities for compatibility with the old + * migrate-set-capabilities command. + */ +void migrate_capabilities_set_compat(MigrationParameters *params, + MigrationCapabilityStatusList *caps) +{ + MigrationCapabilityStatusList *cap; + + for (cap =3D caps; cap; cap =3D cap->next) { + migrate_capability_set_compat(params, cap->value->capability, + cap->value->state); + } +} + MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; @@ -675,6 +780,8 @@ void qmp_migrate_set_capabilities(MigrationCapabilitySt= atusList *params, for (cap =3D params; cap; cap =3D cap->next) { s->capabilities[cap->value->capability] =3D cap->value->state; } + + migrate_capabilities_set_compat(&s->parameters, params); } =20 /* parameters */ @@ -959,6 +1066,15 @@ static void migrate_mark_all_params_present(Migration= Parameters *p) &p->has_announce_step, &p->has_block_bitmap_mapping, &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, + &p->has_xbzrle, &p->has_rdma_pin_all, &p->has_auto_converge, + &p->has_zero_blocks, &p->has_events, &p->has_postcopy_ram, + &p->has_x_colo, &p->has_release_ram, &p->has_return_path, + &p->has_pause_before_switchover, &p->has_multifd, &p->has_dirty_bi= tmaps, + &p->has_postcopy_blocktime, &p->has_late_block_activate, + &p->has_x_ignore_shared, &p->has_validate_uuid, + &p->has_background_snapshot, &p->has_zero_copy_send, + &p->has_postcopy_preempt, &p->has_switchover_ack, &p->has_dirty_li= mit, + &p->has_mapped_ram, }; =20 /* @@ -1250,6 +1366,20 @@ void qmp_migrate_set_parameters(MigrationParameters = *params, Error **errp) { MigrationParameters *tmp =3D g_new0(MigrationParameters, 1); =20 + /* + * FIXME: Temporarily while migrate_caps_check is not + * converted to look at s->parameters. Will be gone the end of + * the series. + */ + MigrationState *s =3D migrate_get_current(); + bool new_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; + for (int i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { + new_caps[i] =3D migrate_capability_get_compat(&s->parameters, i); + } + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + return; + } + if (!migrate_params_test_apply(params, tmp, errp)) { return; } diff --git a/migration/options.h b/migration/options.h index 999eee6f3b..cac9201a5e 100644 --- a/migration/options.h +++ b/migration/options.h @@ -92,4 +92,9 @@ ZeroPageDetection migrate_zero_page_detection(void); bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); void migrate_tls_opts_free(MigrationParameters *params); +bool migrate_capability_get_compat(MigrationParameters *params, int i); +void migrate_capability_set_compat(MigrationParameters *params, int i, + bool val); +void migrate_capabilities_set_compat(MigrationParameters *params, + MigrationCapabilityStatusList *caps); #endif diff --git a/qapi/migration.json b/qapi/migration.json index 452e6dedaa..5942622ba7 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -762,7 +762,14 @@ 'vcpu-dirty-limit', 'mode', 'zero-page-detection', - 'direct-io'] } + 'direct-io', 'xbzrle', 'rdma-pin-all', 'auto-converge', + 'zero-blocks', 'events', 'postcopy-ram', 'x-colo', + 'release-ram', 'return-path', 'pause-before-switchover', + 'multifd', 'dirty-bitmaps', 'postcopy-blocktime', + 'late-block-activate', 'x-ignore-shared', + 'validate-uuid', 'background-snapshot', + 'zero-copy-send', 'postcopy-preempt', + 'switchover-ack', 'dirty-limit', 'mapped-ram' ] } =20 ## # @migrate-set-parameters: @@ -936,10 +943,108 @@ # only has effect if the @mapped-ram capability is enabled. # (Since 9.1) # +# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length +# Encoding). This feature allows us to minimize migration traffic +# for certain work loads, by sending compressed difference of the +# pages +# +# @rdma-pin-all: Controls whether or not the entire VM memory +# footprint is mlock()'d on demand or all at once. Refer to +# docs/rdma.txt for usage. Disabled by default. (since 2.0) +# +# @zero-blocks: During storage migration encode blocks of zeroes +# efficiently. This essentially saves 1MB of zeroes per block on +# the wire. Enabling requires source and target VM to support +# this feature. To enable it is sufficient to enable the +# capability on the source VM. The feature is disabled by +# default. (since 1.6) +# +# @events: generate events for each migration state change (since 2.4) +# +# @auto-converge: If enabled, QEMU will automatically throttle down +# the guest to speed up convergence of RAM migration. (since 1.6) +# +# @postcopy-ram: Start executing on the migration target before all of +# RAM has been migrated, pulling the remaining pages along as +# needed. The capacity must have the same setting on both source +# and target or migration will not even start. NOTE: If the +# migration fails during postcopy the VM will fail. (since 2.6) +# +# @x-colo: If enabled, migration will never end, and the state of the +# VM on the primary side will be migrated continuously to the VM +# on secondary side, this process is called COarse-Grain LOck +# Stepping (COLO) for Non-stop Service. (since 2.8) +# +# @release-ram: if enabled, qemu will free the migrated ram pages on +# the source during postcopy-ram migration. (since 2.9) +# +# @return-path: If enabled, migration will use the return path even +# for precopy. (since 2.10) +# +# @pause-before-switchover: Pause outgoing migration before +# serialising device state and before disabling block IO (since +# 2.11) +# +# @multifd: Use more than one fd for migration (since 4.0) +# +# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps. +# (since 2.12) +# +# @postcopy-blocktime: Calculate downtime for postcopy live migration +# (since 3.0) +# +# @late-block-activate: If enabled, the destination will not activate +# block devices (and thus take locks) immediately at the end of +# migration. (since 3.0) +# +# @x-ignore-shared: If enabled, QEMU will not migrate shared memory +# that is accessible on the destination machine. (since 4.0) +# +# @validate-uuid: Send the UUID of the source to allow the destination +# to ensure it is the same. (since 4.2) +# +# @background-snapshot: If enabled, the migration stream will be a +# snapshot of the VM exactly at the point when the migration +# procedure starts. The VM RAM is saved with running VM. +# (since 6.0) +# +# @zero-copy-send: Controls behavior on sending memory pages on +# migration. When true, enables a zero-copy mechanism for sending +# memory pages, if host supports it. Requires that QEMU be +# permitted to use locked memory for guest RAM pages. (since 7.1) +# +# @postcopy-preempt: If enabled, the migration process will allow +# postcopy requests to preempt precopy stream, so postcopy +# requests will be handled faster. This is a performance feature +# and should not affect the correctness of postcopy migration. +# (since 7.1) +# +# @switchover-ack: If enabled, migration will not stop the source VM +# and complete the migration until an ACK is received from the +# destination that it's OK to do so. Exactly when this ACK is +# sent depends on the migrated devices that use this feature. For +# example, a device can use it to make sure some of its data is +# sent and loaded in the destination before doing switchover. +# This can reduce downtime if devices that support this capability +# are present. 'return-path' capability must be enabled to use +# it. (since 8.1) +# +# @dirty-limit: If enabled, migration will throttle vCPUs as needed to +# keep their dirty page rate within @vcpu-dirty-limit. This can +# improve responsiveness of large guests during live migration, +# and can result in more stable read performance. Requires KVM +# with accelerator property "dirty-ring-size" set. (Since 8.1) +# +# @mapped-ram: Migrate using fixed offsets in the migration file for +# each RAM page. Requires a migration URI that supports seeking, +# such as a file. (since 9.0) +# # Features: # -# @unstable: Members @x-checkpoint-delay and -# @x-vcpu-dirty-limit-period are experimental. +# @unstable: Members @x-checkpoint-delay, @x-vcpu-dirty-limit-period, +# @x-colo and @x-ignore-shared are experimental. +# @deprecated: Member @zero-blocks is deprecated as being part of +# block migration which was already removed. # # Since: 2.4 ## @@ -974,7 +1079,29 @@ '*vcpu-dirty-limit': 'uint64', '*mode': 'MigMode', '*zero-page-detection': 'ZeroPageDetection', - '*direct-io': 'bool' } } + '*direct-io': 'bool', + '*xbzrle': 'bool', + '*rdma-pin-all': 'bool', + '*auto-converge': 'bool', + '*zero-blocks': { 'type': 'bool', 'features': [ 'deprecated' ]= }, + '*events': 'bool', + '*postcopy-ram': 'bool', + '*x-colo': { 'type': 'bool', 'features': [ 'unstable' ] }, + '*release-ram': 'bool', + '*return-path': 'bool', + '*pause-before-switchover': 'bool', + '*multifd': 'bool', + '*dirty-bitmaps': 'bool', + '*postcopy-blocktime': 'bool', + '*late-block-activate': 'bool', + '*x-ignore-shared': { 'type': 'bool', 'features': [ 'unstable'= ] }, + '*validate-uuid': 'bool', + '*background-snapshot': 'bool', + '*zero-copy-send': 'bool', + '*postcopy-preempt': 'bool', + '*switchover-ack': 'bool', + '*dirty-limit': 'bool', + '*mapped-ram': 'bool' } } =20 ## # @query-migrate-parameters: --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914878; cv=none; d=zohomail.com; s=zohoarc; b=KtasxNNNKzU8TqPFnBWAzdZP7u7ZOpav4mNiIqJY1emKRGIPvQsfTC7aZjIL3mgJ7WsgENKQdX/HiZ5qiu977x72PvkAvdXxWJs7QHbsAHsLi1Q7GDfI23k07nxS0Y3WKdsr5JSALh96lppI2CP3GNyWnujjp5UeiTXMYKkYCBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914878; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZsEmCZqcH0pwNdi8IcQf5V3H0fZ9OGiuoI7A9Iypbfg=; b=SyL07ElvPm0HruDY0xbsoYI51Kr2rO2jM+FBoU1WdPPhWszPxGA5odAYOF9q1rlhdtN2XLUdgK5AmI4ArCWilhBJ9ERFMjIoiRSYke0w4CnjtFrBS4NesN6lmSWzGLRBB5P1SMKrPFD0pl5m0PrXZWn0fBQi9gSmSYvFHEBfPgk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914878801691.3667053793038; Mon, 2 Jun 2025 18:41:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcG-0006iu-FJ; Mon, 02 Jun 2025 21:39:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcF-0006iX-4P for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:59 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcD-0001XC-D6 for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:38:58 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5B662218E8; Tue, 3 Jun 2025 01:38:47 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CEBBD13700; Tue, 3 Jun 2025 01:38:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4E52IyVSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914727; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZsEmCZqcH0pwNdi8IcQf5V3H0fZ9OGiuoI7A9Iypbfg=; b=p2l0hWfRPtQPVGgq2dMmmiEpkGeiIndXqU9uWJxzxkce7Xl2ff9MeG3mcyKFMaRIbnHq2p 692iW+LzIjwNlIUObddVLEFHdIWcbh9ZhjGSgM0giagY87QAAHsX5lgVPQBTziVggIsRGa yZl5Jw8FxORSXqIgLqRPC67hc3Y2jMw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914727; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZsEmCZqcH0pwNdi8IcQf5V3H0fZ9OGiuoI7A9Iypbfg=; b=3rcLASNSo6rD+bPSADbocD6fneXlVQZa3cEJBUh9rvUxtZDEZqky3//h8aoEbsz/Eckfwp Q1cstTLJ0YRy1aDA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=p2l0hWfR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=3rcLASNS DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914727; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZsEmCZqcH0pwNdi8IcQf5V3H0fZ9OGiuoI7A9Iypbfg=; b=p2l0hWfRPtQPVGgq2dMmmiEpkGeiIndXqU9uWJxzxkce7Xl2ff9MeG3mcyKFMaRIbnHq2p 692iW+LzIjwNlIUObddVLEFHdIWcbh9ZhjGSgM0giagY87QAAHsX5lgVPQBTziVggIsRGa yZl5Jw8FxORSXqIgLqRPC67hc3Y2jMw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914727; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZsEmCZqcH0pwNdi8IcQf5V3H0fZ9OGiuoI7A9Iypbfg=; b=3rcLASNSo6rD+bPSADbocD6fneXlVQZa3cEJBUh9rvUxtZDEZqky3//h8aoEbsz/Eckfwp Q1cstTLJ0YRy1aDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 16/21] qapi/migration: Mark that query/set-migrate-parameters support capabilities Date: Mon, 2 Jun 2025 22:38:05 -0300 Message-Id: <20250603013810.4772-17-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.98%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: 5B662218E8 X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914880995116600 Content-Type: text/plain; charset="utf-8" Add a QAPI command feature "capabilities" that can be queried by the client to check that the parameters commands now also support capabilities. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- qapi/migration.json | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 5942622ba7..557a9c523e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -776,6 +776,13 @@ # # Set various migration parameters. # +# Features: +# +# @capabilities: Indicates this command supports setting the set of +# parameters previously known as capabilities. This means this +# command can (and should) be used instead of the depreacated +# @migrate-set-capabilities. +# # Since: 2.4 # # .. qmp-example:: @@ -785,7 +792,8 @@ # <- { "return": {} } ## { 'command': 'migrate-set-parameters', 'boxed': true, - 'data': 'MigrationParameters' } + 'data': 'MigrationParameters', + 'features': [ 'capabilities' ] } =20 ## # @MigrationParameters: @@ -1110,6 +1118,13 @@ # # Returns: @MigrationParameters # +# Features: +# +# @capabilities: Indicates this command supports setting the set of +# parameters previously known as capabilities. This means this +# command can (and should) be used instead of the depreacated +# @migrate-set-capabilities. +# # Since: 2.4 # # .. qmp-example:: @@ -1125,7 +1140,8 @@ # } ## { 'command': 'query-migrate-parameters', - 'returns': 'MigrationParameters' } + 'returns': 'MigrationParameters', + 'features': [ 'capabilities' ] } =20 ## # @migrate-start-postcopy: --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914801; cv=none; d=zohomail.com; s=zohoarc; b=F/i4DL/LFa0LZNcWuriGwQPTV8Ww+PPLtsEmND0FH9gTvFW8suyU2OFACvnw2citwYlNF4IxEsbw12M0nXoMAGkvMqS9StxT3+PeP0hANxkjgbYBVT3eFtBrT5acNsWJfmBpXQfgA6huDIIi+rv88pB/pOSoQaAFU11+JNZz9mU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914801; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=o5N3NYVPhtMhAUUEJ5cor+FUZmJf9dyM51Q9MLNxrZs=; b=GfzKgtvTIweK3VL0H2+UPQBhcWLgM5m+fd7Ma00hck+gcVpZBf77R6Vtmsp8wUxDynuUYy3Rx73Jin10PNyHw06S/TDtNzoBA5DSOOLdh0X7inK4kIA8b6yfMODSIMcHS+QunHafzlKDHbQb9Ksv0S/QjRYXH6uVVoV1Qt73TVA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17489148015071016.3342040799612; Mon, 2 Jun 2025 18:40:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGca-00089P-MS; Mon, 02 Jun 2025 21:39:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcY-0007ze-RM for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:18 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcV-0001bj-IK for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:18 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9CB041F461; Tue, 3 Jun 2025 01:38:49 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D471213700; Tue, 3 Jun 2025 01:38:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +GaVJCdSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914729; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o5N3NYVPhtMhAUUEJ5cor+FUZmJf9dyM51Q9MLNxrZs=; b=dCQ/6LWctnCdUSTsnyO3KCJ85L8sT4x3bjj3ppzaHWZC6P7em1I/13L1z+yd+hhX5FlXwX uPOxXzY1oexeRTAJLD2YtgXKPQuGb07VpMHALmLA0v/tYjpzOh9ZdnodV82NTz5Dpm/mRV T4zatXYeduT+JaAe+EBTWMdJaPiCUfU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914729; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o5N3NYVPhtMhAUUEJ5cor+FUZmJf9dyM51Q9MLNxrZs=; b=VDCsdtS16OaM/vqbyR24qB/HL7mVId0dmxXwpaai2i65PPKRUoMGe+REuZNwR5ndQNAkUH ddVFqtNS6igI66Bg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="dCQ/6LWc"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=VDCsdtS1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914729; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o5N3NYVPhtMhAUUEJ5cor+FUZmJf9dyM51Q9MLNxrZs=; b=dCQ/6LWctnCdUSTsnyO3KCJ85L8sT4x3bjj3ppzaHWZC6P7em1I/13L1z+yd+hhX5FlXwX uPOxXzY1oexeRTAJLD2YtgXKPQuGb07VpMHALmLA0v/tYjpzOh9ZdnodV82NTz5Dpm/mRV T4zatXYeduT+JaAe+EBTWMdJaPiCUfU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914729; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o5N3NYVPhtMhAUUEJ5cor+FUZmJf9dyM51Q9MLNxrZs=; b=VDCsdtS16OaM/vqbyR24qB/HL7mVId0dmxXwpaai2i65PPKRUoMGe+REuZNwR5ndQNAkUH ddVFqtNS6igI66Bg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 17/21] migration: Remove s->capabilities Date: Mon, 2 Jun 2025 22:38:06 -0300 Message-Id: <20250603013810.4772-18-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 9CB041F461 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914804296116600 Content-Type: text/plain; charset="utf-8" Last patch added capabilities to s->parameters. Now we can replace all instances of s->capabilities with s->parameters: - The -global properties now get set directly in s->parameters. - Accessors from options.c now read from s->parameters. - migrate_caps_check() now takes a MigrationParameters object. The function is still kept around because migrate-set-capabilities will still use it. - The machinery for background-snapshot compatibility check goes away. We can check each capability by name (if s->parameters.cap ...) - savevm uses the helper functions introduced in the last patch to do validation of capabilities found on the migration stream. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Tested-by: Mario Casquero --- migration/migration.c | 22 +--- migration/migration.h | 1 - migration/options.c | 285 ++++++++++++++++++------------------------ migration/options.h | 20 +-- migration/savevm.c | 8 +- 5 files changed, 133 insertions(+), 203 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index efb1dbb0c4..75c4ec9a95 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -266,9 +266,10 @@ static bool migration_capabilities_and_transport_compatible(MigrationAddress *addr, Error **errp) { + MigrationState *s =3D migrate_get_current(); + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - return migrate_rdma_caps_check(migrate_get_current()->capabilities, - errp); + return migrate_rdma_caps_check(&s->parameters, errp); } =20 return true; @@ -4091,22 +4092,7 @@ static void migration_instance_init(Object *obj) */ static bool migration_object_check(MigrationState *ms, Error **errp) { - /* Assuming all off */ - bool old_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; - - if (!migrate_params_check(&ms->parameters, errp)) { - return false; - } - - /* - * FIXME: Temporarily while -global capabilties are still using - * s->capabilities. Will be gone by the end of the series. - */ - for (int i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - migrate_capability_set_compat(&ms->parameters, i, ms->capabilities= [i]); - } - - return migrate_caps_check(old_caps, ms->capabilities, errp); + return migrate_params_check(&ms->parameters, errp); } =20 static const TypeInfo migration_type =3D { diff --git a/migration/migration.h b/migration/migration.h index ab797540b0..993d51aedd 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -358,7 +358,6 @@ struct MigrationState { int64_t downtime_start; int64_t downtime; int64_t expected_downtime; - bool capabilities[MIGRATION_CAPABILITY__MAX]; int64_t setup_time; =20 /* diff --git a/migration/options.c b/migration/options.c index 5808bea53f..fa3f7035c8 100644 --- a/migration/options.c +++ b/migration/options.c @@ -85,9 +85,6 @@ #define DEFAULT_MIGRATE_ANNOUNCE_ROUNDS 5 #define DEFAULT_MIGRATE_ANNOUNCE_STEP 100 =20 -#define DEFINE_PROP_MIG_CAP(name, x) \ - DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) - #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */ =20 @@ -184,30 +181,40 @@ const Property migration_properties[] =3D { DEFINE_PROP_ZERO_PAGE_DETECTION("zero-page-detection", MigrationState, parameters.zero_page_detection, ZERO_PAGE_DETECTION_MULTIFD), - - /* Migration capabilities */ - DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), - DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), - DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), - DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), - DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), - DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), - DEFINE_PROP_MIG_CAP("x-postcopy-preempt", - MIGRATION_CAPABILITY_POSTCOPY_PREEMPT), - DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO), - DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM), - DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH), - DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD), - DEFINE_PROP_MIG_CAP("x-background-snapshot", - MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT), + DEFINE_PROP_BOOL("x-xbzrle", + MigrationState, parameters.xbzrle, false), + DEFINE_PROP_BOOL("x-rdma-pin-all", + MigrationState, parameters.rdma_pin_all, false), + DEFINE_PROP_BOOL("x-auto-converge", + MigrationState, parameters.auto_converge, false), + DEFINE_PROP_BOOL("x-zero-blocks", + MigrationState, parameters.zero_blocks, false), + DEFINE_PROP_BOOL("x-events", + MigrationState, parameters.events, false), + DEFINE_PROP_BOOL("x-postcopy-ram", + MigrationState, parameters.postcopy_ram, false), + DEFINE_PROP_BOOL("x-postcopy-preempt", + MigrationState, parameters.postcopy_preempt, false), + DEFINE_PROP_BOOL("x-colo", + MigrationState, parameters.x_colo, false), + DEFINE_PROP_BOOL("x-release-ram", + MigrationState, parameters.release_ram, false), + DEFINE_PROP_BOOL("x-return-path", + MigrationState, parameters.return_path, false), + DEFINE_PROP_BOOL("x-multifd", + MigrationState, parameters.multifd, false), + DEFINE_PROP_BOOL("x-background-snapshot", + MigrationState, parameters.background_snapshot, false= ), #ifdef CONFIG_LINUX - DEFINE_PROP_MIG_CAP("x-zero-copy-send", - MIGRATION_CAPABILITY_ZERO_COPY_SEND), + DEFINE_PROP_BOOL("x-zero-copy-send", + MigrationState, parameters.zero_copy_send, false), #endif - DEFINE_PROP_MIG_CAP("x-switchover-ack", - MIGRATION_CAPABILITY_SWITCHOVER_ACK), - DEFINE_PROP_MIG_CAP("x-dirty-limit", MIGRATION_CAPABILITY_DIRTY_LIMIT), - DEFINE_PROP_MIG_CAP("mapped-ram", MIGRATION_CAPABILITY_MAPPED_RAM), + DEFINE_PROP_BOOL("x-switchover-ack", + MigrationState, parameters.switchover_ack, false), + DEFINE_PROP_BOOL("x-dirty-limit", + MigrationState, parameters.dirty_limit, false), + DEFINE_PROP_BOOL("mapped-ram", + MigrationState, parameters.mapped_ram, false), }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 @@ -215,7 +222,7 @@ bool migrate_auto_converge(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; + return s->parameters.auto_converge; } =20 bool migrate_send_switchover_start(void) @@ -229,144 +236,142 @@ bool migrate_background_snapshot(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; + return s->parameters.background_snapshot; } =20 bool migrate_colo(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; + return s->parameters.x_colo; } =20 bool migrate_dirty_bitmaps(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; + return s->parameters.dirty_bitmaps; } =20 bool migrate_dirty_limit(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_DIRTY_LIMIT]; + return s->parameters.dirty_limit; } =20 bool migrate_events(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; + return s->parameters.events; } =20 bool migrate_mapped_ram(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM]; + return s->parameters.mapped_ram; } =20 bool migrate_ignore_shared(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; + return s->parameters.x_ignore_shared; } =20 bool migrate_late_block_activate(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; + return s->parameters.late_block_activate; } =20 bool migrate_multifd(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; + return s->parameters.multifd; } =20 bool migrate_pause_before_switchover(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; + return s->parameters.pause_before_switchover; } =20 bool migrate_postcopy_blocktime(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; + return s->parameters.postcopy_blocktime; } =20 bool migrate_postcopy_preempt(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; + return s->parameters.postcopy_preempt; } =20 bool migrate_postcopy_ram(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; + return s->parameters.postcopy_ram; } =20 bool migrate_rdma_pin_all(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL]; + return s->parameters.rdma_pin_all; } =20 bool migrate_release_ram(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; + return s->parameters.release_ram; } =20 bool migrate_return_path(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; + return s->parameters.return_path; } =20 bool migrate_switchover_ack(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_SWITCHOVER_ACK]; + return s->parameters.switchover_ack; } =20 bool migrate_validate_uuid(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; + return s->parameters.validate_uuid; } =20 bool migrate_xbzrle(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; + return s->parameters.xbzrle; } =20 bool migrate_zero_copy_send(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; + return s->parameters.zero_copy_send; } =20 -/* pseudo capabilities */ - bool migrate_multifd_flush_after_each_section(void) { MigrationState *s =3D migrate_get_current(); @@ -411,54 +416,22 @@ WriteTrackingSupport migrate_query_write_tracking(voi= d) return WT_SUPPORT_COMPATIBLE; } =20 -/* Migration capabilities set */ -struct MigrateCapsSet { - int size; /* Capability set size */ - MigrationCapability caps[]; /* Variadic array of capabilities */ -}; -typedef struct MigrateCapsSet MigrateCapsSet; - -/* Define and initialize MigrateCapsSet */ -#define INITIALIZE_MIGRATE_CAPS_SET(_name, ...) \ - MigrateCapsSet _name =3D { \ - .size =3D sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \ - .caps =3D { __VA_ARGS__ } \ - } - -/* Background-snapshot compatibility check list */ -static const -INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot, - MIGRATION_CAPABILITY_POSTCOPY_RAM, - MIGRATION_CAPABILITY_DIRTY_BITMAPS, - MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME, - MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE, - MIGRATION_CAPABILITY_RETURN_PATH, - MIGRATION_CAPABILITY_MULTIFD, - MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER, - MIGRATION_CAPABILITY_AUTO_CONVERGE, - MIGRATION_CAPABILITY_RELEASE_RAM, - MIGRATION_CAPABILITY_RDMA_PIN_ALL, - MIGRATION_CAPABILITY_XBZRLE, - MIGRATION_CAPABILITY_X_COLO, - MIGRATION_CAPABILITY_VALIDATE_UUID, - MIGRATION_CAPABILITY_ZERO_COPY_SEND); - static bool migrate_incoming_started(void) { return !!migration_incoming_get_current()->transport_data; } =20 -bool migrate_rdma_caps_check(bool *caps, Error **errp) +bool migrate_rdma_caps_check(MigrationParameters *params, Error **errp) { - if (caps[MIGRATION_CAPABILITY_XBZRLE]) { + if (params->xbzrle) { error_setg(errp, "RDMA and XBZRLE can't be used together"); return false; } - if (caps[MIGRATION_CAPABILITY_MULTIFD]) { + if (params->multifd) { error_setg(errp, "RDMA and multifd can't be used together"); return false; } - if (caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (params->postcopy_ram) { error_setg(errp, "RDMA and postcopy-ram can't be used together"); return false; } @@ -466,26 +439,19 @@ bool migrate_rdma_caps_check(bool *caps, Error **errp) return true; } =20 -/** - * @migration_caps_check - check capability compatibility - * - * @old_caps: old capability list - * @new_caps: new capability list - * @errp: set *errp if the check failed, with reason - * - * Returns true if check passed, otherwise false. - */ -bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp) +bool migrate_caps_check(MigrationParameters *new, Error **errp) { - ERRP_GUARD(); + MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); + bool postcopy_already_on =3D s->parameters.postcopy_ram; + ERRP_GUARD(); =20 - if (new_caps[MIGRATION_CAPABILITY_ZERO_BLOCKS]) { + if (new->zero_blocks) { warn_report("zero-blocks capability is deprecated"); } =20 #ifndef CONFIG_REPLICATION - if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { + if (new->x_colo) { error_setg(errp, "QEMU compiled without replication module" " can't enable COLO"); error_append_hint(errp, "Please enable replication before COLO.\n"= ); @@ -493,27 +459,27 @@ bool migrate_caps_check(bool *old_caps, bool *new_cap= s, Error **errp) } #endif =20 - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (new->postcopy_ram) { /* This check is reasonably expensive, so only when it's being * set the first time, also it's only the destination that needs * special support. */ - if (!old_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] && + if (!postcopy_already_on && runstate_check(RUN_STATE_INMIGRATE) && !postcopy_ram_supported_by_host(mis, errp)) { error_prepend(errp, "Postcopy is not supported: "); return false; } =20 - if (new_caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { + if (new->x_ignore_shared) { error_setg(errp, "Postcopy is not compatible with ignore-share= d"); return false; } } =20 - if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { + if (new->background_snapshot) { WriteTrackingSupport wt_support; - int idx; + /* * Check if 'background-snapshot' capability is supported by * host kernel and compatible with guest memory configuration. @@ -529,41 +495,45 @@ bool migrate_caps_check(bool *old_caps, bool *new_cap= s, Error **errp) return false; } =20 - /* - * Check if there are any migration capabilities - * incompatible with 'background-snapshot'. - */ - for (idx =3D 0; idx < check_caps_background_snapshot.size; idx++) { - int incomp_cap =3D check_caps_background_snapshot.caps[idx]; - if (new_caps[incomp_cap]) { - error_setg(errp, - "Background-snapshot is not compatible with %s", - MigrationCapability_str(incomp_cap)); - return false; - } + if (new->postcopy_ram || + new->dirty_bitmaps || + new->postcopy_blocktime || + new->late_block_activate || + new->return_path || + new->multifd || + new->pause_before_switchover || + new->auto_converge || + new->release_ram || + new->rdma_pin_all || + new->xbzrle || + new->x_colo || + new->validate_uuid || + new->zero_copy_send) { + error_setg(errp, + "Background-snapshot is not compatible with " + "currently set capabilities"); + return false; } } =20 #ifdef CONFIG_LINUX - if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && - (!new_caps[MIGRATION_CAPABILITY_MULTIFD] || - new_caps[MIGRATION_CAPABILITY_XBZRLE] || - migrate_multifd_compression() || - migrate_tls())) { + if (new->zero_copy_send && + (!new->multifd || new->xbzrle || + migrate_multifd_compression() || migrate_tls())) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; } #else - if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { + if (new->zero_copy_send) { error_setg(errp, "Zero copy currently only available on Linux"); return false; } #endif =20 - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { - if (!new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (new->postcopy_preempt) { + if (!new->postcopy_ram) { error_setg(errp, "Postcopy preempt requires postcopy-ram"); return false; } @@ -575,22 +545,22 @@ bool migrate_caps_check(bool *old_caps, bool *new_cap= s, Error **errp) } } =20 - if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { + if (new->multifd) { if (!migrate_multifd() && migrate_incoming_started()) { error_setg(errp, "Multifd must be set before incoming starts"); return false; } } =20 - if (new_caps[MIGRATION_CAPABILITY_SWITCHOVER_ACK]) { - if (!new_caps[MIGRATION_CAPABILITY_RETURN_PATH]) { + if (new->switchover_ack) { + if (!new->return_path) { error_setg(errp, "Capability 'switchover-ack' requires capabil= ity " "'return-path'"); return false; } } - if (new_caps[MIGRATION_CAPABILITY_DIRTY_LIMIT]) { - if (new_caps[MIGRATION_CAPABILITY_AUTO_CONVERGE]) { + if (new->dirty_limit) { + if (new->auto_converge) { error_setg(errp, "dirty-limit conflicts with auto-converge" " either of then available currently"); return false; @@ -603,21 +573,21 @@ bool migrate_caps_check(bool *old_caps, bool *new_cap= s, Error **errp) } } =20 - if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { - if (new_caps[MIGRATION_CAPABILITY_XBZRLE]) { + if (new->multifd) { + if (new->xbzrle) { error_setg(errp, "Multifd is not compatible with xbzrle"); return false; } } =20 - if (new_caps[MIGRATION_CAPABILITY_MAPPED_RAM]) { - if (new_caps[MIGRATION_CAPABILITY_XBZRLE]) { + if (new->mapped_ram) { + if (new->xbzrle) { error_setg(errp, "Mapped-ram migration is incompatible with xbzrle"); return false; } =20 - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (new->postcopy_ram) { error_setg(errp, "Mapped-ram migration is incompatible with postcopy= "); return false; @@ -628,7 +598,7 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps,= Error **errp) * On destination side, check the cases that capability is being set * after incoming thread has started. */ - if (migrate_rdma() && !migrate_rdma_caps_check(new_caps, errp)) { + if (migrate_rdma() && !migrate_rdma_caps_check(new, errp)) { return false; } return true; @@ -749,39 +719,37 @@ MigrationCapabilityStatusList *qmp_query_migrate_capa= bilities(Error **errp) for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { caps =3D g_malloc0(sizeof(*caps)); caps->capability =3D i; - caps->state =3D s->capabilities[i]; + caps->state =3D migrate_capability_get_compat(&s->parameters, i); QAPI_LIST_APPEND(tail, caps); } =20 return head; } =20 -void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, +void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *capabilit= ies, Error **errp) { MigrationState *s =3D migrate_get_current(); - MigrationCapabilityStatusList *cap; - bool new_caps[MIGRATION_CAPABILITY__MAX]; + g_autoptr(MigrationParameters) params =3D NULL; =20 if (migration_is_running() || migration_in_colo_state()) { error_setg(errp, "There's a migration process in progress"); return; } =20 - memcpy(new_caps, s->capabilities, sizeof(new_caps)); - for (cap =3D params; cap; cap =3D cap->next) { - new_caps[cap->value->capability] =3D cap->value->state; - } + /* + * Capabilities validation needs to first copy from s->parameters + * in case the incoming capabilities have a capability that + * conflicts with another that's already set. + */ + params =3D QAPI_CLONE(MigrationParameters, &s->parameters); + migrate_capabilities_set_compat(params, capabilities); =20 - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + if (!migrate_caps_check(params, errp)) { return; } =20 - for (cap =3D params; cap; cap =3D cap->next) { - s->capabilities[cap->value->capability] =3D cap->value->state; - } - - migrate_capabilities_set_compat(&s->parameters, params); + migrate_capabilities_set_compat(&s->parameters, capabilities); } =20 /* parameters */ @@ -842,9 +810,8 @@ bool migrate_direct_io(void) * isolated to the main migration thread while multifd channels * process the aligned data with O_DIRECT enabled. */ - return s->parameters.direct_io && - s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM] && - s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; + return s->parameters.direct_io && s->parameters.mapped_ram && + s->parameters.multifd; } =20 uint64_t migrate_downtime_limit(void) @@ -1301,6 +1268,10 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (!migrate_caps_check(params, errp)) { + return false; + } + return true; } =20 @@ -1366,20 +1337,6 @@ void qmp_migrate_set_parameters(MigrationParameters = *params, Error **errp) { MigrationParameters *tmp =3D g_new0(MigrationParameters, 1); =20 - /* - * FIXME: Temporarily while migrate_caps_check is not - * converted to look at s->parameters. Will be gone the end of - * the series. - */ - MigrationState *s =3D migrate_get_current(); - bool new_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; - for (int i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - new_caps[i] =3D migrate_capability_get_compat(&s->parameters, i); - } - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { - return; - } - if (!migrate_params_test_apply(params, tmp, errp)) { return; } diff --git a/migration/options.h b/migration/options.h index cac9201a5e..fcfd120cd7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -1,5 +1,5 @@ /* - * QEMU migration capabilities + * QEMU migration options * * Copyright (c) 2012-2023 Red Hat Inc * @@ -23,8 +23,6 @@ extern const Property migration_properties[]; extern const size_t migration_properties_count; =20 -/* capabilities */ - bool migrate_auto_converge(void); bool migrate_colo(void); bool migrate_dirty_bitmaps(void); @@ -43,22 +41,12 @@ bool migrate_validate_uuid(void); bool migrate_xbzrle(void); bool migrate_zero_copy_send(void); =20 -/* - * pseudo capabilities - * - * These are functions that are used in a similar way to capabilities - * check, but they are not a capability. - */ - bool migrate_multifd_flush_after_each_section(void); bool migrate_postcopy(void); bool migrate_rdma(void); bool migrate_tls(void); =20 -/* capabilities helpers */ - -bool migrate_rdma_caps_check(bool *caps, Error **errp); -bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); +bool migrate_rdma_caps_check(MigrationParameters *config, Error **errp); =20 /* parameters */ =20 @@ -87,14 +75,12 @@ const char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); =20 -/* parameters helpers */ - bool migrate_params_check(MigrationParameters *params, Error **errp); -void migrate_params_init(MigrationParameters *params); void migrate_tls_opts_free(MigrationParameters *params); bool migrate_capability_get_compat(MigrationParameters *params, int i); void migrate_capability_set_compat(MigrationParameters *params, int i, bool val); void migrate_capabilities_set_compat(MigrationParameters *params, MigrationCapabilityStatusList *caps); +bool migrate_caps_check(MigrationParameters *new, Error **errp); #endif diff --git a/migration/savevm.c b/migration/savevm.c index 006514c3e3..e052a4ff97 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -291,7 +291,8 @@ static uint32_t get_validatable_capabilities_count(void) uint32_t result =3D 0; int i; for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->capabilities[i]) { + if (should_validate_capability(i) && + migrate_capability_get_compat(&s->parameters, i)) { result++; } } @@ -313,7 +314,8 @@ static int configuration_pre_save(void *opaque) state->capabilities =3D g_renew(MigrationCapability, state->capabiliti= es, state->caps_count); for (i =3D j =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->capabilities[i]) { + if (should_validate_capability(i) && + migrate_capability_get_compat(&s->parameters, i)) { state->capabilities[j++] =3D i; } } @@ -363,7 +365,7 @@ static bool configuration_validate_capabilities(SaveSta= te *state) continue; } source_state =3D test_bit(i, source_caps_bm); - target_state =3D s->capabilities[i]; + target_state =3D migrate_capability_get_compat(&s->parameters, i); if (source_state !=3D target_state) { error_report("Capability %s is %s, but received capability is = %s", MigrationCapability_str(i), --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914861; cv=none; d=zohomail.com; s=zohoarc; b=SE1ejYS7IHlRYWFBfhQz3pug8QK94IEHDYtiDPsf8GL5QZ0v5G+CCR1MA169BHm11MeJcGyO4l7BnrIBLkWAuyhhGO6z5miidpPHnDa9avOxEcRIvQuXbMRWjdS8lTlMJLWFbzgR8eoRYXp9wDCFmPZns2DkvUOgmYIzDIVHSlc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914861; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YOnlFEdh0OGscX7l0ES+lXHZIhYryPoLD1a5aM71qLU=; b=NrJrP+4zxzGLO6f0K3dIKjItVV7qa2GLMaUid0+XP9SReoZ+n5toTrV3wRQIVcy+5BmMJ0jMjc4evv/ahxT3qV+2/cdnQ42qX4Eezsagz3lS9g+DmQqfmtscdgYkbhce5+vP6bSYd0d0zsH+tRqZFIzFHMNz/XTCj0hj+Jq5KSc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914861621623.0599663374969; Mon, 2 Jun 2025 18:41:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcN-0006xy-T8; Mon, 02 Jun 2025 21:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcK-0006lI-Kk for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:04 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcI-0001YO-VK for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:04 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9F906218EA; Tue, 3 Jun 2025 01:38:51 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1E7B013700; Tue, 3 Jun 2025 01:38:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wLExNClSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914731; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YOnlFEdh0OGscX7l0ES+lXHZIhYryPoLD1a5aM71qLU=; b=w/l+amL4zNrF2AxxYIBzYll6Q8M8IiSInuYEPNIehRTLydYdhjj+byGUGPneJyHfw5lER1 tPd26JWJIlcw6DPExop3XS243rDWvXp4/8qiKnYFY2D5v2NLGmDery7k6Z4vhIOeQoIGRL j5pc65FFNFA/pPO2Lz2WOmM4+X/OsCk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914731; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YOnlFEdh0OGscX7l0ES+lXHZIhYryPoLD1a5aM71qLU=; b=pdq3UprJJSUK4xXiXf59eY2UoyGtDjPBUBFIH3Vu9RIMi2b5mvN+uyVhd8K1YeAwe7UiJU EYlP/c5YpAVfxCAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914731; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YOnlFEdh0OGscX7l0ES+lXHZIhYryPoLD1a5aM71qLU=; b=w/l+amL4zNrF2AxxYIBzYll6Q8M8IiSInuYEPNIehRTLydYdhjj+byGUGPneJyHfw5lER1 tPd26JWJIlcw6DPExop3XS243rDWvXp4/8qiKnYFY2D5v2NLGmDery7k6Z4vhIOeQoIGRL j5pc65FFNFA/pPO2Lz2WOmM4+X/OsCk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914731; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YOnlFEdh0OGscX7l0ES+lXHZIhYryPoLD1a5aM71qLU=; b=pdq3UprJJSUK4xXiXf59eY2UoyGtDjPBUBFIH3Vu9RIMi2b5mvN+uyVhd8K1YeAwe7UiJU EYlP/c5YpAVfxCAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 18/21] qapi/migration: Deprecate capabilities commands Date: Mon, 2 Jun 2025 22:38:07 -0300 Message-Id: <20250603013810.4772-19-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914862739116600 Content-Type: text/plain; charset="utf-8" The concept of capabilities is being merged into the concept of parameters. From now on, the commands that handle capabilities are deprecated in favor of the commands that handle parameters. Affected commands: - migrate-set-capabilities - query-migrate-capabilities Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Tested-by: Mario Casquero --- docs/about/deprecated.rst | 12 ++++++++++++ migration/migration-hmp-cmds.c | 6 ++++++ qapi/migration.json | 16 ++++++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 42037131de..15474833ea 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -605,3 +605,15 @@ command documentation for details on the ``fdset`` usa= ge. =20 The ``zero-blocks`` capability was part of the block migration which doesn't exist anymore since it was removed in QEMU v9.1. + +``migrate-set-capabilities`` command (since 10.1) +''''''''''''''''''''''''''''''''''''''''''''''''' + +This command was deprecated. Use ``migrate-set-parameters`` instead +which now supports setting capabilities. + +``query-migrate-capabilities`` command (since 10.1) +''''''''''''''''''''''''''''''''''''''''''''''''''' + +This command was deprecated. Use ``query-migrate-parameters`` instead +which now supports querying capabilities. diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 6d8d189b81..a8c3515e9d 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -229,6 +229,9 @@ void hmp_info_migrate_capabilities(Monitor *mon, const = QDict *qdict) { MigrationCapabilityStatusList *caps, *cap; =20 + warn_report("info migrate_capabilities is deprecated;" + " use info migrate_parameters instead"); + caps =3D qmp_query_migrate_capabilities(NULL); =20 if (caps) { @@ -608,6 +611,9 @@ void hmp_migrate_set_capability(Monitor *mon, const QDi= ct *qdict) MigrationCapabilityStatus *value; int val; =20 + warn_report("migrate_set_capability is deprecated;" + " use migrate_set_parameter instead"); + val =3D qapi_enum_parse(&MigrationCapability_lookup, cap, -1, &err); if (val < 0) { goto end; diff --git a/qapi/migration.json b/qapi/migration.json index 557a9c523e..7282e4b9eb 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -521,6 +521,11 @@ # # @capabilities: json array of capability modifications to make # +# Features: +# +# @deprecated: This command is deprecated in favor of +# migrate-set-parameters. +# # Since: 1.2 # # .. qmp-example:: @@ -530,7 +535,8 @@ # <- { "return": {} } ## { 'command': 'migrate-set-capabilities', - 'data': { 'capabilities': ['MigrationCapabilityStatus'] } } + 'data': { 'capabilities': ['MigrationCapabilityStatus'] }, + 'features': ['deprecated'] } =20 ## # @query-migrate-capabilities: @@ -539,6 +545,11 @@ # # Returns: @MigrationCapabilityStatus # +# Features: +# +# @deprecated: This command is deprecated in favor of +# query-migrate-parameters. +# # Since: 1.2 # # .. qmp-example:: @@ -554,7 +565,8 @@ # {"state": false, "capability": "x-colo"} # ]} ## -{ 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabil= ityStatus']} +{ 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabil= ityStatus'], + 'features': ['deprecated'] } =20 ## # @MultiFDCompression: --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914878; cv=none; d=zohomail.com; s=zohoarc; b=lnCgMfbihY5lPmEtch1UXA9sL13tUVXSx93+VV8hOn51tG9LbSyaahYCGuN3bmh6DOR6Hpd/xabWTXzTWS/vhwEcKyuozvcHqaHim7Yb9yeCBq1ATAFXQ/9n8t0OVhA07dnMOXEcN6rVP7fi02PL+udSKMOTzQP0xFIiZkMxu20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914878; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=epBEuLQh6pEOwivNhbK3gAU1rtIBrq72yLrwK5T1y9Y=; b=fcTsBdgdX6pl9RZtNm9KeRhxWh5q7UBtOGrfSMIOZqYKhQGE7+gvrVSSipu/cMVvGT65imuQyH0KETrQdJcN4R3nRrxEJIQJ946GsOHME9jwKWHPIuXZs6SttJedFkyQZT2GXYu1sPtdeWJz31kDQt6siKO6TMuEfRXuuqib60M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17489148789697.100009512644874; Mon, 2 Jun 2025 18:41:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcm-0000DA-OC; Mon, 02 Jun 2025 21:39:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcf-0008Vj-E9 for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:25 -0400 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcc-0001fH-PE for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:24 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A74271F452; Tue, 3 Jun 2025 01:38:53 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2438113700; Tue, 3 Jun 2025 01:38:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yPmANStSPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914733; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=epBEuLQh6pEOwivNhbK3gAU1rtIBrq72yLrwK5T1y9Y=; b=OsOQxHMY69yyCdcmOwar+qjnr2vRDj74BTHAy/USNoWjhZI1j8/3uki7sabG478yWcwqGt gZuwyPYb+tbBlNH1Lbxl72OETxRey/TeP+qgP/yYetGwVqf5yXB52YfzpCmhq5QpOXsGLh f0Y+9DuOHoLF7Mm16R8eWTQAqEKapBU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914733; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=epBEuLQh6pEOwivNhbK3gAU1rtIBrq72yLrwK5T1y9Y=; b=EfD9lpVfnqesGybtb+J6xyffvY2AcKLC5x1xxnPPvTaZvrzvc/9atPiftJHTHOsDTbXh53 vP/cAeGkAxzdrZAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OsOQxHMY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=EfD9lpVf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914733; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=epBEuLQh6pEOwivNhbK3gAU1rtIBrq72yLrwK5T1y9Y=; b=OsOQxHMY69yyCdcmOwar+qjnr2vRDj74BTHAy/USNoWjhZI1j8/3uki7sabG478yWcwqGt gZuwyPYb+tbBlNH1Lbxl72OETxRey/TeP+qgP/yYetGwVqf5yXB52YfzpCmhq5QpOXsGLh f0Y+9DuOHoLF7Mm16R8eWTQAqEKapBU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914733; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=epBEuLQh6pEOwivNhbK3gAU1rtIBrq72yLrwK5T1y9Y=; b=EfD9lpVfnqesGybtb+J6xyffvY2AcKLC5x1xxnPPvTaZvrzvc/9atPiftJHTHOsDTbXh53 vP/cAeGkAxzdrZAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 19/21] migration: Allow migrate commands to provide the migration config Date: Mon, 2 Jun 2025 22:38:08 -0300 Message-Id: <20250603013810.4772-20-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: A74271F452 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914881283116600 Content-Type: text/plain; charset="utf-8" Allow the migrate and migrate_incoming commands to pass the migration configuration options all at once, dispensing the use of migrate-set-parameters and migrate-set-capabilities. The motivation of this is to simplify the interface with the management layer and avoid the usage of several command invocations to configure a migration. It also avoids stale parameters from a previous migration to influence the current migration. The options that are changed during the migration can still be set with the existing commands. The order of precedence is: 'config' argument > -global cmdline > defaults (migration_properties) I.e. the config takes precedence over all, values not present in the config assume the default values. The (debug) -global command line option allows the defaults to be overridden. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- migration/migration-hmp-cmds.c | 5 +++-- migration/migration.c | 29 ++++++++++++++++++++++++++--- migration/migration.h | 1 + migration/options.c | 30 ++++++++++++++++++++++++++++++ migration/options.h | 3 +++ qapi/migration.json | 25 +++++++++++++++++++++++-- system/vl.c | 3 ++- 7 files changed, 88 insertions(+), 8 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index a8c3515e9d..38b289e8d8 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -575,7 +575,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qd= ict) } QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); =20 - qmp_migrate_incoming(NULL, true, caps, true, false, &err); + qmp_migrate_incoming(NULL, true, caps, NULL, true, false, &err); qapi_free_MigrationChannelList(caps); =20 end: @@ -952,7 +952,8 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) } QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); =20 - qmp_migrate(NULL, true, caps, false, false, true, resume, &err); + qmp_migrate(NULL, true, caps, NULL, false, false, true, resume, + &err); if (hmp_handle_error(mon, err)) { return; } diff --git a/migration/migration.c b/migration/migration.c index 75c4ec9a95..7b450b8836 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -335,6 +335,7 @@ void migration_object_init(void) current_incoming->exit_on_error =3D INMIGRATE_DEFAULT_EXIT_ON_ERROR; =20 migration_object_check(current_migration, &error_fatal); + migrate_params_store_defaults(current_migration); =20 ram_mig_init(); dirty_bitmap_mig_init(); @@ -1916,13 +1917,24 @@ void migrate_del_blocker(Error **reasonp) =20 void qmp_migrate_incoming(const char *uri, bool has_channels, MigrationChannelList *channels, - bool has_exit_on_error, bool exit_on_error, - Error **errp) + MigrationParameters *config, bool has_exit_on_er= ror, + bool exit_on_error, Error **errp) { Error *local_err =3D NULL; static bool once =3D true; + MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 + if (config) { + /* + * If a config was provided, all options set previously get + * ignored. + */ + if (!migrate_params_override(s, config, errp)) { + return; + } + } + if (!once) { error_setg(errp, "The incoming migration has already been started"= ); return; @@ -2182,7 +2194,8 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, } =20 void qmp_migrate(const char *uri, bool has_channels, - MigrationChannelList *channels, bool has_detach, bool det= ach, + MigrationChannelList *channels, + bool has_detach, bool detach, MigrationParameters *config, bool has_resume, bool resume, Error **errp) { bool resume_requested; @@ -2193,6 +2206,16 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; MigrationChannel *cpr_channel =3D NULL; =20 + if (config) { + /* + * If a config was provided, all options set previously get + * ignored. + */ + if (!migrate_params_override(s, config, errp)) { + return; + } + } + /* * Having preliminary checks for uri and channel */ diff --git a/migration/migration.h b/migration/migration.h index 993d51aedd..49761f4699 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -319,6 +319,7 @@ struct MigrationState { =20 /* params from 'migrate-set-parameters' */ MigrationParameters parameters; + MigrationParameters defaults; =20 MigrationStatus state; =20 diff --git a/migration/options.c b/migration/options.c index fa3f7035c8..dd2288187d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1333,6 +1333,36 @@ static void migrate_params_apply(MigrationParameters= *params) params->block_bitmap_mapping); } =20 +void migrate_params_store_defaults(MigrationState *s) +{ + /* + * The defaults set for each qdev property in migration_properties + * will be stored as the default values for each migration + * parameter. For debugging, using -global can override the + * defaults. + */ + QAPI_CLONE_MEMBERS(MigrationParameters, &s->defaults, &s->parameters); +} + +bool migrate_params_override(MigrationState *s, MigrationParameters *new, + Error **errp) +{ + ERRP_GUARD(); + + assert(bql_locked()); + + /* reset to default parameters */ + migrate_params_apply(&s->defaults); + + /* overwrite with the new ones */ + qmp_migrate_set_parameters(new, errp); + if (*errp) { + return false; + } + + return true; +} + void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { MigrationParameters *tmp =3D g_new0(MigrationParameters, 1); diff --git a/migration/options.h b/migration/options.h index fcfd120cd7..3630c2a0dd 100644 --- a/migration/options.h +++ b/migration/options.h @@ -83,4 +83,7 @@ void migrate_capability_set_compat(MigrationParameters *p= arams, int i, void migrate_capabilities_set_compat(MigrationParameters *params, MigrationCapabilityStatusList *caps); bool migrate_caps_check(MigrationParameters *new, Error **errp); +void migrate_params_store_defaults(MigrationState *s); +bool migrate_params_override(MigrationState *s, MigrationParameters *new, + Error **errp); #endif diff --git a/qapi/migration.json b/qapi/migration.json index 7282e4b9eb..64a92d8d28 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1474,9 +1474,16 @@ # # @resume: resume one paused migration, default "off". (since 3.0) # +# @config: migration configuration options, previously set via +# @migrate-set-parameters and @migrate-set-capabilities. (since +# 10.1) +# # Features: # # @deprecated: Argument @detach is deprecated. +# @config: Indicates this command can receive the entire migration +# configuration via the @config field, dispensing the use of +# @migrate-set-parameters. # # Since: 0.14 # @@ -1538,7 +1545,9 @@ 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], '*detach': { 'type': 'bool', 'features': [ 'deprecated' ] }, - '*resume': 'bool' } } + '*config': 'MigrationParameters', + '*resume': 'bool' }, + 'features': [ 'config' ] } =20 ## # @migrate-incoming: @@ -1557,6 +1566,16 @@ # error details could be retrieved with query-migrate. # (since 9.1) # +# @config: migration configuration options, previously set via +# @migrate-set-parameters and @migrate-set-capabilities. (since +# 10.1) +# +# Features: +# +# @config: Indicates this command can receive the entire migration +# configuration via the @config field, dispensing the use of +# @migrate-set-parameters. +# # Since: 2.3 # # .. admonition:: Notes @@ -1610,7 +1629,9 @@ { 'command': 'migrate-incoming', 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], - '*exit-on-error': 'bool' } } + '*config': 'MigrationParameters', + '*exit-on-error': 'bool' }, + 'features': [ 'config' ] } =20 ## # @xen-save-devices-state: diff --git a/system/vl.c b/system/vl.c index 3b7057e6c6..b29fd24d08 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2823,7 +2823,8 @@ void qmp_x_exit_preconfig(Error **errp) g_new0(MigrationChannelList, 1); =20 channels->value =3D incoming_channels[MIGRATION_CHANNEL_TYPE_M= AIN]; - qmp_migrate_incoming(NULL, true, channels, true, true, &local_= err); + qmp_migrate_incoming(NULL, true, channels, NULL, true, true, + &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914882; cv=none; d=zohomail.com; s=zohoarc; b=m1v1zgLE41WOsoSYNij7u2TntEQehgQ8urIGtNHHgY0ooP+ProDpu4oq1//9kbhUWWYDtrqZBbFLsZNn0oa8gu8d9UVY3QR7ER+z9b9vsvDG724qJifbQXT8WFv4ZpSHMnjDy3iRXhry1MUlM3KCA6OfHHk6/nu9ARJuV1lmiGs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914882; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3lrSuRRehGrtYStPZqJ9prQPWAOWCGp846AmysDb8II=; b=SJaKY2ZjotURAdBhi+FSISf5G5lgEqDdHeDNkL6+CranibfY2A9bDUGtUP/CL/UvwDI67H6rg2RFo6pC1ro6ztIbLs70H7dERhd6PjS2lFOycPsBQe6Sh4WDcswgFSPhL2ZKdLJwuycVStIQSYjhw/DEHbjlGmZVmys49KCi/oY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174891488284213.436507253429909; Mon, 2 Jun 2025 18:41:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcR-0007G7-K5; Mon, 02 Jun 2025 21:39:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcQ-00079b-Dy for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:10 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcO-0001aF-IM for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:09 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AB6BF218E0; Tue, 3 Jun 2025 01:38:55 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2A53213700; Tue, 3 Jun 2025 01:38:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id AMLjNi1SPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914735; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3lrSuRRehGrtYStPZqJ9prQPWAOWCGp846AmysDb8II=; b=yjk5GCl3Rq7DIAYqW/BOjLZWs96h1qs3aoQ5Psyw4hofbbDnhtQK8hSRqx25X4GCQCqphm z/pM/PAQTR2nliE76ZgKBZqxI+GeQuESeV3Y4NT7r0iGEZWrk243P0j1+TP/B2UJ3mZDMb zbf7VBEVROb9hJL2akpQ4lk+jPGhU8g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914735; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3lrSuRRehGrtYStPZqJ9prQPWAOWCGp846AmysDb8II=; b=8fhAUTTr7/+5GPu3eg6y88AQj5vBAiqQ1ip05pBvF0FyXO8Mp37SzdWfph1FlVnEyYCYP1 XXq4PaOulg2aZcDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914735; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3lrSuRRehGrtYStPZqJ9prQPWAOWCGp846AmysDb8II=; b=yjk5GCl3Rq7DIAYqW/BOjLZWs96h1qs3aoQ5Psyw4hofbbDnhtQK8hSRqx25X4GCQCqphm z/pM/PAQTR2nliE76ZgKBZqxI+GeQuESeV3Y4NT7r0iGEZWrk243P0j1+TP/B2UJ3mZDMb zbf7VBEVROb9hJL2akpQ4lk+jPGhU8g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914735; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3lrSuRRehGrtYStPZqJ9prQPWAOWCGp846AmysDb8II=; b=8fhAUTTr7/+5GPu3eg6y88AQj5vBAiqQ1ip05pBvF0FyXO8Mp37SzdWfph1FlVnEyYCYP1 XXq4PaOulg2aZcDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 20/21] libqtest: Add a function to check whether a QMP command supports a feature Date: Mon, 2 Jun 2025 22:38:09 -0300 Message-Id: <20250603013810.4772-21-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914884949116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- tests/qtest/libqtest.c | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/qtest/libqtest.h | 12 ++++++++++++ 2 files changed, 54 insertions(+) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 94526b7f9c..7ee4831841 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -34,6 +34,9 @@ #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/sockets.h" +#include "qapi/error.h" +#include "qapi/qapi-visit-introspect.h" +#include "qapi/qobject-input-visitor.h" #include "qobject/qdict.h" #include "qobject/qjson.h" #include "qobject/qlist.h" @@ -2091,3 +2094,42 @@ bool mkimg(const char *file, const char *fmt, unsign= ed size_mb) =20 return ret && !err; } + +bool qtest_qmp_cmd_has_feature(QTestState *qts, const char *cmd, + const char *feature) +{ + QDict *resp; + Visitor *qiv; + SchemaInfoList *tail; + SchemaInfo *si; + strList *str; + + resp =3D qtest_qmp(qts, "{ 'execute': 'query-qmp-schema' }"); + + qiv =3D qobject_input_visitor_new(qdict_get(resp, "return")); + visit_type_SchemaInfoList(qiv, NULL, &tail, &error_abort); + visit_free(qiv); + qobject_unref(resp); + + for (; tail; tail =3D tail->next) { + si =3D tail->value; + + if (si->meta_type !=3D SCHEMA_META_TYPE_COMMAND) { + continue; + } + + if (g_str_equal(si->name, cmd)) { + break; + } + } + + if (tail && si->has_features) { + for (str =3D si->features; str; str =3D str->next) { + if (g_str_equal(str->value, feature)) { + return true; + } + } + } + + return false; +} diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index b3f2e7fbef..c609316223 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -1153,4 +1153,16 @@ bool have_qemu_img(void); */ bool mkimg(const char *file, const char *fmt, unsigned size_mb); =20 +/** + * qtest_qmp_cmd_has_feature: + * @qts: QTestState instance + * @cmd: The QMP command being introspected + * @feature: Name of the feature to be checked + * + * Returns: true if the QMP command @cmd supports @feature, false otherwis= e. + */ +bool qtest_qmp_cmd_has_feature(QTestState *qts, const char *cmd, + const char *feature); + + #endif --=20 2.35.3 From nobody Sat Nov 15 16:09:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1748914870; cv=none; d=zohomail.com; s=zohoarc; b=czp4pu5Otc9aordxl/xZGBw0+pJI6WdGqeTow3p4kKUOummcfNq9iWJ3IK76hLHKqKhe5aAldoxc/E7jkZRwTA/5uxR5SkKwycei+7bvRd4wJb23KwbqugN6qNGo1IdC/7YMjmteOLD0srDXECgmZASAqfUfyjEYaLOUSmFQv1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748914870; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zi66cgU68uNxi8+JjcmFVcITaSr2nzElUOJtcyAAYdw=; b=fwOGe9c9tYVYjHP0ylLXhZTYVqGzr3KW+vvSFZelr/q7F+4CXLtL49Z9CWTJmX6V+Nzs+LH6P4aab1g7xV2xpoeitmuoJhVwYnobFv8uBGWwNY6FhGuCE++ZJcse/Ylr9MsnernUEob2C1L++Of0NxW8hK58vivQVgrpb+n1i5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748914870145402.87170386320554; Mon, 2 Jun 2025 18:41:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMGcw-0000Td-5b; Mon, 02 Jun 2025 21:39:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uMGcl-0000HE-CQ for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:32 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMGcj-0001gC-CO for qemu-devel@nongnu.org; Mon, 02 Jun 2025 21:39:31 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BA85D1F745; Tue, 3 Jun 2025 01:38:57 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2D89013700; Tue, 3 Jun 2025 01:38:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id SFjDNy9SPmiNLwAAD6G6ig (envelope-from ); Tue, 03 Jun 2025 01:38:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914737; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zi66cgU68uNxi8+JjcmFVcITaSr2nzElUOJtcyAAYdw=; b=cUrP6BFcWczbbm9L3a2M2d6mLC9m0Bx+zDh2AULoAInZksgphB+5UyLcEwTcLLZzvdVmio GU1TpovJOcinm95Krcj7cDvvczd8nqoS1ucbI1xZi+HHnOtyd34tURpSr/888CkYSKTT1p u4JdFLVkubEMxLwI+Cwk37wxcVSTvOU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914737; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zi66cgU68uNxi8+JjcmFVcITaSr2nzElUOJtcyAAYdw=; b=rWWdliYh0KA/KMtri1DvmPy4sFaHtrNm+v/KQgfP2HhDNlG1i8R/nLHSrXYiq40kHqUPua kHx+1xzlSXxMAbCw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1748914737; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zi66cgU68uNxi8+JjcmFVcITaSr2nzElUOJtcyAAYdw=; b=cUrP6BFcWczbbm9L3a2M2d6mLC9m0Bx+zDh2AULoAInZksgphB+5UyLcEwTcLLZzvdVmio GU1TpovJOcinm95Krcj7cDvvczd8nqoS1ucbI1xZi+HHnOtyd34tURpSr/888CkYSKTT1p u4JdFLVkubEMxLwI+Cwk37wxcVSTvOU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1748914737; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zi66cgU68uNxi8+JjcmFVcITaSr2nzElUOJtcyAAYdw=; b=rWWdliYh0KA/KMtri1DvmPy4sFaHtrNm+v/KQgfP2HhDNlG1i8R/nLHSrXYiq40kHqUPua kHx+1xzlSXxMAbCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 21/21] tests/qtest/migration: Add a test for config passing Date: Mon, 2 Jun 2025 22:38:10 -0300 Message-Id: <20250603013810.4772-22-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250603013810.4772-1-farosas@suse.de> References: <20250603013810.4772-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1748914870877116600 Content-Type: text/plain; charset="utf-8" Pass the config directly via the migrate/incoming command. Signed-off-by: Fabiano Rosas Tested-by: Mario Casquero --- tests/qtest/migration/framework.h | 2 ++ tests/qtest/migration/misc-tests.c | 39 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 01e425e64e..e55cd33fa8 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -145,6 +145,8 @@ typedef struct { /* Optional: fine tune start parameters */ MigrateStart start; =20 + const char *config; + /* Required: the URI for the dst QEMU to listen on */ const char *listen_uri; =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 54995256d8..e835865aee 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -256,6 +256,42 @@ static void test_validate_uri_channels_none_set(void) do_test_validate_uri_channel(&args); } =20 +static void test_config_migrate(void) +{ + QTestState *from, *to; + MigrateStart args =3D { + .hide_stderr =3D false, + }; + const char *config =3D "{" + "'events':true, " + "'multifd':true, " + "'multifd-channels': 4" + "}"; + + if (migrate_start(&from, &to, "defer", &args)) { + return; + } + + assert(qtest_qmp_cmd_has_feature(from, "migrate", "config")); + + wait_for_serial("src_serial"); + qtest_qmp_assert_success(from, "{ 'execute' : 'stop'}"); + migrate_ensure_converge(from); + + migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, + "{ 'exit-on-error': false, 'config': %p }", + qobject_from_json(config, &error_abort)); + + migrate_qmp(from, to, migrate_get_connect_uri(to), NULL, + "{ 'config': %p }", + qobject_from_json(config, &error_abort)); + + wait_for_migration_complete(from); + wait_for_migration_complete(to); + + migrate_end(from, to, false); +} + static void migration_test_add_misc_smoke(MigrationTestEnv *env) { #ifndef _WIN32 @@ -294,4 +330,7 @@ void migration_test_add_misc(MigrationTestEnv *env) test_validate_uri_channels_both_set); migration_test_add("/migration/validate_uri/channels/none_set", test_validate_uri_channels_none_set); + + migration_test_add("/migration/config/migrate", + test_config_migrate); } --=20 2.35.3