From nobody Sat Nov 15 12:43:52 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=1751313587; cv=none; d=zohomail.com; s=zohoarc; b=QBZZfl1B5y3jR3th0rgNFj3bYvs5ySJanyGzWmz/LmHDUEggln7K0Sq6JmCPmCfwD4kP8avnczRUardp5K3Dgfuqz/TGc43MobZ2wBd/ZC2tJlcUBUWSREoUJrBRWuns4fkM7nA5zFeykNW8mthboQ3B1YQQeF5bAlQbcuE2ihU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313587; 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=R8sBxHCz6UsEHsBrqDBr0hFHfzK51JJaKNlFGGAXLwU=; b=G7DAP79bxYymEXjWLapB67y0n/LwA+nR4AnVXJyvHnLmwyLQfsFv24fhZBnc835lsVw59feulqcCglH3hOsycsHfaqt6t5RQVd4GuGR4jobWvXI2WH6zejwTzfepi242zcsxtPoy2kAoiO6E3CLAteyP6cTCrBcnmV/t+T+yiEg= 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 1751313587103790.6233218988749; Mon, 30 Jun 2025 12:59:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKf6-0002X2-MP; Mon, 30 Jun 2025 15:59:32 -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 1uWKf0-0002W5-Jl for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:26 -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 1uWKey-0007S7-HI for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:26 -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 2086D2115E; Mon, 30 Jun 2025 19:59:20 +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 952541399F; Mon, 30 Jun 2025 19:59:18 +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 iAySFZbsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313560; 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=R8sBxHCz6UsEHsBrqDBr0hFHfzK51JJaKNlFGGAXLwU=; b=n0Mj1B0nvKXgmPoqjldpRFmOzPEsL9wt+0QSFiAZbuU3wU+G6H4pbnLtBs7//3UT2wt6T2 rf1xVCaT9XESYxbTteOImxbAhMW65BHuj9jS0jgJ9O3A+4oxWrHcSo+cXr6zq1Pp+iSx5X ZhbI/wOk3gDWG0S7bTUKc+vc78Myt9M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313560; 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=R8sBxHCz6UsEHsBrqDBr0hFHfzK51JJaKNlFGGAXLwU=; b=BU2th09RJ4BRLkUXmmt/UH88rarzsMx5QfQ/gIiGXKQgjz9fcODz84g9+dkdqHEbIryCGg 6/3MulkFvMkNI/AQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313560; 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=R8sBxHCz6UsEHsBrqDBr0hFHfzK51JJaKNlFGGAXLwU=; b=n0Mj1B0nvKXgmPoqjldpRFmOzPEsL9wt+0QSFiAZbuU3wU+G6H4pbnLtBs7//3UT2wt6T2 rf1xVCaT9XESYxbTteOImxbAhMW65BHuj9jS0jgJ9O3A+4oxWrHcSo+cXr6zq1Pp+iSx5X ZhbI/wOk3gDWG0S7bTUKc+vc78Myt9M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313560; 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=R8sBxHCz6UsEHsBrqDBr0hFHfzK51JJaKNlFGGAXLwU=; b=BU2th09RJ4BRLkUXmmt/UH88rarzsMx5QfQ/gIiGXKQgjz9fcODz84g9+dkdqHEbIryCGg 6/3MulkFvMkNI/AQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 01/24] migration: Fix leak of block_bitmap_mapping Date: Mon, 30 Jun 2025 16:58:50 -0300 Message-Id: <20250630195913.28033-2-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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,suse.de:mid,suse.de:email]; 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313589466116600 Content-Type: text/plain; charset="utf-8" Caught by inspection, but ASAN also reports: Direct leak of 16 byte(s) in 1 object(s) allocated from: #0 in malloc #1 in g_malloc #2 in g_memdup #3 in qapi_clone_start_struct ../qapi/qapi-clone-visitor.c:40:12 #4 in qapi_clone_start_list ../qapi/qapi-clone-visitor.c:59:12 #5 in visit_start_list ../qapi/qapi-visit-core.c:80:10 #6 in visit_type_BitmapMigrationNodeAliasList qapi/qapi-visit-migration.c:= 639:10 #7 in migrate_params_apply ../migration/options.c:1407:13 #8 in qmp_migrate_set_parameters ../migration/options.c:1463:5 #9 in qmp_marshal_migrate_set_parameters qapi/qapi-commands-migration.c:21= 4:5 #10 in do_qmp_dispatch_bh ../qapi/qmp-dispatch.c:128:5 Signed-off-by: Fabiano Rosas Reviewed-by: Markus Armbruster Reviewed-by: Peter Xu --- migration/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/migration.c b/migration/migration.c index 4098870bce..7ec60d97f9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4050,6 +4050,7 @@ static void migration_instance_finalize(Object *obj) { MigrationState *ms =3D MIGRATION_OBJ(obj); =20 + qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313628; cv=none; d=zohomail.com; s=zohoarc; b=Lm5D27FqwYi9o6tZt92o7NJfLdgftP9EJO9ePaeU9JCr0mgj71rKmzJQJngP9fuMCnqII8r94W8DzNGcNMUDfKMtQTKKXuhYswosLebVid/HEJaJJEXm+50SvvUX+vhVN7AW18aD7Y1mlQPTXl/Z73s7u8uS4B33GCjI759frv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313628; 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=DqJoHTBSRcc/4YjI8DdE3M7UxBxe/r5RCR2ucSwG+oE=; b=Ab7YJdKa9rR7Mv27mM1seV9lqX8bprJEb2DtgriNZ+JMuY+tLyJsA0FCpuquoyV+/HeNbHMdRvmZm2TW9aquFElURadgZe4FvgU+wZfI9vqGGxwmvWvrmh3z/woaRYpdgLZsmr5iPFhBl3zAeEYH+jC0RUu+v4JWzucS67IOIT8= 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 1751313628111447.31415112034017; Mon, 30 Jun 2025 13:00:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKf9-0002Xh-Pt; Mon, 30 Jun 2025 15:59:35 -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 1uWKf6-0002Wt-5t for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:32 -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 1uWKf4-0007St-CA for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59: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 33C9521161; Mon, 30 Jun 2025 19:59:22 +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 9DAC11399F; Mon, 30 Jun 2025 19:59:20 +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 sKSxF5jsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313562; 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=DqJoHTBSRcc/4YjI8DdE3M7UxBxe/r5RCR2ucSwG+oE=; b=WK9XlLMYZOr05baFzcMDCRGn+Q8r5RYKN3isWlPefcTSbd8MlnEt6PbUDrKwLy+Xh0yFIn ESTDcV6IodIrFYr9E+oTTBuSKNjVPXtoAs8DzUkv+kaNtrnHoAKM1GNmX/DtuIeLaQLDQ7 opg5YkGDO6KeNg2VUMjRF6dNKm5pAOY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313562; 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=DqJoHTBSRcc/4YjI8DdE3M7UxBxe/r5RCR2ucSwG+oE=; b=+UaFsfVLwir9bLtc1uSHCv9t83Jeb5hCt6vtiCJPpu5V5C4NJhDlmGy9dBBcqTXnIYYzwK Y68IFxL8cOTTq+Cg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313562; 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=DqJoHTBSRcc/4YjI8DdE3M7UxBxe/r5RCR2ucSwG+oE=; b=WK9XlLMYZOr05baFzcMDCRGn+Q8r5RYKN3isWlPefcTSbd8MlnEt6PbUDrKwLy+Xh0yFIn ESTDcV6IodIrFYr9E+oTTBuSKNjVPXtoAs8DzUkv+kaNtrnHoAKM1GNmX/DtuIeLaQLDQ7 opg5YkGDO6KeNg2VUMjRF6dNKm5pAOY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313562; 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=DqJoHTBSRcc/4YjI8DdE3M7UxBxe/r5RCR2ucSwG+oE=; b=+UaFsfVLwir9bLtc1uSHCv9t83Jeb5hCt6vtiCJPpu5V5C4NJhDlmGy9dBBcqTXnIYYzwK Y68IFxL8cOTTq+Cg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 02/24] migration: Add a qdev property for StrOrNull Date: Mon, 30 Jun 2025 16:58:51 -0300 Message-Id: <20250630195913.28033-3-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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)[suse.de:mid,suse.de:email,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=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: 1751313630155116600 Content-Type: text/plain; charset="utf-8" The MigrationState is a QOM object with TYPE_DEVICE as a parent. This was done about eight years ago so the migration code could make use of qdev properties to define the defaults for the migration parameters and to be able to expose migration knobs for debugging via the '-global migration' command line option. Due to unrelated historical reasons, three of the migration parameters (TLS options) received different types when used via the query-migrate-parameters QMP command than with the migrate-set-parameters command. This has created a lot of duplication in the migration code and in the QAPI documentation because the whole of MigrationParameters had to be duplicated as well. The migration code is now being fixed to remove the duplication and for that to happen the offending fields need to be reconciled into a single type. The StrOrNull type is going to be used. To keep the command line compatibility, the parameters need to continue being exposed via qdev properties accessible from the command line. Introduce a qdev property StrOrNull just for that. Note that this code is being kept in migration/options.c because this version of StrOrNull doesn't need to handle QNULL because it was never a valid option in the previous command line, which took a string. Signed-off-by: Fabiano Rosas --- migration/options.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/migration/options.c b/migration/options.c index 162c72cda4..384ef9e421 100644 --- a/migration/options.c +++ b/migration/options.c @@ -83,6 +83,11 @@ #define DEFINE_PROP_MIG_CAP(name, x) \ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 +const PropertyInfo qdev_prop_StrOrNull; +#define DEFINE_PROP_STR_OR_NULL(_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_StrOrNull, StrOrNull *, \ + .set_default =3D true) + #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */ =20 @@ -204,6 +209,48 @@ const Property migration_properties[] =3D { }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 +/* + * qdev property for TLS options handling via '-global migration' + * command line. + */ +static void set_StrOrNull(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + const Property *prop =3D opaque; + StrOrNull **ptr =3D object_field_prop_ptr(obj, prop); + StrOrNull *str_or_null =3D g_new0(StrOrNull, 1); + + /* + * Only str to keep compatibility, QNULL was never used via + * command line. + */ + str_or_null->type =3D QTYPE_QSTRING; + if (!visit_type_str(v, name, &str_or_null->u.s, errp)) { + return; + } + + qapi_free_StrOrNull(*ptr); + *ptr =3D str_or_null; +} + +static void release_StrOrNull(Object *obj, const char *name, void *opaque) +{ + const Property *prop =3D opaque; + qapi_free_StrOrNull(*(StrOrNull **)object_field_prop_ptr(obj, prop)); +} + +static void set_default_value_tls_opt(ObjectProperty *op, const Property *= prop) +{ + object_property_set_default_str(op, ""); +} + +const PropertyInfo qdev_prop_StrOrNull =3D { + .type =3D "StrOrNull", + .set =3D set_StrOrNull, + .release =3D release_StrOrNull, + .set_default_value =3D set_default_value_tls_opt, +}; + bool migrate_auto_converge(void) { MigrationState *s =3D migrate_get_current(); --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313589; cv=none; d=zohomail.com; s=zohoarc; b=HWTcKSOPR6duAWNlrUVAvkFu5R3ZcL4BUzBHd12lsKfPuVdJRXCL+1ahCSlGE0Lwfn3v68bfbbZCmnJB6PpNg8ZEl9tstkq7toPrar7KGBH3V3S9NnGe/JWQEDqDTVyu6QHM9SqPlc4FSoMiL1agNrtMzLB90SAGBARyylE/K4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313589; 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=RDvcSIXfqYxA+umokAr0UpiFTPC5+l3e0ZJItgJfC9E=; b=LOBPxrrubYzYv8QLh1Sf5dI1wj/5JiNCQtE4ucfmHaBxY3p3WQ3KQUxFoG20eL704Y0HiMveyxUBt/ts7UtrwgP3FXRWKEbp08qCoPvdu4i132vHEAnqzvE+hkRbZAHKnrauukwNqK1sYBxW9OCmm9npN4lI0/hRMBaayp0zAOc= 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 1751313588865142.38219300341507; Mon, 30 Jun 2025 12:59:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfF-0002YQ-MG; Mon, 30 Jun 2025 15:59: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 1uWKfD-0002YF-Dm for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:39 -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 1uWKfA-0007TI-HA for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:38 -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 7A67E21162; Mon, 30 Jun 2025 19:59:24 +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 ADC901399F; Mon, 30 Jun 2025 19:59:22 +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 aJeyG5rsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313564; 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=RDvcSIXfqYxA+umokAr0UpiFTPC5+l3e0ZJItgJfC9E=; b=xuIn/zFlp+DWTvNgo1faRfJhD8Dch2L7UaDs/RgPiVAFRqkaFUNPgIErYK+SSp3xpuTvzd mogUhTt5hl8reA9gNsTbggAcyXgrSySnyW0PtJ0rLhs5nSGiGJEZ1+yyYheX/WxkEVu4ah wvX423oLdypc5v69kyvQG1iOa5B9RZ8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313564; 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=RDvcSIXfqYxA+umokAr0UpiFTPC5+l3e0ZJItgJfC9E=; b=dbOVAG29v7KFNXV6ayU5Jgxjf0FwCW3qLkPcXzyUBej/dUmd98znwAExS9DkPs/lb5jnsH spDOqFvfvBo0slBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313564; 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=RDvcSIXfqYxA+umokAr0UpiFTPC5+l3e0ZJItgJfC9E=; b=xuIn/zFlp+DWTvNgo1faRfJhD8Dch2L7UaDs/RgPiVAFRqkaFUNPgIErYK+SSp3xpuTvzd mogUhTt5hl8reA9gNsTbggAcyXgrSySnyW0PtJ0rLhs5nSGiGJEZ1+yyYheX/WxkEVu4ah wvX423oLdypc5v69kyvQG1iOa5B9RZ8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313564; 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=RDvcSIXfqYxA+umokAr0UpiFTPC5+l3e0ZJItgJfC9E=; b=dbOVAG29v7KFNXV6ayU5Jgxjf0FwCW3qLkPcXzyUBej/dUmd98znwAExS9DkPs/lb5jnsH spDOqFvfvBo0slBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake Subject: [PATCH v2 03/24] migration: Normalize tls arguments Date: Mon, 30 Jun 2025 16:58:52 -0300 Message-Id: <20250630195913.28033-4-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,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: 1751313591750116600 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. Also ensure that QTYPE_QNULL is never used. 1) migrate-set-parameters will always write QTYPE_QSTRING to s->parameters, either an empty or non-empty string. 2) query-migrate-parameters will always return a QTYPE_QSTRING, either empty or non-empty. 3) the migrate_tls_* helpers will always return a non-empty string or NULL, for the internal migration code's consumption. Points (1) and (2) above help simplify the parameters validation and the query command handling because s->parameters is already kept in the format that query-migrate-parameters (and info migrate_paramters) expect. Point (3) is so people don't need to care about StrOrNull in migration code. This will allow the type duplication to be removed in the next patches. Note that the type of @tls_creds, @tls-hostname, @tls-authz changes from str to StrOrNull in introspection of the query-migrate-parameters command. We accept this imprecision to enable de-duplication. There's no need to free the TLS options in migration_instance_finalize() because they're freed by the qdev properties .release method. Temporary in this patch: migrate_params_test_apply() copies s->parameters into a temporary structure, so it's necessary to drop the references to the TLS options if they were not set by the user to avoid double-free. This is fixed in the next patches. Signed-off-by: Fabiano Rosas Acked-by: Markus Armbruster --- migration/migration-hmp-cmds.c | 7 +- migration/options.c | 156 ++++++++++++++++++++------------- migration/options.h | 1 + migration/tls.c | 2 +- qapi/migration.json | 6 +- 5 files changed, 106 insertions(+), 66 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index e8a563c7d8..547384edb5 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -279,11 +279,11 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) assert(params->tls_creds); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), - params->tls_creds); + params->tls_creds->u.s); assert(params->tls_hostname); 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), @@ -317,9 +317,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), params->max_postcopy_bandwidth); + assert(params->tls_authz); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz); + params->tls_authz->u.s); =20 if (params->has_block_bitmap_mapping) { const BitmapMigrationNodeAliasList *bmnal; diff --git a/migration/options.c b/migration/options.c index 384ef9e421..f7bbdba5fc 100644 --- a/migration/options.c +++ b/migration/options.c @@ -167,9 +167,10 @@ 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), + DEFINE_PROP_STR_OR_NULL("tls-creds", MigrationState, parameters.tls_cr= eds), + DEFINE_PROP_STR_OR_NULL("tls-hostname", MigrationState, + parameters.tls_hostname), + DEFINE_PROP_STR_OR_NULL("tls-authz", MigrationState, parameters.tls_au= thz), DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, parameters.x_vcpu_dirty_limit_period, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), @@ -241,6 +242,11 @@ static void release_StrOrNull(Object *obj, const char = *name, void *opaque) =20 static void set_default_value_tls_opt(ObjectProperty *op, const Property *= prop) { + /* + * Initialization to the empty string here is important so + * query-migrate-parameters doesn't need to deal with a NULL value + * when it's called before any TLS option has been set. + */ object_property_set_default_str(op, ""); } =20 @@ -426,13 +432,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, @@ -881,21 +880,38 @@ const char *migrate_tls_authz(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_authz; + if (*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->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->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) @@ -935,6 +951,37 @@ 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); +} + +/* either non-empty or empty string */ +static void tls_opt_to_str(StrOrNull **tls_opt) +{ + StrOrNull *opt =3D *tls_opt; + + if (!opt) { + return; + } + + switch (opt->type) { + case QTYPE_QSTRING: + return; + case QTYPE_QNULL: + qobject_unref(opt->u.n); + break; + default: + g_assert_not_reached(); + } + + opt->type =3D QTYPE_QSTRING; + opt->u.s =3D g_strdup(""); + *tls_opt =3D opt; +} + MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; @@ -950,10 +997,9 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **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 : ""); + params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); + params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); + params->tls_authz =3D QAPI_CLONE(StrOrNull, 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; @@ -1010,9 +1056,6 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **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; @@ -1189,7 +1232,7 @@ 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->u.s)) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; @@ -1251,18 +1294,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; + dest->tls_creds =3D QAPI_CLONE(StrOrNull, 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; + dest->tls_hostname =3D QAPI_CLONE(StrOrNull, 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; + dest->tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_authz); + } else { + /* drop the reference, it's owned by s->parameters */ + dest->tls_authz =3D NULL; } =20 if (params->has_max_bandwidth) { @@ -1367,21 +1416,19 @@ 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); + s->parameters.tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_cred= s); } =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); + s->parameters.tls_hostname =3D QAPI_CLONE(StrOrNull, + params->tls_hostname); } =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); + s->parameters.tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_auth= z); } =20 if (params->has_max_bandwidth) { @@ -1480,32 +1527,23 @@ 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(""); - } + /* + * Convert QTYPE_QNULL and NULL to the empty string (""). Even + * though NULL is cleaner to deal with in C code, that would force + * query-migrate-parameters to convert it once more to the empty + * string, so avoid that. The migrate_tls_*() helpers that expose + * the options to the rest of the migration code already use + * return NULL when the empty string is found. + */ + tls_opt_to_str(¶ms->tls_creds); + tls_opt_to_str(¶ms->tls_hostname); + tls_opt_to_str(¶ms->tls_authz); =20 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 4963f6ca12..97bb022c45 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 12:43:52 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=1751313793; cv=none; d=zohomail.com; s=zohoarc; b=AB5QT2GNs+rBbo4ZouFs143v1WkUA87Z2Z10nAQ4Izx4y2b+iCADlHnXUe4HfX2qrx3XdGVTlQPxptVtvmvSCYhg6dxQZbyL3Jpa1ESoxsSI/crJ537mcJr2DoIwOTfcR8TKHFAaVXGwfK3Ue5AgAqkkKLmn9jCcmTQ/lTfc5EA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313793; 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=8I9/g8PQ1WCYmeOD3mjrCAm9CXTbjIpjJls6Evrlddg=; b=RfHNqx3Rc6jqAQB11o/Ez+deVuh1fPhcJ/0M1SZov9ymqoA4Egs66T6lHqVlXLKAJWZbFcJF24F9z8j31ZKrmbOAPyiqIXlepyab+MymHOw3QFSDG6DYzuU9Ir+bTrR7jQUxXZlX9it30BqzyUD085hzg8sWuNWypMuyVZZIEuA= 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 1751313793675588.9787493214916; Mon, 30 Jun 2025 13:03:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfT-0002iC-3x; Mon, 30 Jun 2025 15:59: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 1uWKfP-0002fC-8E for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:52 -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 1uWKfI-0007Tr-Oi for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:49 -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 C701B2115E; Mon, 30 Jun 2025 19:59:26 +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 087411399F; Mon, 30 Jun 2025 19:59:24 +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 +AfRLpzsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313567; 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=8I9/g8PQ1WCYmeOD3mjrCAm9CXTbjIpjJls6Evrlddg=; b=i43nTX8UZMXbqnglqNjxW4nlWwodHLsZX0vTB7NjqVbz6NWtkFSy6cGpDhIDAr1GvEHEL3 cv654gUSjbXbWYfy5aCrpuDHC5M32sfJI312+UiMsl4++8R3VzppUNjZyIAcR/YneYY3iT smTSbMgzJl86GZsnMmwijhvwRz2whOg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313567; 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=8I9/g8PQ1WCYmeOD3mjrCAm9CXTbjIpjJls6Evrlddg=; b=KpHJV9fvTxNyI4M157uu4ryYl65YdF5wsRwqfVVtrXWS3UbtllXK6vM+eNaMZLESZ+Nj8N iraXtWIgmTzcWdCw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=eVwDYrP9; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=rC8Jg7Et DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313566; 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=8I9/g8PQ1WCYmeOD3mjrCAm9CXTbjIpjJls6Evrlddg=; b=eVwDYrP9V4UZhp72pA3WQHpiEXukGYG2nfj6ozATIf54PJDIMznzO4gxpweQNIlz67i5fC /A6EUdJhokdxLEyJO4oCcBgyg/ErKauPjJEo1QZSJTh5Y0GLiSbRXP0JsQWQWSUujfV+BW kzZlmHC2zIDGTPnHdNA/FNlhEab4V5o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313566; 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=8I9/g8PQ1WCYmeOD3mjrCAm9CXTbjIpjJls6Evrlddg=; b=rC8Jg7EtWRFybarXBSMGnyvzBVNKGy4+HNqqWqhIkfkUFRDZMusyrLC3XJERbd4+b9mGAe wAYGpTEUNfGILODg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake Subject: [PATCH v2 04/24] migration: Remove MigrateSetParameters Date: Mon, 30 Jun 2025 16:58:53 -0300 Message-Id: <20250630195913.28033-5-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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: C701B2115E 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)[]; 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)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; 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) (identity @suse.de) X-ZM-MESSAGEID: 1751313794524116600 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. Signed-off-by: Fabiano Rosas Acked-by: Markus Armbruster Acked-by: Peter Xu --- migration/migration-hmp-cmds.c | 4 +- migration/options.c | 6 +- qapi/migration.json | 232 +++------------------------------ 3 files changed, 24 insertions(+), 218 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 547384edb5..82cd2dcb8e 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -493,7 +493,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; @@ -659,7 +659,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 f7bbdba5fc..295367ce92 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1270,7 +1270,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; @@ -1393,7 +1393,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 @@ -1523,7 +1523,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 97bb022c45..3788c39857 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -914,206 +914,10 @@ '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: # -# Set various migration parameters. +# Set migration parameters. All fields are optional. # # Since: 2.4 # @@ -1124,13 +928,11 @@ # <- { "return": {} } ## { 'command': 'migrate-set-parameters', 'boxed': true, - 'data': 'MigrateSetParameters' } + 'data': 'MigrationParameters' } =20 ## # @MigrationParameters: # -# The optional members aren't actually optional. -# # @announce-initial: Initial delay (in milliseconds) before sending # the first announce (Since 4.0) # @@ -1148,12 +950,12 @@ # 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. -# (Since 2.7) +# 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. -# (Since 2.7) +# 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 @@ -1172,21 +974,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) @@ -1205,8 +1011,8 @@ # @downtime-limit: set maximum tolerated downtime for migration. # maximum downtime in milliseconds (Since 2.8) # -# @x-checkpoint-delay: the delay time between two COLO checkpoints. -# (Since 2.8) +# @x-checkpoint-delay: the delay time 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 --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313717; cv=none; d=zohomail.com; s=zohoarc; b=J2kpTum/oX4LvoKg+aTL4JiGmjrwFNXhIX2EQdXgndFo2rl1sArnpwsJ/got/sIFeXYYu34OJaEcAdC+co5Mxwz3bT1jxvmLR0rZuiDeN84HDviv4XIPoEIVGLlH/p7prcrWMl2w1Xl0nTa0Zhe/rD7xrh1qnFX4T7mesOq8c0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313717; 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=kQvc4JgXU/Jp7OuGRQG1S0ry3d2HwAoYwfwgQZIjQjw=; b=SSedfgyDNz4WM6vs1yO5pDZqvU0ARMFoFpuns++YGpb8SMXcEBmXfdXGpqaA5uLNRkkh9xE5+2snBTSYwvooPCplFgk5/4nBqPuWg7u0MFjGvLMp2TA3zaq+pghJP0MshKeo3QaJtNfWrb8FbHRrzZURYAWj8zkHLBUJXsQMABU= 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 1751313717726593.1042736717384; Mon, 30 Jun 2025 13:01:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfZ-0002mD-0Y; Mon, 30 Jun 2025 16:00:01 -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 1uWKfW-0002lc-Tk for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:59 -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 1uWKfU-0007V5-IS for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:58 -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 275EA21164; Mon, 30 Jun 2025 19:59: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 55BE81399F; Mon, 30 Jun 2025 19:59: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 EBmLBZ/sYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313569; 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=kQvc4JgXU/Jp7OuGRQG1S0ry3d2HwAoYwfwgQZIjQjw=; b=ehuw/rNEb+37ckBywW9HnNDHIEoawNsPSncN2fqxe+KBmS5eiL5IaMk/ffj0VOy51bLFhI 7DZE/Z+4TDbY395UEqfE9MtC8T8cMZRXEMM/s8ZjW0QSmk328dKxWX87F7YQG97vfX0BVb Rt+NQap1/adCyYH7DNFx9WaIMx6+/XA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313569; 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=kQvc4JgXU/Jp7OuGRQG1S0ry3d2HwAoYwfwgQZIjQjw=; b=UgLA4QDh20ZlHdI+//fyAm2DOla8iwPs2Fm5Qb9NB8v16HkWTK1LnZYOGrIXR3Zwjdj7sw UVJWmz69/oeubhCw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313569; 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=kQvc4JgXU/Jp7OuGRQG1S0ry3d2HwAoYwfwgQZIjQjw=; b=ehuw/rNEb+37ckBywW9HnNDHIEoawNsPSncN2fqxe+KBmS5eiL5IaMk/ffj0VOy51bLFhI 7DZE/Z+4TDbY395UEqfE9MtC8T8cMZRXEMM/s8ZjW0QSmk328dKxWX87F7YQG97vfX0BVb Rt+NQap1/adCyYH7DNFx9WaIMx6+/XA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313569; 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=kQvc4JgXU/Jp7OuGRQG1S0ry3d2HwAoYwfwgQZIjQjw=; b=UgLA4QDh20ZlHdI+//fyAm2DOla8iwPs2Fm5Qb9NB8v16HkWTK1LnZYOGrIXR3Zwjdj7sw UVJWmz69/oeubhCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake Subject: [PATCH v2 05/24] qapi/migration: Don't document MigrationParameter Date: Mon, 30 Jun 2025 16:58:54 -0300 Message-Id: <20250630195913.28033-6-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; 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.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313719559116600 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 Acked-by: Markus Armbruster Acked-by: Peter Xu --- qapi/migration.json | 153 +------------------------------------------- qapi/pragma.json | 1 + 2 files changed, 3 insertions(+), 151 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 3788c39857..40e00fb86e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -734,157 +734,8 @@ ## # @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. The enumeration values mirror the +# members of @MigrationParameters. # # Features: # diff --git a/qapi/pragma.json b/qapi/pragma.json index 023a2ef7bc..193bc39059 100644 --- a/qapi/pragma.json +++ b/qapi/pragma.json @@ -59,6 +59,7 @@ 'IscsiTransport', 'KeyValueKind', 'MemoryDeviceInfoKind', + 'MigrationParameter', 'NetClientDriver', 'ObjectType', 'QKeyCode', --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313825; cv=none; d=zohomail.com; s=zohoarc; b=PgvuVDySO0EHAwS7gJ9carvCAopm36vapmSNvf3tzKDmoIX97WDQoLDDDJnkMhHv0svWZANL1pRQYoBkhf5zK1msL6B0ASWkCIkEw68B6YG3Gq4sT6FzDDtTtpvMHZzWCzRksxVk6EuQkytI/1tlXgoyUszsWBq+F5X8nFZitZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313825; 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=HlUhl75o55wh5KXBSY2jvo6E9h5pDmOs/SQ2i3GvtJ4=; b=XxfsT1fXo1djgRxbod3jTHIpfeKzBCNODP5xkAHRXP9jCzMuq/7gFhfq9Ersi5jbmrs6cAjt43t8lJHMzK4y2C73cCGD7Em1hDA9BbseloKlFPbw9je8fyvanDSzxNDQzk7j95SB5jjgEPGEkSZ+1aWPXqQ1w5gaNXzFW5AHxeU= 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 1751313824804228.66506031953702; Mon, 30 Jun 2025 13:03:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfG-0002Yv-UV; Mon, 30 Jun 2025 15:59:43 -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 1uWKfE-0002YN-Hs for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59: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 1uWKf8-0007T5-7Y for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59: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 2D1DA1F388; Mon, 30 Jun 2025 19:59: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 9FDC31399F; Mon, 30 Jun 2025 19:59: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 SKnAFqHsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313571; 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=HlUhl75o55wh5KXBSY2jvo6E9h5pDmOs/SQ2i3GvtJ4=; b=Iw1lfa/CaUf5gkvewCrrQG4v1u3+78Q7qO8fjt5lZ4Ax38b6wPika2ErjZDKHn7GzdorB5 PdCaCNWk71vzYn0yeB1kNHeOyTAExP6cP7teIKH/URUFrXUTbAg7yOMbvwNeBPP9AEaBTh 2HZuL3sQgykVQta0oOFyJ0mPh+s3rmA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313571; 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=HlUhl75o55wh5KXBSY2jvo6E9h5pDmOs/SQ2i3GvtJ4=; b=E5UuvQDSPMWBNiUk4VFdC+oEWRExY4iPVejA9YQHhsi2ncjLbmPoDkXFqe0QUnsxlBhCHY McrvbWLZ49mffICQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313571; 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=HlUhl75o55wh5KXBSY2jvo6E9h5pDmOs/SQ2i3GvtJ4=; b=Iw1lfa/CaUf5gkvewCrrQG4v1u3+78Q7qO8fjt5lZ4Ax38b6wPika2ErjZDKHn7GzdorB5 PdCaCNWk71vzYn0yeB1kNHeOyTAExP6cP7teIKH/URUFrXUTbAg7yOMbvwNeBPP9AEaBTh 2HZuL3sQgykVQta0oOFyJ0mPh+s3rmA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313571; 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=HlUhl75o55wh5KXBSY2jvo6E9h5pDmOs/SQ2i3GvtJ4=; b=E5UuvQDSPMWBNiUk4VFdC+oEWRExY4iPVejA9YQHhsi2ncjLbmPoDkXFqe0QUnsxlBhCHY McrvbWLZ49mffICQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 06/24] migration: Run a post update routine after setting parameters Date: Mon, 30 Jun 2025 16:58:55 -0300 Message-Id: <20250630195913.28033-7-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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,suse.de:mid,suse.de:email]; 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313826892116600 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 --- 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 295367ce92..1f8a977865 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1083,6 +1083,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. @@ -1393,7 +1418,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 @@ -1433,9 +1458,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) { @@ -1448,7 +1470,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) { @@ -1468,13 +1489,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; @@ -1542,7 +1559,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 2140785a05..7432f82bdd 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 12:43:52 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=1751313692; cv=none; d=zohomail.com; s=zohoarc; b=SC43gFWw0vLSVAYh5upyrTSiZxt8e+qGWAlqmqHiCBmu3OToyzHv2CQQAni1NtFnIxO4vi6+l3ZP8opU5vaWFE2xGFejLkDjg2uw9ZhbSQiQClx99ijMKOoyK7tLTzyHeUBNpn2xIgSdjzOaMC7hBZCvIl8cBHRgOnjCcby26Ec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313692; 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=MUB/IZD2jkUuleGLSl99i/f1/dQ8eMW7zGyUow/gd5k=; b=PSvtsAGmgQUhccqG7VoHahV4XMEQBmwNOMY3iEPPL3PPr8UkNRqAXqT8Jw8OHjOcPVrqtDCEgUpfqhl4fEUfT0oLx3+/C277No2bwuk+XfzmJOmzamYsXO9xTcm4r7/BVU+4ecUlp0+KDXPUmfYnf0K7Zun5/cmg81+hmIB/7+4= 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 1751313692140231.87900689616254; Mon, 30 Jun 2025 13:01:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfU-0002jQ-0V; Mon, 30 Jun 2025 15:59:56 -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 1uWKfL-0002dC-6D for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59:49 -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 1uWKfI-0007U1-EP for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59: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 7906A1F393; Mon, 30 Jun 2025 19:59: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 AC6E21399F; Mon, 30 Jun 2025 19:59: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 iIwvG6PsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313574; 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=MUB/IZD2jkUuleGLSl99i/f1/dQ8eMW7zGyUow/gd5k=; b=eco0fj8QmGM0ZyO9yLAUo7vvdhJX4AkZb8ftx8Cp7Vw6UWDXnWAGWOioSqaLllr4rEcVDz O5jwHI8uBJylZnqRM6VVXtnkQapo2P8sFGY3kilXpxworV6q2LPtTRF3u4SC0PkgJyQJPk zIL5KSGHzkEn8gHb/JGx/zHLTVEV3xU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313574; 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=MUB/IZD2jkUuleGLSl99i/f1/dQ8eMW7zGyUow/gd5k=; b=Yq43iG+T7xoGci1/id7FGrG0wLi8J1UdL3SxlrpExN1l/kHxN+El+15rWF79ZgOosjWWfd ZZAaEJJ7Qp9+4vBQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313573; 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=MUB/IZD2jkUuleGLSl99i/f1/dQ8eMW7zGyUow/gd5k=; b=SHH7rllYEae0mqdHrzzRyi1avl9WSFJbI0DtdfNgUIN5ljady2blLdwnmZBzFFz/gQmTuN Tm4EjFzj9LZJ6Nroau9zK2PhnaCcwi97e8nkeMJq33n1ONC7ugneRPeA++19qC3DK2mzA5 v9BzqX0wMduLkLjOLl3EQx8luEiCT9w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313573; 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=MUB/IZD2jkUuleGLSl99i/f1/dQ8eMW7zGyUow/gd5k=; b=Ltr+FmnUjVRZKi0Ck2xDuIScnl5MrkbkXK2a6s5pjBlgCP3c1ia4DTCXspikTOmhqT1mb6 tIHu0nTYauhsq2Bg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Kevin Wolf Subject: [PATCH v2 07/24] migration: Add a flag to track block-bitmap-mapping input Date: Mon, 30 Jun 2025 16:58:56 -0300 Message-Id: <20250630195913.28033-8-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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) (identity @suse.de) X-ZM-MESSAGEID: 1751313692974116600 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. Using s->parameters.has_block_bitmap_mapping field 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 open-coded 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. No functional change intended. (this was verified to not regress iotest 300, which is the test that 3cba22c9ad refers to) CC: Kevin Wolf Signed-off-by: Fabiano Rosas Acked-by: Peter Xu --- migration/migration-hmp-cmds.c | 3 ++- migration/migration.h | 7 +++++++ migration/options.c | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 82cd2dcb8e..f29bdc12a8 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; + MigrationState *s =3D migrate_get_current(); =20 params =3D qmp_query_migrate_parameters(NULL); =20 @@ -322,7 +323,7 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), params->tls_authz->u.s); =20 - if (params->has_block_bitmap_mapping) { + if (s->has_block_bitmap_mapping) { const BitmapMigrationNodeAliasList *bmnal; =20 monitor_printf(mon, "%s:\n", diff --git a/migration/migration.h b/migration/migration.h index 739289de93..84c3007ab8 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 whether 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 1f8a977865..cb5855303a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -736,7 +736,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) @@ -1033,7 +1033,7 @@ 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->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, @@ -1513,7 +1513,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 12:43:52 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=1751313680; cv=none; d=zohomail.com; s=zohoarc; b=fEFucA9wMQPxHdB/xmG3SZLdXtqDEM2AHXLt5WeZoO1eD4oCJ1viT9d+Al3KLl75rtyYVbkeGGktzMh4h2k9qr7WaCXr/Za5hgIZC484liO/+7i2YooEF2Ih+f+bEH8+LqJUb876K/3f+5vpYyYCzt8I2D5abQ8tUHqexDoafFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313680; 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=77bYJDNs0Ws59oQe8GYo3nGN8937if8rA7m8Ew4y654=; b=ckHO3WWdetVXu7aORpRrKvXCfe++4KseoKj40HveBMDFG1iIU6apkx4JH4YMnZ72kR3TmwDzJvKLyMC40Ov6/yuNsYk7tlEztynTNHprDHUInw1j9NKEgZrcnerHMkRH/Dt6yXLq2dKUR9WAB1JUpLkl3SC2YhdM+CsHLpvK9AY= 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 1751313680157845.1523889888449; Mon, 30 Jun 2025 13:01:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfU-0002kk-UI; Mon, 30 Jun 2025 15:59:56 -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 1uWKfR-0002gC-Bn for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59: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 1uWKfP-0007UY-1Z for qemu-devel@nongnu.org; Mon, 30 Jun 2025 15:59: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-out2.suse.de (Postfix) with ESMTPS id 8593C1F397; Mon, 30 Jun 2025 19:59: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 0423013A24; Mon, 30 Jun 2025 19:59: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 ME4xLaXsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313575; 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=77bYJDNs0Ws59oQe8GYo3nGN8937if8rA7m8Ew4y654=; b=02HUJGg8tGGW5p2AaU7yZoH0aI0Wqx9Y5BAyMWnEBi3sWK8j2odDoIt8W7MRzGUaKkCdj0 Y1Pfh6Uh2GyVDkb6rRhPCiSdvgwYBzzPakXIYSOPz8eDu0DHHJBfPQp9aMfu2pGFrrchZC T0D3EyvrAm4kTBKks1TdyXFeez7Bdjo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313575; 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=77bYJDNs0Ws59oQe8GYo3nGN8937if8rA7m8Ew4y654=; b=dRjqqV9X9qxIPhxiNCnZgBvmEWzyKgNWnKDzQpPsfyQHv2jSyRzqQ3HgEpqH7M9Td1WCV+ Z19iQspOs67aruDA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313575; 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=77bYJDNs0Ws59oQe8GYo3nGN8937if8rA7m8Ew4y654=; b=02HUJGg8tGGW5p2AaU7yZoH0aI0Wqx9Y5BAyMWnEBi3sWK8j2odDoIt8W7MRzGUaKkCdj0 Y1Pfh6Uh2GyVDkb6rRhPCiSdvgwYBzzPakXIYSOPz8eDu0DHHJBfPQp9aMfu2pGFrrchZC T0D3EyvrAm4kTBKks1TdyXFeez7Bdjo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313575; 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=77bYJDNs0Ws59oQe8GYo3nGN8937if8rA7m8Ew4y654=; b=dRjqqV9X9qxIPhxiNCnZgBvmEWzyKgNWnKDzQpPsfyQHv2jSyRzqQ3HgEpqH7M9Td1WCV+ Z19iQspOs67aruDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 08/24] migration: Remove checks for s->parameters has_* fields Date: Mon, 30 Jun 2025 16:58:57 -0300 Message-Id: <20250630195913.28033-9-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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,suse.de:email,suse.de:mid]; 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313683076116600 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 (former 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 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. The empty migrate_params_init() will be kept because subsequent patches will add code to it. Signed-off-by: Fabiano Rosas --- migration/options.c | 101 +++++++++++++------------------------------- 1 file changed, 29 insertions(+), 72 deletions(-) diff --git a/migration/options.c b/migration/options.c index cb5855303a..af19c8f2e0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1056,31 +1056,6 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) =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; } =20 static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) @@ -1116,34 +1091,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) @@ -1151,8 +1123,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) @@ -1160,8 +1131,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 " @@ -1171,93 +1141,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->tls_creds->u.s)) { + (params->multifd_compression || *params->tls_creds->u.s)) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; @@ -1271,23 +1230,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 12:43:52 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=1751313665; cv=none; d=zohomail.com; s=zohoarc; b=myY6m1R4b+UzXsdsQnr78cU6TpzwLYMOhTZ4NOMg80lSC8FpVms46mXUevcttP8bEN09paEV4hUj2thfKryQys1c1i+hbuaUWSHPbz6XwfeeXCDFKuiS0nmTMZq0qcfgxpn0kktQYKJXD8ErWH1WtoWWgYPVtO+F5Q6lxLAzUn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313665; 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=c7uVUSYK8YrLey5ZAtySSapN50WkNS6lNhMOsBxmN/w=; b=W+B+g/ItpZLJkU48OgEN2Zhng+Tu7x5QoRI0C+b3URBmUqxONiBRe4fIipOgEkAseP1kkDffVCl7stbteBYOebKgrF5DIQhHgbdXLU9uRgOmCIClbldCDJ8EGQRkQYCh7pxnagNHaSSpZqJNJ7aOHyeITQzJ2fiHzlGGOq9BUqM= 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 1751313665932980.4581809843833; Mon, 30 Jun 2025 13:01:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfa-0002ne-8g; Mon, 30 Jun 2025 16:00:02 -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 1uWKfY-0002m2-Gs for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:00 -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 1uWKfV-0007VH-KB for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:00 -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 9B4341F444; Mon, 30 Jun 2025 19:59: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 11BBB1399F; Mon, 30 Jun 2025 19:59: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 GKYLMafsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313577; 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=c7uVUSYK8YrLey5ZAtySSapN50WkNS6lNhMOsBxmN/w=; b=bpCBoKRP6gU+1RGXz60ybORx34spwCF6l7Vc1jKQAZ5CxhIdZuDaoa68EAFhnADoPfIv+o k8bu1sqmd2VFbMntbAcEoHzvjqWffW2bbsJjvXt4cv4LUUbfxumxg10OfObmbtpLsoSP5B nBdcD0YB2d8f9IdT4JOWTxA8Kg5t/eY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313577; 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=c7uVUSYK8YrLey5ZAtySSapN50WkNS6lNhMOsBxmN/w=; b=9jDH+pfOQPy3aUsQDPbyTMFtcADOrvdZOXonx3lS8yht4ZbXdOq94FYROWP1BYBuZlRNSJ MN9EFLzd6aekrRCg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313577; 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=c7uVUSYK8YrLey5ZAtySSapN50WkNS6lNhMOsBxmN/w=; b=bpCBoKRP6gU+1RGXz60ybORx34spwCF6l7Vc1jKQAZ5CxhIdZuDaoa68EAFhnADoPfIv+o k8bu1sqmd2VFbMntbAcEoHzvjqWffW2bbsJjvXt4cv4LUUbfxumxg10OfObmbtpLsoSP5B nBdcD0YB2d8f9IdT4JOWTxA8Kg5t/eY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313577; 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=c7uVUSYK8YrLey5ZAtySSapN50WkNS6lNhMOsBxmN/w=; b=9jDH+pfOQPy3aUsQDPbyTMFtcADOrvdZOXonx3lS8yht4ZbXdOq94FYROWP1BYBuZlRNSJ MN9EFLzd6aekrRCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 09/24] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Date: Mon, 30 Jun 2025 16:58:58 -0300 Message-Id: <20250630195913.28033-10-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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,suse.de:mid,suse.de:email]; 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313666690116600 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 --- 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 7ec60d97f9..487019dc69 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 af19c8f2e0..7a6a7d4ee5 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1093,120 +1093,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)) { @@ -1232,8 +1217,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 7432f82bdd..bb86a91db1 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 12:43:52 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=1751313693; cv=none; d=zohomail.com; s=zohoarc; b=VGL1S8ucurDfRYElZDOa9yHz7o2EVeyQIsJP9SQJlnuHQIx09aAf8jXlytGGi72fhccFTC/WbKT1iFDdEA/2oHcASM68bOX68IsTMIqE1AV8s+e3LEZGjVdEVqJzOpTCjNtSh8ijJRozXvkIeq3+AtdQZqlWp3k/IugBBYDtIw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313693; 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=dv1HBvO23vxO2TzJbY+J+dzGfKupQKsCxX04z9DuRus=; b=DMAILlPNWghR58iW+xezSB90hwXL4GSKDfpsZIzRrPdxA7dBWlULG8Ovi+qR7UqttdgixpkKqPK+vID9TvHtjWxXXJsKGEzuz+tTIOpqcKNhBuZo6001NgRbadgA3KTAAhq0mNPPTBlEyo2LluEi4KJbEdxXwGDbAs9X1gm7RXI= 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 1751313693603824.935113660035; Mon, 30 Jun 2025 13:01:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfj-0003Q4-V7; Mon, 30 Jun 2025 16:00:12 -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 1uWKff-00035r-4E for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:07 -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 1uWKfc-0007X3-IZ for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:06 -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 DB3D81F445; Mon, 30 Jun 2025 19:59: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 214ED1399F; Mon, 30 Jun 2025 19:59: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 6PXnNKnsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313579; 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=dv1HBvO23vxO2TzJbY+J+dzGfKupQKsCxX04z9DuRus=; b=Enp/FrwLW4S3Lo0yGj7cKzMl1IrBbhF/DQ8OlG69ehaM4xovHwRJrsGfOY4naHHMQOzO+C yzHztwuDTJVva1iLRX5n9PonUTFWdIroxO1AUxJNxcvCzycXXvXJv4D9rmhlIvFX5WJ/yX mdnRpfGNzPZe8h2gbQxxm4pwS6PmZS8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313579; 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=dv1HBvO23vxO2TzJbY+J+dzGfKupQKsCxX04z9DuRus=; b=/KpEQqEc7FfchvuB/COCMIGhTzHYNszQGRtTCG8I7nEcDk//iXdBtgnUcytSSPkKPS6k+O XbSAJ+M4MkywywBQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="Enp/FrwL"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/KpEQqEc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313579; 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=dv1HBvO23vxO2TzJbY+J+dzGfKupQKsCxX04z9DuRus=; b=Enp/FrwLW4S3Lo0yGj7cKzMl1IrBbhF/DQ8OlG69ehaM4xovHwRJrsGfOY4naHHMQOzO+C yzHztwuDTJVva1iLRX5n9PonUTFWdIroxO1AUxJNxcvCzycXXvXJv4D9rmhlIvFX5WJ/yX mdnRpfGNzPZe8h2gbQxxm4pwS6PmZS8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313579; 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=dv1HBvO23vxO2TzJbY+J+dzGfKupQKsCxX04z9DuRus=; b=/KpEQqEc7FfchvuB/COCMIGhTzHYNszQGRtTCG8I7nEcDk//iXdBtgnUcytSSPkKPS6k+O XbSAJ+M4MkywywBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Kevin Wolf Subject: [PATCH v2 10/24] migration: Extract code to mark all parameters as present Date: Mon, 30 Jun 2025 16:58:59 -0300 Message-Id: <20250630195913.28033-11-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:mid,suse.de:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: DB3D81F445 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313699294116600 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. Note that the block-bitmap-mapping is a special case because the empty list is considered a valid value, so it has historically not been present in the command's output if it has never been set. CC: Kevin Wolf Signed-off-by: Fabiano Rosas --- migration/options.c | 87 ++++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/migration/options.c b/migration/options.c index 7a6a7d4ee5..df9f0bd812 100644 --- a/migration/options.c +++ b/migration/options.c @@ -982,6 +982,43 @@ static void tls_opt_to_str(StrOrNull **tls_opt) *tls_opt =3D opt; } =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. The TLS + * options are a special case because they don't have a default and + * need to be normalized before use. + */ +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, + }; + + 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; @@ -989,67 +1026,51 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **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; params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); params->tls_authz =3D QAPI_CLONE(StrOrNull, 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; 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; - - 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_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; + params->block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + s->parameters.block_bitmap_mapping); + + migrate_mark_all_params_present(params); + + /* + * The block-bitmap-mapping breaks the expected API of + * query-migrate-parameters of having all members present. To keep + * compatibility, only emit this field if it's actually been + * set. The empty list is a valid value. + */ + if (!s->has_block_bitmap_mapping) { + params->has_block_bitmap_mapping =3D false; + qapi_free_BitmapMigrationNodeAliasList(params->block_bitmap_mappin= g); + } =20 return params; } --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313902; cv=none; d=zohomail.com; s=zohoarc; b=JBpNbrcLO+5w8iiBDkSbqfnEoWoC14stGz79SXHDWnqUySx2UJb8ikq7G+DEf39bjvYaj73K8GHthj/IA7CNZOCXzxdxxMGpkdFRqpbbaHsqXj/xHGACIjpF1DjgPFmqDKDw4PstMkNCWredwFEYxvSPhxlJl7c90VxPOLxr/2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313902; 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=xRf9yuzVRLp6wekhjVd1IsXwiOjJofkv8ORwwOJUsiw=; b=oBFXVYFK9eLGWxoJfCeOBkqLLQMFpC5Mry/frmDAGS5pRTN7UE+H47THijnZ6IPWGMFLuuL7RmIs0tIWS72HTOy8fgQajqte0ypHmGIOTgwdhrFdrtk2Y/nRmzvvJ5zGRWW/k6/czuzCiUHRMBkzUmBFtn0k5FJaIeE6v95t+m0= 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 1751313902462196.76789892483782; Mon, 30 Jun 2025 13:05:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfn-0003n5-S3; Mon, 30 Jun 2025 16:00:16 -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 1uWKfk-0003Uc-Q9 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00: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 1uWKfi-0007it-Qp for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:12 -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 E172E1F388; Mon, 30 Jun 2025 19:59: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 63B7E1399F; Mon, 30 Jun 2025 19:59:40 +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 YFiJCazsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313581; 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=xRf9yuzVRLp6wekhjVd1IsXwiOjJofkv8ORwwOJUsiw=; b=KlN8pW92ObKL9lVKhf2bGrobvv4riKGMDz1XqobKGx/FcbROR3l4AuFPxvaVNrn8VQC8f6 GBHiCgQdlklyKk6RuojSF9Lynt7QuqZTUcXs5DPBgjjWXXBb6GDt/dGqQFii7Llg6ibTnm U+32DHYygGDgnf7E+WZR8wJz+3574Fw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313581; 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=xRf9yuzVRLp6wekhjVd1IsXwiOjJofkv8ORwwOJUsiw=; b=qDCZyQTEVjITnYAvPkDrcdrAXdc7BT4g/DbY/aN1Wv2vtPEACjZxIsFa148Kl1vyIxrq3U 058XFGNAd/QxuTDg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313581; 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=xRf9yuzVRLp6wekhjVd1IsXwiOjJofkv8ORwwOJUsiw=; b=KlN8pW92ObKL9lVKhf2bGrobvv4riKGMDz1XqobKGx/FcbROR3l4AuFPxvaVNrn8VQC8f6 GBHiCgQdlklyKk6RuojSF9Lynt7QuqZTUcXs5DPBgjjWXXBb6GDt/dGqQFii7Llg6ibTnm U+32DHYygGDgnf7E+WZR8wJz+3574Fw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313581; 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=xRf9yuzVRLp6wekhjVd1IsXwiOjJofkv8ORwwOJUsiw=; b=qDCZyQTEVjITnYAvPkDrcdrAXdc7BT4g/DbY/aN1Wv2vtPEACjZxIsFa148Kl1vyIxrq3U 058XFGNAd/QxuTDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 11/24] migration: Use QAPI_CLONE_MEMBERS in query_migrate_parameters Date: Mon, 30 Jun 2025 16:59:00 -0300 Message-Id: <20250630195913.28033-12-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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)[suse.de:mid,suse.de:email,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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313903775116600 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. For this to work, the has_* fields of s->parameters need to be already set beforehand, so move migrate_mark_all_params_present() to the init routine. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/options.c | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/migration/options.c b/migration/options.c index df9f0bd812..d07931f922 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1021,45 +1021,9 @@ static void migrate_mark_all_params_present(Migratio= nParameters *p) =20 MigrationParameters *qmp_query_migrate_parameters(Error **errp) { - MigrationParameters *params; MigrationState *s =3D migrate_get_current(); - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - params =3D g_malloc0(sizeof(*params)); - - 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; - params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); - params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); - params->tls_authz =3D QAPI_CLONE(StrOrNull, s->parameters.tls_authz); - 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->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; - params->block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); - - migrate_mark_all_params_present(params); + MigrationParameters *params =3D QAPI_CLONE(MigrationParameters, + &s->parameters); =20 /* * The block-bitmap-mapping breaks the expected API of @@ -1077,6 +1041,7 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 void migrate_params_init(MigrationParameters *params) { + migrate_mark_all_params_present(params); } =20 static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313715; cv=none; d=zohomail.com; s=zohoarc; b=VIER5AyuQf44HjQ5z3K9I8nxkhy5absMfm2Ou7fUrUD7ApVdxXQHJojYMJZe5jriMCjkfNQ1VREHT0ohM+XO+41ZuicZDoft+FqoDl9jQU8uECryKyjiJ1UaznUNW9Wf6Q6E1VlACwTC9JdThbInU+NL9KGS8ARBClTjQBB2jD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313715; 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=TO9MQkpy5elBzth456RHr3PQTP2+a1+cv6uhriX3q8g=; b=mrw7GblZwYJI2vPk7M6K7NCUHp+jIWGpAYk+qfmhQgFoc+WiM+py/3LxOTbLAzlnqASIvm4iQFlBAHxcSWppSlj/CbQtkICp/Sb+KJVAuTNYwj+oWN36G6q1dNS5TsH/vF+TPa3i7GqXrdQr6F1zuCgLiPLMV+UmgJ08yWxda1U= 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 175131371515480.09060898119549; Mon, 30 Jun 2025 13:01:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKff-00033B-44; Mon, 30 Jun 2025 16:00: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 1uWKfc-0002sA-BG for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:04 -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 1uWKfa-0007Vy-BN for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00: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-out1.suse.de (Postfix) with ESMTPS id E84EC21161; Mon, 30 Jun 2025 19:59: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 694FD1399F; Mon, 30 Jun 2025 19:59:42 +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 qEfsCq7sYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313584; 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=TO9MQkpy5elBzth456RHr3PQTP2+a1+cv6uhriX3q8g=; b=dM4odMflw16eg9G9Ep3Ai7hEXDxNs3QqtyU6dKxyNU0rVOGA8SaSkyBRuIUgIMenNaW4gD Y6IJle2UonHBHttB4AJizb/4rql+796bJ60MhZgz1BROk6jcJk5H08Sa3Wwoo8hRzzvPF8 y12FN8wkThSa3ggX7fHzkjBj8T5LUEY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313584; 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=TO9MQkpy5elBzth456RHr3PQTP2+a1+cv6uhriX3q8g=; b=6dSbpIy/zzgNw/07mfzIyyx+XY7mgNl4QLKMgrjF+gYyfdJGpESQwpRFpP5S89AHNLEbyE TGu3wB+0upiR/eAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=NOWwNHju; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=m2WlQox7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313583; 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=TO9MQkpy5elBzth456RHr3PQTP2+a1+cv6uhriX3q8g=; b=NOWwNHjus2EoNuOO9PGkh6uw4H/DEZHx8w0MeNTH6DG2q3OGt5ylx4Tv2d1cx2jOAdKC8Z Rs6xXt1s7+i3D6WCyHgvav7fHiVR9kVI2IkR8+pd7yueKQiP02OIgZYQnUxktTFKrlUPVS g6C8ZDLKlqDig0lMaisakwZCBw5FUVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313583; 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=TO9MQkpy5elBzth456RHr3PQTP2+a1+cv6uhriX3q8g=; b=m2WlQox7lH398L85sZ5rEMHY/JI1lxeHXBXqKFvv0oRkfcayuprpWqO7kdMZxT8cSllNrL ObqIrmDX9rNjA2Bg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 12/24] migration: Use QAPI_CLONE_MEMBERS in migrate_params_test_apply Date: Mon, 30 Jun 2025 16:59:01 -0300 Message-Id: <20250630195913.28033-13-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:mid,suse.de:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: E84EC21161 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) (identity @suse.de) X-ZM-MESSAGEID: 1751313717357116600 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 --- migration/options.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/migration/options.c b/migration/options.c index d07931f922..4564db77f2 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1225,9 +1225,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; @@ -1246,24 +1246,18 @@ static void migrate_params_test_apply(MigrationPara= meters *params, } =20 if (params->tls_creds) { + qapi_free_StrOrNull(dest->tls_creds); dest->tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_creds); - } else { - /* drop the reference, it's owned by s->parameters */ - dest->tls_creds =3D NULL; } =20 if (params->tls_hostname) { + qapi_free_StrOrNull(dest->tls_hostname); dest->tls_hostname =3D QAPI_CLONE(StrOrNull, params->tls_hostname); - } else { - /* drop the reference, it's owned by s->parameters */ - dest->tls_hostname =3D NULL; } =20 if (params->tls_authz) { + qapi_free_StrOrNull(dest->tls_authz); dest->tls_authz =3D QAPI_CLONE(StrOrNull, 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,7 +1314,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 @@ -1485,6 +1478,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 12:43:52 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=1751313869; cv=none; d=zohomail.com; s=zohoarc; b=ZhYNYaXpdcuXy8tFKFd4p5Ybt7RSqR2SBE4Vb3BFhFEHoUmeEo5z2p10rgxUN1ID209UPMRq7JfGhIEkWBmhQ1sqN/XrI6dqCsTbN3xYzRfojmcWWh9xaM9UAdn8Pai7YqwrxtdbJyK1Iu4klA3xcp/1+e4iFVBH897aJUEnMrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313869; 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=r75N41YrJesr79AJdHq22IkW5vC8x4kzDqtwI+/8H7w=; b=JRY5jUReDnZR+Pl6Sr/U5olbNBzykx3tDZbCWgtkA/zSpy6Ukji4wNByA4j9yYvtZ3RBDRlmpy57VAjywnWQG2qK/sKVtta9IQNP/COylUMdca7MvMCICsuNhcLBspplHBJh4NEk9eswPs1dCI/M3Y6EFgUgKiIl8o645GYsDd4= 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 1751313869725788.4580770063831; Mon, 30 Jun 2025 13:04:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfu-0004Fy-4w; Mon, 30 Jun 2025 16:00: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 1uWKfr-00044n-D5 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:19 -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 1uWKfo-0007jc-Lq for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:19 -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 F1D2D1F44E; Mon, 30 Jun 2025 19:59: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 708AC1399F; Mon, 30 Jun 2025 19:59:44 +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 gOWrDLDsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313586; 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=r75N41YrJesr79AJdHq22IkW5vC8x4kzDqtwI+/8H7w=; b=cSvrkXU8J4X0Wr2zzfopIJHkWmuDnLJWM3QFIgq37jDdgsER67WaesrdKsbk7TLdKh+bje 3oeS+cug2gPsubHnBK4/OXvASFsod61QaxGyu639fzufbw/LzHvE2zJtcD7JVZYX7QHDER q7hBLESKhbgnm0jodJws88A+uhQurKk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313586; 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=r75N41YrJesr79AJdHq22IkW5vC8x4kzDqtwI+/8H7w=; b=wrMH4FtlLfMjYvYLPRrQRzSEXdBID7FjBQCzOkGXZ7tjcwfmbzNI9cf1j/u+eLDq14cJs4 Nm3XK3dQCCzATSDA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=sqsyPAXi; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Afqd4ZSQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313585; 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=r75N41YrJesr79AJdHq22IkW5vC8x4kzDqtwI+/8H7w=; b=sqsyPAXi/VoWoiafMYJs/2sZacniIewwcHeiOEIuQ0o88yhZmtwo5VFs8ax1XCEa5pfA8w DdPE7t266Uv3a2qv2j38C+RJOQw4j2JkkKJCs6kemilg8xaZyMEaG4ibYc/aONgydPbUyg P2Nu3tDD0QE7fioKRd35YS1ntvT54r8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313585; 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=r75N41YrJesr79AJdHq22IkW5vC8x4kzDqtwI+/8H7w=; b=Afqd4ZSQws3/GzdUK6ncbI3OEYF+uEsfdi+M1hbIXMU2s06UmezzWNemFgRUHTYH098bTF MBUDexzNYMX8JjDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 13/24] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Date: Mon, 30 Jun 2025 16:59:02 -0300 Message-Id: <20250630195913.28033-14-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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: F1D2D1F44E 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)[]; 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)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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) (identity @suse.de) X-ZM-MESSAGEID: 1751313871381116600 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. Signed-off-by: Fabiano Rosas --- migration/options.c | 123 +++----------------------------------------- 1 file changed, 7 insertions(+), 116 deletions(-) diff --git a/migration/options.c b/migration/options.c index 4564db77f2..6619b5f21a 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" @@ -1341,123 +1342,13 @@ 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; - } - - if (params->has_cpu_throttle_initial) { - s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; - } - - 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); - s->parameters.tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_cred= s); - } - - if (params->tls_hostname) { - qapi_free_StrOrNull(s->parameters.tls_hostname); - s->parameters.tls_hostname =3D QAPI_CLONE(StrOrNull, - params->tls_hostname); - } - - if (params->tls_authz) { - qapi_free_StrOrNull(s->parameters.tls_authz); - s->parameters.tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_auth= z); - } - - 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; - } + migrate_tls_opts_free(cur); + qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); + QAPI_CLONE_MEMBERS(MigrationParameters, cur, params); } =20 void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) @@ -1487,7 +1378,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 12:43:52 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=1751313820; cv=none; d=zohomail.com; s=zohoarc; b=kFA6l1rkd4q90ShWTXF421oAQavD1mh2p1yxojDvo8/20fr06Mv/J2rCPcxu+Pm6tqIS8USNBYEkMr4V/0USZrGg3cc2VKnZMsMbbpErFMLbXu+suRALo3hmPPGIgrvDwYK3Ai0u0QfPl7iBZZs8D5U5VX0FhnxSyQF437vOKFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313820; 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=txlgJDtkXvB0CtRoZohHCRzr0A+uz7zRbtBLhfVcjCw=; b=DW21vYc/Dm555XByV7OBx1/PE3rbFnUf16/me4CPkAPJ5+DyBKBunfH2oaKio+Y6yWtalqgK2xS/KVf/W4Eqv8LcFhkldCXMlvk5qLw8J9Bq2WH2BcPRLF5lYhsQ5vfXHFbULXamHXNSUfO0QlmgVW0rWioTsRaicSzNWLUdqI0= 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 1751313820718519.3914012007625; Mon, 30 Jun 2025 13:03:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKg1-0004fC-My; Mon, 30 Jun 2025 16:00:29 -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 1uWKfz-0004V6-2v for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:27 -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 1uWKfw-0007kV-AT for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:26 -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 041341F393; Mon, 30 Jun 2025 19:59:48 +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 7A6281399F; Mon, 30 Jun 2025 19:59:46 +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 mHEFD7LsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313588; 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=txlgJDtkXvB0CtRoZohHCRzr0A+uz7zRbtBLhfVcjCw=; b=Ijf9MYvufS851Cm63skaECl02mDW3JPmKhZPUY5gsIvLTn9D6FWwno7FypH2+g8u24jLf+ VyhyS0pxjEsBOcnn/v4G57ny7xIzqWK3SA/md4v/quSD2UXab32tBlFxANr9b6okbMKf/K 12RZtPiBCkkxSSrLNK0tA2OAyfliuZw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313588; 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=txlgJDtkXvB0CtRoZohHCRzr0A+uz7zRbtBLhfVcjCw=; b=4Ea/suvxZYj6lFmGneo86+c515CrJDaQso7XUVvW7frEXAmDOi9FYlQ7JQErOKV1GHwLBL vmgTRebWvFt60cDA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Ijf9MYvu; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="4Ea/suvx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313588; 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=txlgJDtkXvB0CtRoZohHCRzr0A+uz7zRbtBLhfVcjCw=; b=Ijf9MYvufS851Cm63skaECl02mDW3JPmKhZPUY5gsIvLTn9D6FWwno7FypH2+g8u24jLf+ VyhyS0pxjEsBOcnn/v4G57ny7xIzqWK3SA/md4v/quSD2UXab32tBlFxANr9b6okbMKf/K 12RZtPiBCkkxSSrLNK0tA2OAyfliuZw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313588; 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=txlgJDtkXvB0CtRoZohHCRzr0A+uz7zRbtBLhfVcjCw=; b=4Ea/suvxZYj6lFmGneo86+c515CrJDaQso7XUVvW7frEXAmDOi9FYlQ7JQErOKV1GHwLBL vmgTRebWvFt60cDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 14/24] migration: Use visitors in migrate_params_test_apply Date: Mon, 30 Jun 2025 16:59:03 -0300 Message-Id: <20250630195913.28033-15-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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: 041341F393 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)[]; 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)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; 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: 1751313822870116600 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. The current code has conditionals for each parameter's has_* field, which is exactly what the visitors do. 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. Change the name of the function to a more direct reference of what it does: merging the user params with the temporary copy. Move the QAPI_CLONE_MEMBERS into the caller, so QAPI_CLONE can be used and there's no need to allocate memory in the migration code. Similarly, turn 'tmp' into a pointer so the proper qapi_free_ routine can be used. An extra call to migrate_mark_all_params_present() is now needed because the visitors update the has_ field for non-present fields, but we actually want them all set so migrate_params_apply() can copy all of them. Signed-off-by: Fabiano Rosas --- migration/options.c | 157 +++++++++++++++----------------------------- 1 file changed, 54 insertions(+), 103 deletions(-) diff --git a/migration/options.c b/migration/options.c index 6619b5f21a..695bec5b8f 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" @@ -1223,120 +1227,63 @@ 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_merge(MigrationParameters *dst, + MigrationParameters *src, Error **errp) { - MigrationState *s =3D migrate_get_current(); + QObject *ret_out =3D NULL; + Visitor *v; + bool ok; =20 - QAPI_CLONE_MEMBERS(MigrationParameters, dest, &s->parameters); - - if (params->has_throttle_trigger_threshold) { - dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; - } - - if (params->has_cpu_throttle_initial) { - dest->cpu_throttle_initial =3D params->cpu_throttle_initial; - } - - if (params->has_cpu_throttle_increment) { - dest->cpu_throttle_increment =3D params->cpu_throttle_increment; + /* free memory from pointers that are about to be assigned */ + if (src->has_block_bitmap_mapping) { + qapi_free_BitmapMigrationNodeAliasList(dst->block_bitmap_mapping); } =20 - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; + if (src->tls_creds) { + qapi_free_StrOrNull(dst->tls_creds); } =20 - if (params->tls_creds) { - qapi_free_StrOrNull(dest->tls_creds); - dest->tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_creds); + if (src->tls_hostname) { + qapi_free_StrOrNull(dst->tls_hostname); } =20 - if (params->tls_hostname) { - qapi_free_StrOrNull(dest->tls_hostname); - dest->tls_hostname =3D QAPI_CLONE(StrOrNull, params->tls_hostname); + if (src->tls_authz) { + qapi_free_StrOrNull(dst->tls_authz); } =20 - if (params->tls_authz) { - qapi_free_StrOrNull(dest->tls_authz); - dest->tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_authz); + /* read in from src */ + v =3D qobject_output_visitor_new(&ret_out); + ok =3D visit_type_MigrationParameters(v, NULL, &src, errp); + if (!ok) { + goto out; } + visit_complete(v, &ret_out); + visit_free(v); =20 - if (params->has_max_bandwidth) { - dest->max_bandwidth =3D params->max_bandwidth; + /* + * Write to dst but leave existing fields intact (except for has_* + * which will be updated according to their presence in src). + */ + 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_avail_switchover_bandwidth) { - dest->avail_switchover_bandwidth =3D params->avail_switchover_band= width; + ok =3D visit_type_MigrationParameters_members(v, dst, errp); + if (!ok) { + goto out; } - - if (params->has_downtime_limit) { - dest->downtime_limit =3D params->downtime_limit; + ok =3D visit_check_struct(v, errp); + visit_end_struct(v, NULL); + if (!ok) { + goto out; } =20 - if (params->has_x_checkpoint_delay) { - dest->x_checkpoint_delay =3D params->x_checkpoint_delay; - } +out: + visit_free(v); + qobject_unref(ret_out); =20 - if (params->has_multifd_channels) { - dest->multifd_channels =3D params->multifd_channels; - } - 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; - } - - if (params->has_block_bitmap_mapping) { - dest->block_bitmap_mapping =3D params->block_bitmap_mapping; - } - - 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) @@ -1353,7 +1300,9 @@ static void migrate_params_apply(MigrationParameters = *params) =20 void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { - MigrationParameters tmp; + MigrationState *s =3D migrate_get_current(); + g_autoptr(MigrationParameters) tmp =3D QAPI_CLONE(MigrationParameters, + &s->parameters); =20 /* * Convert QTYPE_QNULL and NULL to the empty string (""). Even @@ -1367,7 +1316,9 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) tls_opt_to_str(¶ms->tls_hostname); tls_opt_to_str(¶ms->tls_authz); =20 - migrate_params_test_apply(params, &tmp); + if (!migrate_params_merge(tmp, params, errp)) { + return; + } =20 /* * Mark block_bitmap_mapping as present now while we have the @@ -1377,10 +1328,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)) { + /* mark all present, so they're all copied */ + migrate_mark_all_params_present(tmp); + migrate_params_apply(tmp); migrate_post_update_params(params, errp); } - - migrate_tls_opts_free(&tmp); } --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313704; cv=none; d=zohomail.com; s=zohoarc; b=j32veA9FWp4OpT02/IewE/h6XMrbOPs66/ijBZVzh32ZKB+Z55+1ELX4hkhwfSFgTWkFSzrsHnFlsM10b1JrsMENn/KjEmAwHJpC+E/LQeRv5VPHH0nNOdy2H7NDoialmeNIYy/YZOFEgcRiWT3U6dhtv/ZDUnu+NHwdLcAju9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313704; 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=Wj0Ik7pwtTAWFyDHT1xPBMQhokUz1vq0SCVg2ale9JA=; b=DZIz/uvhGwuDTM756rgE7bpLbJv9SEJxJRCnUBES3/QHrZYuLrTsTLmRBooustwuUc3ma1lLFvyNjr3iV5etWOEvJsqLuzVmb40s/lbagtdN9N+KKe7Pz5SaBH9UBbCz0ir0u0xYWa3+Ff8+AXFzLNMquC/Lze6yuOXj5FPW5DM= 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 1751313704009424.29369395377023; Mon, 30 Jun 2025 13:01:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfl-0003ay-Uz; Mon, 30 Jun 2025 16:00:13 -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 1uWKfj-0003Ql-4x for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:11 -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 1uWKfg-0007hj-I2 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:10 -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 120CF21163; Mon, 30 Jun 2025 19:59:50 +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 80A591399F; Mon, 30 Jun 2025 19:59:48 +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 mPKlELTsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313592; 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=Wj0Ik7pwtTAWFyDHT1xPBMQhokUz1vq0SCVg2ale9JA=; b=KWkRZ2AZkN7LZ//w7tjlYutlnEqiD4rZC2oB59RMDjl3d3GxYNWEIWYRvH5FBpElziKNe1 O6BfBDa+KTnnd2SVzI+JUaHosSk3nVjmaK01emWVAeiE5WKXXMuNsKaTG5hEjmfqspUwCU xmWyMDB/Yg4yBwMU86uvBX9lwhxdjNc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313592; 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=Wj0Ik7pwtTAWFyDHT1xPBMQhokUz1vq0SCVg2ale9JA=; b=zTe6RkOMWJZHdej+58iBkQGkW3o9+o0lpGmQIoHtQyz+pr6alFHR/onEGCKGznRgAu6Vx3 k95/k+4d1i2CdLDQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="asUs7H4/"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=tIb+2TR0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313590; 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=Wj0Ik7pwtTAWFyDHT1xPBMQhokUz1vq0SCVg2ale9JA=; b=asUs7H4/9oIppuXL9JKplcQXwtnL1EY8kXGFrp4x87tCr2bamWHjkvcDyQEHc/In9uGNz1 dPDmnoCvgs+lme+UWWciRH3zh/fmN15TCfXYw5W+dNkSq/OvvK3NO36nFU1Xt4EG8J8Pbf J6NFunBV9YjJ6uq/DlvwHHwFxCVAx1g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313590; 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=Wj0Ik7pwtTAWFyDHT1xPBMQhokUz1vq0SCVg2ale9JA=; b=tIb+2TR0FVd+P+BMYRalHRyviVLDW0T/zHmgCE3nUcU0slqlexKNFrjJsUqLYq7l4LbiZ4 FdpDvd4Jhs1p0UAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 15/24] migration: Cleanup hmp_info_migrate_parameters Date: Mon, 30 Jun 2025 16:59:04 -0300 Message-Id: <20250630195913.28033-16-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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: 120CF21163 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)[]; 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)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[4]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid, suse.de:dkim, suse.de:email, imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo] 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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) (identity @suse.de) X-ZM-MESSAGEID: 1751313705524116600 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. (except for block-bitmap-mapping) - 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 --- migration/migration-hmp-cmds.c | 277 ++++++++++++++++++--------------- 1 file changed, 155 insertions(+), 122 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index f29bdc12a8..b5618981b3 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,133 +248,161 @@ void hmp_info_migrate_parameters(Monitor *mon, cons= t QDict *qdict) MigrationState *s =3D migrate_get_current(); =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); - assert(params->tls_creds); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), - params->tls_creds->u.s); - assert(params->tls_hostname); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_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); - assert(params->tls_authz); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz->u.s); - - if (s->has_block_bitmap_mapping) { - const BitmapMigrationNodeAliasList *bmnal; - - 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->valu= e; - - monitor_printf(mon, " '%s' -> '%s'\n", - bmba->name, bmba->alias); - } + 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); + + if (s->has_block_bitmap_mapping) { + const BitmapMigrationNodeAliasList *bmnal; + + 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"); - } } =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 12:43:52 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=1751313876; cv=none; d=zohomail.com; s=zohoarc; b=Hkwqr2dm3r5hossSXDVKYcr9F9T7Cg4fMTx3g++p2YBlxmTS2hl6oAteSdRUEDvYJq9ZZwmm3lxCxnoUVZ1yV+csi+xsOvYowMeBY5IaE2PRnYm9lDhPq75dK+g161mPGMMM6xmqyBTCokg3tbX7UB6L5LNp7IQkjfnC76pgaus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313876; 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=kDlRQH/X7jVp0jIDEgnm5jF1xnc178apK6Sj+tVIwck=; b=l2KfI7xUaUAsG2AyTwPGCdeJpoOfg7MbLI6UXSnPJOZ03c2OUlXCa7dDfRzm38pr9hHa8PTiLrXqh12+J18SNuaWFqbx4YylqNCYKeQq4o8/Xs6VXg6t/GJKWwFLhddA+8cWuasvlEvmqg/KT7+8nRM57H1I+iQgAxuAOm4wVMA= 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 1751313876503549.4738680107179; Mon, 30 Jun 2025 13:04:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKfs-00049A-LB; Mon, 30 Jun 2025 16:00: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 1uWKfp-0003wK-QX for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:17 -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 1uWKfm-0007jS-Gi for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:17 -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 63C622115E; Mon, 30 Jun 2025 19:59:52 +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 95BFC13A24; Mon, 30 Jun 2025 19:59:50 +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 cOTCFbbsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313592; 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=kDlRQH/X7jVp0jIDEgnm5jF1xnc178apK6Sj+tVIwck=; b=ynEUv1TA7nOwhUrqzfGhexTMVGK47wOpKTYT49q3UsQoVudFiNCod8xFJarIFbWaNJhDF+ cZVKprIBEOWhtvzs7+NwBWBShA5cvYgA8SuqTBsT7rwlmRvvpevSmcRuQh+EifzbjrZz8i 2x26UcsYnJQCxAjCJDosxIxrBzQEfGE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313592; 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=kDlRQH/X7jVp0jIDEgnm5jF1xnc178apK6Sj+tVIwck=; b=6P5W33ohtNcUrvmnNKLGTWhoYcabTCreO+WhkkOLQTd3Q/IbWxZnvLlQP9qrnX8SWkIV+x nRpduU+weLx8QaBA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313592; 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=kDlRQH/X7jVp0jIDEgnm5jF1xnc178apK6Sj+tVIwck=; b=ynEUv1TA7nOwhUrqzfGhexTMVGK47wOpKTYT49q3UsQoVudFiNCod8xFJarIFbWaNJhDF+ cZVKprIBEOWhtvzs7+NwBWBShA5cvYgA8SuqTBsT7rwlmRvvpevSmcRuQh+EifzbjrZz8i 2x26UcsYnJQCxAjCJDosxIxrBzQEfGE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313592; 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=kDlRQH/X7jVp0jIDEgnm5jF1xnc178apK6Sj+tVIwck=; b=6P5W33ohtNcUrvmnNKLGTWhoYcabTCreO+WhkkOLQTd3Q/IbWxZnvLlQP9qrnX8SWkIV+x nRpduU+weLx8QaBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake Subject: [PATCH v2 16/24] migration: Add capabilities into MigrationParameters Date: Mon, 30 Jun 2025 16:59:05 -0300 Message-Id: <20250630195913.28033-17-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; 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.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313877633116600 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 --- migration/migration-hmp-cmds.c | 198 +++++++++++++++++++++++++++++++++ migration/migration.c | 8 ++ migration/options.c | 129 +++++++++++++++++++++ migration/options.h | 5 + qapi/migration.json | 135 +++++++++++++++++++++- 5 files changed, 471 insertions(+), 4 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index b5618981b3..8615340a6b 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -403,6 +403,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 @@ -682,6 +792,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 487019dc69..11d9016d14 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4096,6 +4096,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 695bec5b8f..a4b8d3f1b0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -685,6 +685,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; @@ -726,6 +831,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 */ @@ -1014,6 +1121,15 @@ static void migrate_mark_all_params_present(Migratio= nParameters *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 len =3D ARRAY_SIZE(has_fields); @@ -1316,6 +1432,19 @@ void qmp_migrate_set_parameters(MigrationParameters = *params, Error **errp) tls_opt_to_str(¶ms->tls_hostname); tls_opt_to_str(¶ms->tls_authz); =20 + /* + * FIXME: Temporarily while migrate_caps_check is not + * converted to look at s->parameters. Will be gone the end of + * the series. + */ + 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_merge(tmp, params, 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 40e00fb86e..3d3f5624c5 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -763,7 +763,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: @@ -934,10 +941,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 ## @@ -972,7 +1077,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 12:43:52 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=1751313645; cv=none; d=zohomail.com; s=zohoarc; b=jPNvR0wHhtHPKESp40SmVnecDp8sgLfVdFBQQXH0erBGHbHUhf0Fv/BXzLzmuDgQfde8gow+BH8tFQ3cF6AvKBLToS2XyFdCIBrJUBsM5JmQbd6LZWbaKx634JxQk5mDiMDVfiXqzUN6TZqQAI2n6VuwR32vfzsJPy15znkx6CA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313645; 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=61eT/YeWGra1VAAPhsyLDkf2FO1o9tLVvoC6+cht3fk=; b=P3DS7rgYJNYFxBnZsDBio4ezw52fkWkHox6dJMI6G1C+6fHOYaU4vYxfX0YhcuS1IJ8kU9HRqL/FngR2vnvp31TU4yezIk9livwTnbCTXkA2wKJUDIzlKjV6rGNJlOt6piwaYf2VsxxSznz/xKGOH7C/x1am2dBtCkxSf1J8xNM= 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 1751313643146106.5992955057435; Mon, 30 Jun 2025 13:00:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKg0-0004ZN-Fp; Mon, 30 Jun 2025 16:00: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 1uWKfx-0004RB-16 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:25 -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 1uWKft-0007kJ-NN for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00: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-out1.suse.de (Postfix) with ESMTPS id B2F9421165; Mon, 30 Jun 2025 19:59:54 +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 EA3A11399F; Mon, 30 Jun 2025 19:59:52 +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 sNQ3KrjsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313594; 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=61eT/YeWGra1VAAPhsyLDkf2FO1o9tLVvoC6+cht3fk=; b=nhvhid7pOwLFrKU8Kxv2uPmM2RCGTDfo46og2O84KwvPcHWJGyDEC2+brjA+Zzr4EKTll2 5taFVZLK//Jgxu9Z2rSWxXppym3vHfrOeVpbE0UQtu0IX+TOM8nvRj+3pZN41OJDvN92XZ JUPoq90NDPoFGDaPuDFuTLxIMvkSSa4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313594; 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=61eT/YeWGra1VAAPhsyLDkf2FO1o9tLVvoC6+cht3fk=; b=1gNiy0NEvx5RdoypLwzV7dA3p8FqLRxJAvUk9gHS0jsgxEtK34TnTokZUIwjHisBZFk5IJ K6FVlvlmyrFeqYBg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=nhvhid7p; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=1gNiy0NE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313594; 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=61eT/YeWGra1VAAPhsyLDkf2FO1o9tLVvoC6+cht3fk=; b=nhvhid7pOwLFrKU8Kxv2uPmM2RCGTDfo46og2O84KwvPcHWJGyDEC2+brjA+Zzr4EKTll2 5taFVZLK//Jgxu9Z2rSWxXppym3vHfrOeVpbE0UQtu0IX+TOM8nvRj+3pZN41OJDvN92XZ JUPoq90NDPoFGDaPuDFuTLxIMvkSSa4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313594; 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=61eT/YeWGra1VAAPhsyLDkf2FO1o9tLVvoC6+cht3fk=; b=1gNiy0NEvx5RdoypLwzV7dA3p8FqLRxJAvUk9gHS0jsgxEtK34TnTokZUIwjHisBZFk5IJ K6FVlvlmyrFeqYBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 17/24] migration: Remove s->capabilities Date: Mon, 30 Jun 2025 16:59:06 -0300 Message-Id: <20250630195913.28033-18-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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: B2F9421165 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)[]; 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)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[4]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo, suse.de:mid, suse.de:dkim, suse.de:email] 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: 1751313651711116600 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 --- migration/migration.c | 22 +--- migration/migration.h | 1 - migration/options.c | 284 ++++++++++++++++++------------------------ migration/options.h | 19 +-- migration/savevm.c | 8 +- 5 files changed, 133 insertions(+), 201 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 11d9016d14..aa954f5fc7 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; @@ -4089,22 +4090,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 84c3007ab8..7d3a607029 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 a4b8d3f1b0..90440731d0 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) - const PropertyInfo qdev_prop_StrOrNull; #define DEFINE_PROP_STR_OR_NULL(_name, _state, _field) \ DEFINE_PROP(_name, _state, _field, qdev_prop_StrOrNull, StrOrNull *, \ @@ -188,30 +185,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 @@ -266,7 +273,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) @@ -280,144 +287,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(); @@ -462,54 +467,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; } @@ -517,26 +490,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"= ); @@ -544,27 +510,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. @@ -580,41 +546,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; } @@ -626,22 +596,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; @@ -654,21 +624,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; @@ -679,7 +649,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; @@ -800,39 +770,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 */ @@ -893,9 +861,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) @@ -1340,6 +1307,10 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (!migrate_caps_check(params, errp)) { + return false; + } + return true; } =20 @@ -1432,19 +1403,6 @@ void qmp_migrate_set_parameters(MigrationParameters = *params, Error **errp) tls_opt_to_str(¶ms->tls_hostname); tls_opt_to_str(¶ms->tls_authz); =20 - /* - * FIXME: Temporarily while migrate_caps_check is not - * converted to look at s->parameters. Will be gone the end of - * the series. - */ - 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_merge(tmp, params, errp)) { return; } diff --git a/migration/options.h b/migration/options.h index cac9201a5e..1ce38c30fb 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,8 +75,6 @@ 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); @@ -97,4 +83,5 @@ void migrate_capability_set_compat(MigrationParameters *p= arams, 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 bb04a4520d..b51ff54624 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 12:43:52 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=1751313691; cv=none; d=zohomail.com; s=zohoarc; b=GRVCJdTuoOSGHfvrfLWfzGUhcji7JqyusdSUEzMcV3FH3JdVUMRGXfK6tcv5ItKoUH2gViKI+v/u7uFsPg0JbVH1r5ROh8S6aQGmwRu9gBnWxomWiBc8skuXn8cIEhH6tn/F40GnvGnYdxk7owsUr4mwfvNe0BLT6FEPhGHt0RA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313691; 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=bJJsmpW1sZIFywpnT0/jHjGMLIPBN6TL6FzL6t1T5Bo=; b=OnlIbvsJv9MZgoRrC1kqnDRa6/nwa4XsCTL5CzJ89pJMs2f33c9qiKKP6TtxJHCPojaz+n52RnQC3LayEMiJJ5u5MDJNqwzROLkkVJJ/Y8UE8F1GPBwbxi20xTNikXOqvYZjzNUlgNx12tRhGBt8MhPd4IbArRHVp6OrFWzOKps= 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 1751313691910983.1320711019803; Mon, 30 Jun 2025 13:01:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKg4-0004qp-Lh; Mon, 30 Jun 2025 16:00: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 1uWKg2-0004kE-R5 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:30 -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 1uWKg0-0007l3-Rk for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:30 -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 5601121162; Mon, 30 Jun 2025 19:59: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 3F4901399F; Mon, 30 Jun 2025 19:59: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 mJ6WALvsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313597; 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=bJJsmpW1sZIFywpnT0/jHjGMLIPBN6TL6FzL6t1T5Bo=; b=ei2Z56aA781IEohqSXqpVFyhtor4HOteFeIOATMHMn435LfLp9KKXt4CFiBYP7BS2bjzD5 6Xr7qJxwJZVyQwIG73NaS4sM6FLo+w2mLwOLpQOZAJAmOtFtXXTt37ZBmoIL1Rs4GfmPof u1j/smJncwwjmFgY3Aladw6ss14eBdc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313597; 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=bJJsmpW1sZIFywpnT0/jHjGMLIPBN6TL6FzL6t1T5Bo=; b=dgK+D/yFREuBwLfFxJvGZGy7E3KlYiDW1qsLYj+zXiwJ0p1m5OHpoLAdHxiQAK8LVvbDX3 XdmnBqf3ATt416Dw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ei2Z56aA; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="dgK+D/yF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313597; 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=bJJsmpW1sZIFywpnT0/jHjGMLIPBN6TL6FzL6t1T5Bo=; b=ei2Z56aA781IEohqSXqpVFyhtor4HOteFeIOATMHMn435LfLp9KKXt4CFiBYP7BS2bjzD5 6Xr7qJxwJZVyQwIG73NaS4sM6FLo+w2mLwOLpQOZAJAmOtFtXXTt37ZBmoIL1Rs4GfmPof u1j/smJncwwjmFgY3Aladw6ss14eBdc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313597; 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=bJJsmpW1sZIFywpnT0/jHjGMLIPBN6TL6FzL6t1T5Bo=; b=dgK+D/yFREuBwLfFxJvGZGy7E3KlYiDW1qsLYj+zXiwJ0p1m5OHpoLAdHxiQAK8LVvbDX3 XdmnBqf3ATt416Dw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , devel@lists.libvirt.org, Eric Blake Subject: [PATCH v2 18/24] qapi/migration: Deprecate capabilities commands Date: Mon, 30 Jun 2025 16:59:07 -0300 Message-Id: <20250630195913.28033-19-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_FIVE(0.00)[6]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, suse.de:mid, suse.de:email, imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns] X-Rspamd-Queue-Id: 5601121162 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313693003116600 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: Markus Armbruster Reviewed-by: Peter Xu --- 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 8615340a6b..7f234d5aa8 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) { @@ -616,6 +619,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 3d3f5624c5..c5e6ea1a2d 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 12:43:52 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=1751313708; cv=none; d=zohomail.com; s=zohoarc; b=Jwao1EK/5pFySo4w5bi7Bz1UKBafDxTTWncQjuqfrRas5FwhLYzPUWPmxBMnSOK/9JKrebmsQJ3F3jvnhYxFS7CSfIYN7gv+ylJ3W0jZ2WgQ7TyPx961GIA+iZPe/nkU6ghaGZ/fdKWaCpbU8zeZdv9XI2Ita7NvpuFrU208wMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313708; 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=UizGjpaAFRQHuVHPt7zudRmh6GJ7tNvItuwzxtxuTqA=; b=V1zWImyASnkPFLnLF+jWb2qbbrJRYFyHp+r/GEmwOMcnQ1FFoP3Yih2hHYmca7BZ61IB8cg6gja19agd+nu0iZSWMQsX8YvBm5fWR9U+o/P0MaE/PRfgn3ANZskyHqB3wz3yI3EGrq7r6dhJJPDeYxfme+n+5WCnfLq2Wdlk05M= 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 1751313708639642.5299804883291; Mon, 30 Jun 2025 13:01:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKgF-00057g-0J; Mon, 30 Jun 2025 16:00:43 -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 1uWKg8-0004vR-TD for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:39 -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 1uWKg6-0007lz-SB for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:36 -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 5D18021164; Mon, 30 Jun 2025 19:59:59 +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 CE5961399F; Mon, 30 Jun 2025 19:59:57 +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 yM92I73sYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313599; 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=UizGjpaAFRQHuVHPt7zudRmh6GJ7tNvItuwzxtxuTqA=; b=yiBfLuPG+9biXdk9rY2BSt4+qt06CMSCGRBtJnihzoRh2RxkmExz29H7dcf84xSLDFQSUd P4HSkDjJJHgb9EMSASi/XqlHL2zcMeyedPkyY3Aiw9nTbfGrEiBxLVqwqX4g6BOCWUZswq ibPivNSk5CTps7VyI/h9YISwbP+15kQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313599; 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=UizGjpaAFRQHuVHPt7zudRmh6GJ7tNvItuwzxtxuTqA=; b=llOy9g1ap/Oq7hZO3c1jUvPR4d2BphjEh5H0zCl0qxm5nH5OhagudSLtlDQ2ZlR73Z3YdF Tusw43RJMN+B58Cg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313599; 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=UizGjpaAFRQHuVHPt7zudRmh6GJ7tNvItuwzxtxuTqA=; b=yiBfLuPG+9biXdk9rY2BSt4+qt06CMSCGRBtJnihzoRh2RxkmExz29H7dcf84xSLDFQSUd P4HSkDjJJHgb9EMSASi/XqlHL2zcMeyedPkyY3Aiw9nTbfGrEiBxLVqwqX4g6BOCWUZswq ibPivNSk5CTps7VyI/h9YISwbP+15kQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313599; 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=UizGjpaAFRQHuVHPt7zudRmh6GJ7tNvItuwzxtxuTqA=; b=llOy9g1ap/Oq7hZO3c1jUvPR4d2BphjEh5H0zCl0qxm5nH5OhagudSLtlDQ2ZlR73Z3YdF Tusw43RJMN+B58Cg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v2 19/24] migration: Store the initial values used for s->parameters Date: Mon, 30 Jun 2025 16:59:08 -0300 Message-Id: <20250630195913.28033-20-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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,suse.de:email,suse.de:mid]; 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: 1751313711445116600 Content-Type: text/plain; charset="utf-8" Each migration parameters has a default value, store them for later use in resetting s->parameters. Values overridden via the command line with the debugging option -global migration. will be included. Make the structure const and change the appropriate signatures to make sure its values are not changed by accident. Some functions take two MigrationParameters pointers and it's easy to confuse them. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 3 +++ migration/migration.h | 6 ++++++ migration/options.c | 21 +++++++++++++++++---- migration/options.h | 7 ++++--- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index aa954f5fc7..13b70dbb94 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(); @@ -4051,6 +4052,8 @@ static void migration_instance_finalize(Object *obj) MigrationState *ms =3D MIGRATION_OBJ(obj); =20 qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); + /* drop const */ + qapi_free_MigrationParameters((MigrationParameters *)ms->initial_param= s); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); diff --git a/migration/migration.h b/migration/migration.h index 7d3a607029..b1107b4e30 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -319,6 +319,12 @@ struct MigrationState { =20 /* params from 'migrate-set-parameters' */ MigrationParameters parameters; + /* + * This holds the values initially set in the 'parameters' struct + * above. Any values overriden by -global migration. + * will be reflected here as well. + */ + const MigrationParameters *initial_params; =20 MigrationStatus state; =20 diff --git a/migration/options.c b/migration/options.c index 90440731d0..2f6ccefa21 100644 --- a/migration/options.c +++ b/migration/options.c @@ -472,7 +472,7 @@ static bool migrate_incoming_started(void) return !!migration_incoming_get_current()->transport_data; } =20 -bool migrate_rdma_caps_check(MigrationParameters *params, Error **errp) +bool migrate_rdma_caps_check(const MigrationParameters *params, Error **er= rp) { if (params->xbzrle) { error_setg(errp, "RDMA and XBZRLE can't be used together"); @@ -490,7 +490,7 @@ bool migrate_rdma_caps_check(MigrationParameters *param= s, Error **errp) return true; } =20 -bool migrate_caps_check(MigrationParameters *new, Error **errp) +bool migrate_caps_check(const MigrationParameters *new, Error **errp) { MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); @@ -1161,7 +1161,7 @@ static void migrate_post_update_params(MigrationParam= eters *new, Error **errp) * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. */ -bool migrate_params_check(MigrationParameters *params, Error **errp) +bool migrate_params_check(const MigrationParameters *params, Error **errp) { ERRP_GUARD(); =20 @@ -1373,7 +1373,7 @@ out: return ok; } =20 -static void migrate_params_apply(MigrationParameters *params) +static void migrate_params_apply(const MigrationParameters *params) { MigrationState *s =3D migrate_get_current(); MigrationParameters *cur =3D &s->parameters; @@ -1385,6 +1385,19 @@ static void migrate_params_apply(MigrationParameters= *params) QAPI_CLONE_MEMBERS(MigrationParameters, cur, params); } =20 +void migrate_params_store_defaults(MigrationState *s) +{ + assert(!s->initial_params); + + /* + * 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. + */ + s->initial_params =3D QAPI_CLONE(MigrationParameters, &s->parameters); +} + void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 1ce38c30fb..91154c4322 100644 --- a/migration/options.h +++ b/migration/options.h @@ -46,7 +46,7 @@ bool migrate_postcopy(void); bool migrate_rdma(void); bool migrate_tls(void); =20 -bool migrate_rdma_caps_check(MigrationParameters *config, Error **errp); +bool migrate_rdma_caps_check(const MigrationParameters *config, Error **er= rp); =20 /* parameters */ =20 @@ -75,7 +75,7 @@ const char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); =20 -bool migrate_params_check(MigrationParameters *params, Error **errp); +bool migrate_params_check(const 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); @@ -83,5 +83,6 @@ void migrate_capability_set_compat(MigrationParameters *p= arams, int i, bool val); void migrate_capabilities_set_compat(MigrationParameters *params, MigrationCapabilityStatusList *caps); -bool migrate_caps_check(MigrationParameters *new, Error **errp); +bool migrate_caps_check(const MigrationParameters *const new, Error **errp= ); +void migrate_params_store_defaults(MigrationState *s); #endif --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313655; cv=none; d=zohomail.com; s=zohoarc; b=SL4zHLXjdC8f2rVHlVauFXv2yb5K+k7oqwB5srkF1IIYHDdc6EojSW8beQjhP4XUlIqRTlcYJSRh3+u9H66sR94yZ+scggNrQRlYiU8+tpK7eqAeuHmB/6MDcge3kikwUTJRflQPDXaKZkwA/uYvt/x+3kXT1DVUWjv+vEN0QWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313655; 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=0AArHDdOU4SGXTjlPnMQuCQL+xBnKy8uwPROE+r/f8o=; b=WLiZuIQqU1bcypAc+bgD1VoM+wehdjlSmNv4254kLAw68ZVKXbFQ2AWG5X2H9HF5MYVB9L4F8wHq51KkR/xPd5S0jH1SY59cB6xDnxbvvl+ZyfHJ4LUtMhTKt/gcerlRUCeqb1CNG8fcDCLyDRXP2nJ3sroU34ghYO2xK/IB4Io= 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 1751313655102902.562701704742; Mon, 30 Jun 2025 13:00:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKgC-00050d-NY; Mon, 30 Jun 2025 16:00:41 -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 1uWKg5-0004rH-Ir for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00: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 1uWKg3-0007lO-6L for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:33 -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 E8FFB1F444; Mon, 30 Jun 2025 20:00:01 +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 E3E1D1399F; Mon, 30 Jun 2025 19:59:59 +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 ADx9KL/sYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 19:59:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313602; 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=0AArHDdOU4SGXTjlPnMQuCQL+xBnKy8uwPROE+r/f8o=; b=IGY7to+lfvDcRo+UucCXBlIG2LqeD3J+UzpUTKHiaqQzf3JogtyXeJRtSZA8ZjC6MO9le7 le6BT8rWNEdfji7gsj3Nmu4NLm6VTKCpLfbvwJgBppxs6qIpC7pb49SGwafv5R2lQAxdmT rJ9iC7I1m8STwp6eh+vV8vH+G8egjN8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313602; 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=0AArHDdOU4SGXTjlPnMQuCQL+xBnKy8uwPROE+r/f8o=; b=mwLKOyrFauLfaUaLfiG0ASZbozyCXhklylVhgP+4TgmNAFis8wR/DD0rVwdC9sFmqQdFow 1CzGnPaDIRLxx5AQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=fSv6Ozoc; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=JEKp3kB5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313601; 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=0AArHDdOU4SGXTjlPnMQuCQL+xBnKy8uwPROE+r/f8o=; b=fSv6OzoclTT3syFyyCPEfptD0Ou1AxDcnRvgtH2BHkKTgGl1dLxbXiTkriPhxL9bUbmAtM TNwfbqCqVg5IQKanBWsHC4DpC8JRELrYgoVraSScPZl1081Q6+jLRLXvcZNQmpLhZNJJ8N iO/dJCfde3y4qjVq6arcgBr6cNa2wFQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313601; 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=0AArHDdOU4SGXTjlPnMQuCQL+xBnKy8uwPROE+r/f8o=; b=JEKp3kB5F1dwS09lT6ZMMBB54/32TuqpiLyqi8bPJ1q72MZ2VzvNhArnalIo29bbCWWR/+ VVrM0haXiA4FCeDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake , Paolo Bonzini Subject: [PATCH v2 20/24] migration: Allow migrate commands to provide the migration config Date: Mon, 30 Jun 2025 16:59:09 -0300 Message-Id: <20250630195913.28033-21-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_FIVE(0.00)[6]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, suse.de:mid, suse.de:email, imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns] X-Rspamd-Queue-Id: E8FFB1F444 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: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) (identity @suse.de) X-ZM-MESSAGEID: 1751313656791116600 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 migration cmdline > migrate-set-parameters > defaults (migration_properties) I.e. the config takes precedence over all, values not present in the config assume the default values. The -global migration command line option allows the defaults to be overridden for debug. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration-hmp-cmds.c | 5 +++-- migration/migration.c | 28 +++++++++++++++++++++++++--- migration/options.c | 19 +++++++++++++++++++ migration/options.h | 4 +++- qapi/migration.json | 16 ++++++++++++++++ system/vl.c | 3 ++- 6 files changed, 68 insertions(+), 7 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 7f234d5aa8..2075d6c6e5 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -583,7 +583,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: @@ -960,7 +960,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 13b70dbb94..42a2a6e8f2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1917,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 by + * migrate-set-parameters get ignored. + */ + if (!migrate_params_override(s, config, errp)) { + return; + } + } + if (!once) { error_setg(errp, "The incoming migration has already been started"= ); return; @@ -2183,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; @@ -2194,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 by + * migrate-set-parameters get ignored. + */ + if (!migrate_params_override(s, config, errp)) { + return; + } + } + /* * Having preliminary checks for uri and channel */ diff --git a/migration/options.c b/migration/options.c index 2f6ccefa21..0f6d021093 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1398,6 +1398,25 @@ void migrate_params_store_defaults(MigrationState *s) s->initial_params =3D QAPI_CLONE(MigrationParameters, &s->parameters); } =20 +bool migrate_params_override(MigrationState *s, MigrationParameters *new, + Error **errp) +{ + ERRP_GUARD(); + + assert(bql_locked()); + + /* reset to initial parameters */ + migrate_params_apply(s->initial_params); + + /* apply the new ones on top */ + qmp_migrate_set_parameters(new, errp); + if (*errp) { + return false; + } + + return true; +} + void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 91154c4322..fa56c977a6 100644 --- a/migration/options.h +++ b/migration/options.h @@ -83,6 +83,8 @@ void migrate_capability_set_compat(MigrationParameters *p= arams, int i, bool val); void migrate_capabilities_set_compat(MigrationParameters *params, MigrationCapabilityStatusList *caps); -bool migrate_caps_check(const MigrationParameters *const new, Error **errp= ); +bool migrate_caps_check(const 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 c5e6ea1a2d..11b7d7ebec 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1456,6 +1456,13 @@ # # @resume: resume one paused migration, default "off". (since 3.0) # +# @config: migration configuration options, previously set via +# @migrate-set-parameters and @migrate-set-capabilities. Setting +# this argument causes all migration configuration options +# previously set via @migrate-set-parameters to be ignored. +# Configuration options not set will assume their default +# values. (since 10.1) +# # Features: # # @deprecated: Argument @detach is deprecated. @@ -1520,6 +1527,7 @@ 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], '*detach': { 'type': 'bool', 'features': [ 'deprecated' ] }, + '*config': 'MigrationParameters', '*resume': 'bool' } } =20 ## @@ -1539,6 +1547,13 @@ # 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. Setting +# this argument causes all migration configuration options +# previously set via @migrate-set-parameters to be ignored. +# Configuration options not set will assume their default +# values. (since 10.1) +# # Since: 2.3 # # .. admonition:: Notes @@ -1592,6 +1607,7 @@ { 'command': 'migrate-incoming', 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], + '*config': 'MigrationParameters', '*exit-on-error': 'bool' } } =20 ## 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 12:43:52 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=1751313905; cv=none; d=zohomail.com; s=zohoarc; b=OfBXeM49cl2dht3hT1AZ5RWZNwBMUjmwgGxM/cfDnjLqNgkBV5fjdvDN4conckjsvQKX4zQGNeh1Z+1z14V1kada5+UFed1GSmGaSKiDF+4PudeLHFRx5vzdq2ETw1a/9FN4BtBYZIq9zxcOa0T+imX7SMoyZti7hPB+5Fn3xKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313905; 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=OMnsDqpS7mN5ekbzq6rLUj1Jtd21FawuezqRU1AIOxE=; b=B/Mp1rBewvtiOUtZjNTE0OkbUKH/wCZub8gbXyU85B4yHnTozqd4WF8cWpxx+YIjgw8gEOc4k/81uNBnjq3wLb2FKwTT23VoNeobfC6Mh4rPFzpkR4BgGTD7rWFuflIgfLsrbMaDIYeiFJkpykTY67v1Trg00dhwbmPtrkIAwBU= 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 1751313905117480.5155980629979; Mon, 30 Jun 2025 13:05:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKgX-0005mX-9C; Mon, 30 Jun 2025 16:01:01 -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 1uWKgF-00059p-Br for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:43 -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 1uWKgD-0007mk-IM for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:43 -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 810D021161; Mon, 30 Jun 2025 20:00:04 +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 71F791399F; Mon, 30 Jun 2025 20:00:02 +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 KG35DMLsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 20:00:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313604; 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=OMnsDqpS7mN5ekbzq6rLUj1Jtd21FawuezqRU1AIOxE=; b=SOyg5eilBG96Xgweic7QpojL5RNpbLiDFTv2YpjnoxsXcYhXWbsXCx7hy9Bc3UbcnWyFgQ 9H0lBS6SxaQMlKXuZAbRJzKjUCYEIzIuZFwIr3ii2ENN+sv1fu2KKz/7xmN1CQ/R5pTcej nHfItiG8i8OCuYztIR4T5J64RZlORVI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313604; 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=OMnsDqpS7mN5ekbzq6rLUj1Jtd21FawuezqRU1AIOxE=; b=u4T9Up066SayiMCh1tGi/xzVTuJpAhXlkANSFlRrZkkJIEGUtMas/56r7hC0wJUYrSG04+ Rv2XZ2Wy7KlkJJCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313604; 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=OMnsDqpS7mN5ekbzq6rLUj1Jtd21FawuezqRU1AIOxE=; b=SOyg5eilBG96Xgweic7QpojL5RNpbLiDFTv2YpjnoxsXcYhXWbsXCx7hy9Bc3UbcnWyFgQ 9H0lBS6SxaQMlKXuZAbRJzKjUCYEIzIuZFwIr3ii2ENN+sv1fu2KKz/7xmN1CQ/R5pTcej nHfItiG8i8OCuYztIR4T5J64RZlORVI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313604; 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=OMnsDqpS7mN5ekbzq6rLUj1Jtd21FawuezqRU1AIOxE=; b=u4T9Up066SayiMCh1tGi/xzVTuJpAhXlkANSFlRrZkkJIEGUtMas/56r7hC0wJUYrSG04+ Rv2XZ2Wy7KlkJJCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 21/24] tests/qtest/migration: Take reference when passing %p to qtest_qmp Date: Mon, 30 Jun 2025 16:59:10 -0300 Message-Id: <20250630195913.28033-22-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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_FIVE(0.00)[6]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313905670116600 Content-Type: text/plain; charset="utf-8" The documentation of qobject_from_jsonv() states that it takes ownership of any %p arguments passed in. Next patches will add config-passing to the tests, so take an extra reference in the migrate_qmp* functions to ensure the config is not freed from under us. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/migration-qmp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/= migration-qmp.c index fb59741b2c..d82ac8c750 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -97,7 +97,8 @@ void migrate_qmp_fail(QTestState *who, const char *uri, } =20 err =3D qtest_qmp_assert_failure_ref( - who, "{ 'execute': 'migrate', 'arguments': %p}", args); + who, "{ 'execute': 'migrate', 'arguments': %p}", + qdict_clone_shallow(args)); =20 g_assert(qdict_haskey(err, "desc")); =20 @@ -136,7 +137,8 @@ void migrate_qmp(QTestState *who, QTestState *to, const= char *uri, } =20 qtest_qmp_assert_success(who, - "{ 'execute': 'migrate', 'arguments': %p}", a= rgs); + "{ 'execute': 'migrate', 'arguments': %p}", + qdict_clone_shallow(args)); } =20 void migrate_set_capability(QTestState *who, const char *capability, @@ -174,7 +176,7 @@ void migrate_incoming_qmp(QTestState *to, const char *u= ri, QObject *channels, migrate_set_capability(to, "events", true); =20 rsp =3D qtest_qmp(to, "{ 'execute': 'migrate-incoming', 'arguments': %= p}", - args); + qdict_clone_shallow(args)); =20 if (!qdict_haskey(rsp, "return")) { g_autoptr(GString) s =3D qobject_to_json_pretty(QOBJECT(rsp), true= ); --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313717; cv=none; d=zohomail.com; s=zohoarc; b=iAUCQ3m5sIma+1DEKcpxWBCXt+XXi0FB0clWzw75EpYP7Cgc8ctbMSY0MvHVpVyTpdzALDglLVv5Vn1vz1i2yIIgyR4ot9JBZvkJw0nl/9zVAnPyN2O4bbbzNyfAYEhJhjsHMxFcHzDYPaKzZyIxJz2d83Mb3aLokGja33yLIWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313717; 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=tsAtYJ4xAGrX6j3QtAxnvyE9GbMjpAanjWUq0BYEkAU=; b=liJkl6Qa0KMyWI4c/rqKgC+ds2SpzbOUhMCqsN64gDw+31a/Gq4qcHEixmZP5W/kMUVpDJDTHCc7nmn08xN/WDSXwx0jHV9FULSnjr9npz0nZdGi5Vbo/37Ht4DTnMjdt1bGGNJ7ynk5bcY+OZCU2GAwgpzMmB66hNNo7uB/p1U= 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 1751313717816501.1122820692573; Mon, 30 Jun 2025 13:01:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKgV-0005UV-42; Mon, 30 Jun 2025 16:00: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 1uWKgB-0004zW-Gs for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:39 -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 1uWKg9-0007mM-Ka for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:39 -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 07D691F445; Mon, 30 Jun 2025 20:00:07 +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 02B6C1399F; Mon, 30 Jun 2025 20:00:04 +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 sLArLcTsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 20:00:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313607; 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=tsAtYJ4xAGrX6j3QtAxnvyE9GbMjpAanjWUq0BYEkAU=; b=FgKEpyZoH6Qe/HdwYC8pZwAD7LpJioNSOUpSwIBBXzsc11nkfmNNGcgzbzH/bgz3cPuEj3 uQ8V6KDlfC/9OBzXXoBwYNGATcSriimft72uHmgND4zLAFGYVdixbuo1sf/vXdGCX+8BUp 6kjw2P9ibgD5SCT10bdGC0l7WqNcHUg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313607; 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=tsAtYJ4xAGrX6j3QtAxnvyE9GbMjpAanjWUq0BYEkAU=; b=5bUWL/03klR3+PcqiFmAiSixYGI/c0YQZYgOwlFF6aSRZIhCdwSf3ouJQVccqOLpllDXfL UJx0aQYVm/0cnbDQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=FgKEpyZo; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="5bUWL/03" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313607; 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=tsAtYJ4xAGrX6j3QtAxnvyE9GbMjpAanjWUq0BYEkAU=; b=FgKEpyZoH6Qe/HdwYC8pZwAD7LpJioNSOUpSwIBBXzsc11nkfmNNGcgzbzH/bgz3cPuEj3 uQ8V6KDlfC/9OBzXXoBwYNGATcSriimft72uHmgND4zLAFGYVdixbuo1sf/vXdGCX+8BUp 6kjw2P9ibgD5SCT10bdGC0l7WqNcHUg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313607; 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=tsAtYJ4xAGrX6j3QtAxnvyE9GbMjpAanjWUq0BYEkAU=; b=5bUWL/03klR3+PcqiFmAiSixYGI/c0YQZYgOwlFF6aSRZIhCdwSf3ouJQVccqOLpllDXfL UJx0aQYVm/0cnbDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 22/24] tests/qtest/migration: Adapt the capabilities helper to take a config Date: Mon, 30 Jun 2025 16:59:11 -0300 Message-Id: <20250630195913.28033-23-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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: 07D691F445 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)[]; 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)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_FIVE(0.00)[6]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid, suse.de:dkim, suse.de:email, imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo] 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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.237, 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: 1751313719325116600 Content-Type: text/plain; charset="utf-8" Allow migrate_start_set_capabilities() to set the config object instead of setting the capabilities via calls to migrate-set-capabilities. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 31 +++++++++++++++++++++++++++++++ tests/qtest/migration/framework.h | 1 + 2 files changed, 32 insertions(+) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 407c9023c0..9ff5576328 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -211,6 +211,37 @@ static QList *migrate_start_get_qmp_capabilities(const= MigrateStart *args) static void migrate_start_set_capabilities(QTestState *from, QTestState *t= o, MigrateStart *args) { + if (args->config) { + const char *cap_multifd; + bool multifd; + + for (uint8_t i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { + const char *cap =3D MigrationCapability_lookup.array[i]; + + if (!args->caps[i]) { + continue; + } + + qdict_put_bool(args->config, cap, true); + } + + if (!args->defer_target_connect) { + qdict_put_bool(args->config, "events", true); + } + + cap_multifd =3D MigrationCapability_str(MIGRATION_CAPABILITY_MULTI= FD); + multifd =3D qdict_get_try_bool(args->config, cap_multifd, false); + + if (multifd) { + qdict_put_int(args->config, "multifd-channels", + MULTIFD_TEST_CHANNELS); + qdict_put_int(args->config, "multifd-channels", + MULTIFD_TEST_CHANNELS); + } + + return; + } + /* * MigrationCapability_lookup and MIGRATION_CAPABILITY_ constants * are from qapi-types-migration.h. diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 01e425e64e..9b281d6757 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -128,6 +128,7 @@ typedef struct { * migration_set_capabilities(). */ bool caps[MIGRATION_CAPABILITY__MAX]; + QDict *config; } MigrateStart; =20 typedef enum PostcopyRecoveryFailStage { --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313900; cv=none; d=zohomail.com; s=zohoarc; b=AvMcmzNw7QSZz0gIM3HpKvaC79X/gfBpsZhXKjI5g33r4ywd3dPB7Lj4KqknX3z+NbM91wrFW8X2u8Ufz2Evs59XYsaxhY0y5qFfXI3acxG/6DJfITRQTky8ZB/Vjr85pQ7swjFFzYylyNWLUnJJ7mKD1tkqQ1UXUB5NU0H1Etc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313900; 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=S8MF+wD18+4fRDDS0/kCDVD6uI4fVXKX+iEWE73RBPk=; b=Q5rbaeLJqQH/V2K71A1ebY1X0kO3TIYXcP4NUcM2bydgfEiiO4pOvfFU1Prq8HDpmuydsmpnJY1gid3n1P0LfLw2tQpW6Hi6gwUI8+7XEg0toeFiCjMJ6aELcHvrMUdcCr5pnwkFuk9/Va4h3pjNUkof4cfP7iCrKXG+5glJkzk= 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 1751313900612340.42958006354513; Mon, 30 Jun 2025 13:05:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKgW-0005gH-Bn; Mon, 30 Jun 2025 16:01: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 1uWKgN-0005P3-O9 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:52 -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 1uWKgL-0007ns-A6 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:51 -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 9DC3121169; Mon, 30 Jun 2025 20:00:09 +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 904CB1399F; Mon, 30 Jun 2025 20:00:07 +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 YFxwFMfsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 20:00:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313609; 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=S8MF+wD18+4fRDDS0/kCDVD6uI4fVXKX+iEWE73RBPk=; b=uQ2+W4x9AzoPRZb6gKlPqShn4nwgFhVfQ8Y0hiPiJh1kKSB80x23W7fS8QRXH39muTcK6X n+3BPhtu23R7RIKQxm8kXisdo2JIPLlrxNNRyOAZ4zREWFIbU3KGlWA0sstem+PX7YJERB le+CHFv2So6GKCMndduCXi5PBu+rlAg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313609; 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=S8MF+wD18+4fRDDS0/kCDVD6uI4fVXKX+iEWE73RBPk=; b=Qqx8eXwZHi9k4s7xoVM7lIpWh6Cxs56xe4TrBo4UPuGhvMmLzuapj7fnsYRFhlMtP1f879 5Sm3KhSC5aWBAXDQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313609; 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=S8MF+wD18+4fRDDS0/kCDVD6uI4fVXKX+iEWE73RBPk=; b=uQ2+W4x9AzoPRZb6gKlPqShn4nwgFhVfQ8Y0hiPiJh1kKSB80x23W7fS8QRXH39muTcK6X n+3BPhtu23R7RIKQxm8kXisdo2JIPLlrxNNRyOAZ4zREWFIbU3KGlWA0sstem+PX7YJERB le+CHFv2So6GKCMndduCXi5PBu+rlAg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313609; 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=S8MF+wD18+4fRDDS0/kCDVD6uI4fVXKX+iEWE73RBPk=; b=Qqx8eXwZHi9k4s7xoVM7lIpWh6Cxs56xe4TrBo4UPuGhvMmLzuapj7fnsYRFhlMtP1f879 5Sm3KhSC5aWBAXDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 23/24] tests/qtest/migration: Adapt convergence routines to config Date: Mon, 30 Jun 2025 16:59:12 -0300 Message-Id: <20250630195913.28033-24-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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_FIVE(0.00)[6]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; 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=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: 1751313902032116600 Content-Type: text/plain; charset="utf-8" Adapt the convergence routines migrate_ensure_[non_]converge to receive a config argument and set the convergence parameters in it instead of using migrate-set-parameters. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 10 +++++----- tests/qtest/migration/migration-qmp.c | 22 ++++++++++++++++------ tests/qtest/migration/migration-qmp.h | 4 ++-- tests/qtest/migration/misc-tests.c | 4 ++-- tests/qtest/migration/precopy-tests.c | 22 +++++++++++----------- 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 9ff5576328..5025299d6a 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -513,7 +513,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, args->postcopy_data =3D args->start_hook(from, to); } =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," " 'arguments': { " @@ -791,7 +791,7 @@ void test_precopy_common(MigrateCommon *args) } =20 if (args->live) { - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); } else { /* @@ -803,7 +803,7 @@ void test_precopy_common(MigrateCommon *args) if (args->result =3D=3D MIG_TEST_SUCCEED) { qtest_qmp_assert_success(from, "{ 'execute' : 'stop'}"); wait_for_stop(from, &src_state); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->start.config); } } =20 @@ -862,7 +862,7 @@ void test_precopy_common(MigrateCommon *args) } migrate_wait_for_dirty_mem(from, to); =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->start.config); =20 /* * We do this first, as it has a timeout to stop us @@ -965,7 +965,7 @@ void test_file_common(MigrateCommon *args, bool stop_sr= c) data_hook =3D args->start_hook(from, to); } =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->start.config); wait_for_serial("src_serial"); =20 if (stop_src) { diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/= migration-qmp.c index d82ac8c750..8918ce87d8 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -471,18 +471,28 @@ void migrate_set_parameter_bool(QTestState *who, cons= t char *parameter, migrate_check_parameter_bool(who, parameter, value); } =20 -void migrate_ensure_non_converge(QTestState *who) +void migrate_ensure_non_converge(QTestState *who, QDict *config) { /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */ - migrate_set_parameter_int(who, "max-bandwidth", 3 * 1000 * 1000); - migrate_set_parameter_int(who, "downtime-limit", 1); + if (config) { + qdict_put_int(config, "max-bandwidth", 3 * 1000 * 1000); + qdict_put_int(config, "downtime-limit", 1); + } else { + migrate_set_parameter_int(who, "max-bandwidth", 3 * 1000 * 1000); + migrate_set_parameter_int(who, "downtime-limit", 1); + } } =20 -void migrate_ensure_converge(QTestState *who) +void migrate_ensure_converge(QTestState *who, QDict *config) { /* Should converge with 30s downtime + 1 gbs bandwidth limit */ - migrate_set_parameter_int(who, "max-bandwidth", 1 * 1000 * 1000 * 1000= ); - migrate_set_parameter_int(who, "downtime-limit", 30 * 1000); + if (config) { + qdict_put_int(config, "max-bandwidth", 1 * 1000 * 1000 * 1000); + qdict_put_int(config, "downtime-limit", 30 * 1000); + } else { + migrate_set_parameter_int(who, "max-bandwidth", 1 * 1000 * 1000 * = 1000); + migrate_set_parameter_int(who, "downtime-limit", 30 * 1000); + } } =20 void migrate_pause(QTestState *who) diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/= migration-qmp.h index faa8181d91..a80546a258 100644 --- a/tests/qtest/migration/migration-qmp.h +++ b/tests/qtest/migration/migration-qmp.h @@ -36,8 +36,8 @@ void migrate_set_parameter_str(QTestState *who, const cha= r *parameter, const char *value); void migrate_set_parameter_bool(QTestState *who, const char *parameter, int value); -void migrate_ensure_non_converge(QTestState *who); -void migrate_ensure_converge(QTestState *who); +void migrate_ensure_non_converge(QTestState *who, QDict *config); +void migrate_ensure_converge(QTestState *who, QDict *config); void migrate_pause(QTestState *who); void migrate_continue(QTestState *who, const char *state); void migrate_recover(QTestState *who, const char *uri); diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 54995256d8..abbbf966e9 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -70,7 +70,7 @@ static void test_analyze_script(void) file =3D g_strdup_printf("%s/migfile", tmpfs); uri =3D g_strdup_printf("exec:cat > %s", file); =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from, args.config); migrate_qmp(from, to, uri, NULL, "{}"); wait_for_migration_complete(from); =20 @@ -105,7 +105,7 @@ static void test_ignore_shared(void) return; } =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args.config); migrate_prepare_for_dirty_mem(from); =20 /* Wait for the first serial output from the source */ diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index bb38292550..35d4274c69 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -387,7 +387,7 @@ static void test_auto_converge(void) * Set the initial parameters so that the migration could not converge * without throttling. */ - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args.config); =20 /* To check remaining size after precopy */ migrate_set_capability(from, "pause-before-switchover", true); @@ -440,7 +440,7 @@ static void test_auto_converge(void) g_assert_cmpint(hit, =3D=3D, 1); =20 /* Now, when we tested that throttling works, let it converge */ - migrate_ensure_converge(from); + migrate_ensure_converge(from, args.config); =20 /* * Wait for pre-switchover status to check last throttle percentage @@ -580,7 +580,7 @@ static void test_multifd_tcp_cancel(bool postcopy_ram) return; } =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args.config); migrate_prepare_for_dirty_mem(from); =20 if (postcopy_ram) { @@ -640,13 +640,13 @@ static void test_multifd_tcp_cancel(bool postcopy_ram) /* Start incoming migration from the 1st socket */ migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, "{}"); =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args.config); =20 migrate_qmp(from, to2, NULL, NULL, "{}"); =20 migrate_wait_for_dirty_mem(from, to2); =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from, args.config); =20 wait_for_stop(from, get_src()); qtest_qmp_eventwait(to2, "RESUME"); @@ -675,7 +675,7 @@ static void test_cancel_src_after_failed(QTestState *fr= om, QTestState *to, */ =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); =20 migrate_qmp(from, to, uri, NULL, "{}"); =20 @@ -699,7 +699,7 @@ static void test_cancel_src_after_cancelled(QTestState = *from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); =20 migrate_qmp(from, to, uri, NULL, "{}"); =20 @@ -723,7 +723,7 @@ static void test_cancel_src_after_complete(QTestState *= from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); =20 migrate_qmp(from, to, uri, NULL, "{}"); =20 @@ -752,7 +752,7 @@ static void test_cancel_src_after_none(QTestState *from= , QTestState *to, =20 migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); migrate_qmp(from, to, uri, NULL, "{}"); =20 wait_for_migration_complete(from); @@ -771,7 +771,7 @@ static void test_cancel_src_pre_switchover(QTestState *= from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, NULL); =20 migrate_qmp(from, to, uri, NULL, "{}"); =20 @@ -1080,7 +1080,7 @@ static void migrate_dirty_limit_wait_showup(QTestStat= e *from, migrate_set_parameter_int(from, "vcpu-dirty-limit", value); =20 /* Make sure migrate can't converge */ - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, NULL); =20 /* To check limit rate after precopy */ migrate_set_capability(from, "pause-before-switchover", true); --=20 2.35.3 From nobody Sat Nov 15 12:43:52 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=1751313816; cv=none; d=zohomail.com; s=zohoarc; b=J9yrZonUmgDnJgMuHPpJcsnoFeoHyD43bks9aw7p58zPas11YF7ij/WifntBgjhbY6PjraZFvY+AHzGoIWCP+alrMPUDWmHTJGOd/T35CAm+pjSdAhwrot30XwhM1xhVFW5wADa5f90gV19XEE2+yJ+rptgmn2QdwGDDF4yN2r0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751313816; 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=NoYIazTUb7UYgrEprPOq7hGNgqCYvNkOKEt64gj1Gz4=; b=ftBqvfJ5Dr2HZi26a3JjGy7lLnZiO9CG0v3rloZjOPD14UKs3QpGQTm0fUljb1+9Y4pMb/CaD/sxDSo5ciaQqozw/M58zoCOBYLRdBAZ0vgL+bU7BXFzFdtQrulrqm6bsS0cKybXQDU6suE8KARUzIh9pT6lYdisxKniWugCTFg= 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 1751313816957586.7404969459989; Mon, 30 Jun 2025 13:03:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWKgZ-0005x6-RP; Mon, 30 Jun 2025 16:01:03 -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 1uWKgU-0005Ys-Be for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:58 -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 1uWKgR-0007p3-RJ for qemu-devel@nongnu.org; Mon, 30 Jun 2025 16:00:57 -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 2FEBB21163; Mon, 30 Jun 2025 20:00:12 +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 29BDA1399F; Mon, 30 Jun 2025 20:00:09 +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 6F/0NsnsYmhQUAAAD6G6ig (envelope-from ); Mon, 30 Jun 2025 20:00:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313612; 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=NoYIazTUb7UYgrEprPOq7hGNgqCYvNkOKEt64gj1Gz4=; b=myYFL2WslFFtinQgHJMWM8YJ/ZR0caW2tKtP5LEkYHo0/nqiL677Ro2BXiuCBhKMel6Ga+ EziW3GXoXawP0Bn4aqw+fdMYgdidN4Ud2Anzr6Rgn6lUF/5FlmZN19q0Pqm/7uMAJ5IpH+ Tr3LocHuBFNF8jJUVZtHgnTKRGg/WPg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313612; 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=NoYIazTUb7UYgrEprPOq7hGNgqCYvNkOKEt64gj1Gz4=; b=udjGE/YZyYu1g9vOTvMRz/BZGBokgzK5SfrFcXUKMuNiHyY297SvVujw+xLyIqzpoZe4h8 AHazBAdcxiWB4yBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751313612; 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=NoYIazTUb7UYgrEprPOq7hGNgqCYvNkOKEt64gj1Gz4=; b=myYFL2WslFFtinQgHJMWM8YJ/ZR0caW2tKtP5LEkYHo0/nqiL677Ro2BXiuCBhKMel6Ga+ EziW3GXoXawP0Bn4aqw+fdMYgdidN4Ud2Anzr6Rgn6lUF/5FlmZN19q0Pqm/7uMAJ5IpH+ Tr3LocHuBFNF8jJUVZtHgnTKRGg/WPg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751313612; 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=NoYIazTUb7UYgrEprPOq7hGNgqCYvNkOKEt64gj1Gz4=; b=udjGE/YZyYu1g9vOTvMRz/BZGBokgzK5SfrFcXUKMuNiHyY297SvVujw+xLyIqzpoZe4h8 AHazBAdcxiWB4yBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 24/24] tests/qtest/migration: Pass the migration config to file tests Date: Mon, 30 Jun 2025 16:59:13 -0300 Message-Id: <20250630195913.28033-25-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250630195913.28033-1-farosas@suse.de> References: <20250630195913.28033-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)[-0.999]; 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_FIVE(0.00)[6]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; 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: 1751313818741116600 Content-Type: text/plain; charset="utf-8" Use the existing file tests to test the new way of passing parameters to the migration via the config argument to qmp_migrate*. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/file-tests.c | 68 +++++++++++---------------- tests/qtest/migration/framework.c | 9 ++-- tests/qtest/migration/precopy-tests.c | 1 + 3 files changed, 34 insertions(+), 44 deletions(-) diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/fil= e-tests.c index 4d78ce0855..656d6527e8 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -27,6 +27,7 @@ static void test_precopy_file(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", + .start.config =3D qdict_new(), }; =20 test_file_common(&args, true); @@ -74,6 +75,7 @@ static void test_precopy_file_offset_fdset(void) .connect_uri =3D uri, .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_file_offset_fdset, + .start.config =3D qdict_new(), }; =20 test_file_common(&args, false); @@ -88,6 +90,7 @@ static void test_precopy_file_offset(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", + .start.config =3D qdict_new(), }; =20 test_file_common(&args, false); @@ -102,6 +105,7 @@ static void test_precopy_file_offset_bad(void) .connect_uri =3D uri, .listen_uri =3D "defer", .result =3D MIG_TEST_QMP_ERROR, + .start.config =3D qdict_new(), }; =20 test_file_common(&args, false); @@ -114,11 +118,10 @@ static void test_precopy_file_mapped_ram_live(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, + .start.config =3D qdict_new(), }; =20 + qdict_put_bool(args.start.config, "mapped-ram", true); test_file_common(&args, false); } =20 @@ -129,11 +132,9 @@ static void test_precopy_file_mapped_ram(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, + .start.config =3D qdict_new(), }; - + qdict_put_bool(args.start.config, "mapped-ram", true); test_file_common(&args, true); } =20 @@ -144,12 +145,11 @@ static void test_multifd_file_mapped_ram_live(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, + .start.config =3D qdict_new(), }; =20 + qdict_put_bool(args.start.config, "mapped-ram", true); + qdict_put_bool(args.start.config, "multifd", true); test_file_common(&args, false); } =20 @@ -160,24 +160,13 @@ static void test_multifd_file_mapped_ram(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, + .start.config =3D qdict_new(), }; - + qdict_put_bool(args.start.config, "mapped-ram", true); + qdict_put_bool(args.start.config, "multifd", true); test_file_common(&args, true); } =20 -static void *migrate_hook_start_multifd_mapped_ram_dio(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_bool(from, "direct-io", true); - migrate_set_parameter_bool(to, "direct-io", true); - - return NULL; -} - static void test_multifd_file_mapped_ram_dio(void) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, @@ -185,13 +174,13 @@ static void test_multifd_file_mapped_ram_dio(void) MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram_dio, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, + .start.config =3D qdict_new(), }; =20 + qdict_put_bool(args.start.config, "direct-io", true); + qdict_put_bool(args.start.config, "mapped-ram", true); + qdict_put_bool(args.start.config, "multifd", true); + if (!probe_o_direct_support(tmpfs)) { g_test_skip("Filesystem does not support O_DIRECT"); return; @@ -235,9 +224,6 @@ static void *migrate_hook_start_multifd_mapped_ram_fdse= t_dio(QTestState *from, fdset_add_fds(from, file, O_WRONLY, 2, true); fdset_add_fds(to, file, O_RDONLY, 2, true); =20 - migrate_set_parameter_bool(from, "direct-io", true); - migrate_set_parameter_bool(to, "direct-io", true); - return NULL; } =20 @@ -261,12 +247,11 @@ static void test_multifd_file_mapped_ram_fdset(void) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset, .end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, + .start.config =3D qdict_new(), }; =20 + qdict_put_bool(args.start.config, "mapped-ram", true); + qdict_put_bool(args.start.config, "multifd", true); test_file_common(&args, true); } =20 @@ -279,12 +264,13 @@ static void test_multifd_file_mapped_ram_fdset_dio(vo= id) .listen_uri =3D "defer", .start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset_dio, .end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, + .start.config =3D qdict_new(), }; =20 + qdict_put_bool(args.start.config, "direct-io", true); + qdict_put_bool(args.start.config, "mapped-ram", true); + qdict_put_bool(args.start.config, "multifd", true); + if (!probe_o_direct_support(tmpfs)) { g_test_skip("Filesystem does not support O_DIRECT"); return; diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 5025299d6a..37c5c884af 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -974,18 +974,21 @@ void test_file_common(MigrateCommon *args, bool stop_= src) } =20 if (args->result =3D=3D MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, args->connect_uri, NULL, "{}"); + migrate_qmp_fail(from, args->connect_uri, NULL, "{ 'config': %p }", + args->start.config); goto finish; } =20 - migrate_qmp(from, to, args->connect_uri, NULL, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, "{ 'config': %p }", + args->start.config); wait_for_migration_complete(from); =20 /* * We need to wait for the source to finish before starting the * destination. */ - migrate_incoming_qmp(to, args->connect_uri, NULL, "{}"); + migrate_incoming_qmp(to, args->connect_uri, NULL, "{ 'config': %p }", + args->start.config); wait_for_migration_complete(to); =20 if (stop_src) { diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 35d4274c69..9606dc1d02 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -338,6 +338,7 @@ static void test_precopy_fd_file(void) .connect_uri =3D "fd:fd-mig", .start_hook =3D migrate_hook_start_precopy_fd_file, .end_hook =3D migrate_hook_end_fd, + .start.config =3D qdict_new(), }; test_file_common(&args, true); } --=20 2.35.3