From nobody Sat Sep 26 20:50:59 2026 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=1788387414; cv=none; d=zohomail.com; s=zohoarc; b=exNe2++fu5Rq5R65H9xwVpHFv6WbQzuPy8vYhcoFbCcmY4uW4zuBNbQ9LCcVtH41lycZBMYyOTllie28ZUXwxgeOp7DdOKRzQA+nnyJv3H4TrcQFPTW3i/HmU0sdstZUcr7JvUCGP/zW+RBW832BmbEUm2HiumanIeidjlF5cVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387414; 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=Oo43kuECY/APRHl4nCTe7/bnJ8RAMa6iv1OPvyqxt/0=; b=Me4HKkBEo7nRwUZG6/ckdEVkO1KdGNnJwjXXirO7TJpHm9XDQ2f0vhpEq4BTGwB1BibX+OEeCjaRyztFjb5zpZw3iaMImO9AD++QW9WiiEHbI2l8QS7hl337+zB1/LTrazd4JgJwsXS4Gn2iSKObxdBmejteP36wns3ltL0RXUk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387414781754.1677344192182; Wed, 2 Sep 2026 15:16:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFn-0000ry-9n; Wed, 02 Sep 2026 18:16:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFl-0000rD-Aq for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:21 -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 1x1tFj-0002MI-Nk for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:21 -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 22C8E21C16; Wed, 2 Sep 2026 22:16: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 18D6213736; Wed, 2 Sep 2026 22:16:05 +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 wLehNiWgmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387371; 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=Oo43kuECY/APRHl4nCTe7/bnJ8RAMa6iv1OPvyqxt/0=; b=CXdyC2efCXCK7ljXbv5l4kqHFs+fI2hn44gOoq5IlVPOq8NNE2TBCfglhnu9m2VXqAVwnB xicP40dhkzaJmQzMXTPm90GTT66bCdVEM6ow0wEHkYKjwa9eTRJUNpuiVArCf/UCFsqUej WPxFJ7E9zsb26RhAl2nD0EysfRcvybY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387371; 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=Oo43kuECY/APRHl4nCTe7/bnJ8RAMa6iv1OPvyqxt/0=; b=DPseUysl/obV2I5+hnKWCjQsucDhvYyGQ3wm7XwyFrYqmy9HlVLk4pTA3nlIKo15N3oR2+ e0EFVWgW5eMEzzDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387367; 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=Oo43kuECY/APRHl4nCTe7/bnJ8RAMa6iv1OPvyqxt/0=; b=GV3RILGwFDlCpZfxIubwx8eBv2H5TrLsy7RjZL9sF5uhISvweg13rP07gMednC0r0RBjYC UzJScGyY37vJ8smOtfw8kneStZb+75qrYECKVURsWn6idS2RS6GHDDZRDtR4U2loRguzEz HL2KRwvmp23aUvT6N8Y14vkw7xU5+Rw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387367; 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=Oo43kuECY/APRHl4nCTe7/bnJ8RAMa6iv1OPvyqxt/0=; b=0/3palMA39vSwnLldMT7uZDgXsesksKs4Eked0xXiUL/MyM/lcHSm6edPBu1rZeVyoK6fY +iQoX3E12RSZmGDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Chao Liu Subject: [PATCH 01/18] checkpatch: Fix checking of newlines in error messages Date: Wed, 2 Sep 2026 19:15:29 -0300 Message-ID: <20260902221547.1812481-2-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; 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]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; 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=lists1p.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: qemu development 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: 1788387419180154100 Content-Type: text/plain; charset="utf-8" Using newlines in the g_test_message is fine. It automatically adds the '#' required by the TAP protocol to the start of each line. Relax the regex for this function, but still forbid a trailing newline because it's added automatically and usually not what the user wants. Signed-off-by: Fabiano Rosas Reviewed-by: Markus Armbruster --- scripts/checkpatch.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 03f35e75012..fd4534b3a1e 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3303,13 +3303,20 @@ sub process { info_vreport| error_report| warn_report| - info_report| - g_test_message}x; + info_report}x; =20 if ($rawline =3D~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) { ERROR("Error messages should not contain newlines\n" . $herecurr); } =20 + # No newlines at the end + my $trail_newline_error_funcs =3D qr{g_test_message}x; + + if ($rawline =3D~ /\b(?:$trail_newline_error_funcs)\(.*\".*\\n\"/) { + ERROR("Error messages should not contain trailing " . + "newlines\n" . $herecurr); + } + # Continue checking for error messages that contains newlines. # This check handles cases where string literals are spread # over multiple lines. --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387414; cv=none; d=zohomail.com; s=zohoarc; b=Ui8Jkeng7hyEGfbzgD9cQOXQBRLKYQTPN5kEewupmZ4vFbXAYMcLtZX1Kk0mHKSMNXWO61FIFgMbGarKUqwCinh1Qz3K6O++TViwLXw3iJ5TXkZBP64lp37dJlVM6e4eHkvNS4yyE4RaDhPSCISdOunUR/cBtZwfq2ZMzxOic7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387414; 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=+HimmgTbe7K3y33ib5i6jbgv1dL+8i9MPYl8UdJnm9Q=; b=acAhIuXl5Sfgh2HycaklktPdmyxD/B3fT5K3HQ6+yKSPQUCmF5Lm9WAg42A/uB65c8Yi22eqvaCnfgagUTzC3Q5gnpjBxnEgNjG/vh4xdb1NWjFXfKxk1KiZW8EwbquVFQAEiyaa5n7rkVVnTKOfUnkw7sBNq7WtvYt/FeBEHAk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387414356665.3895307486375; Wed, 2 Sep 2026 15:16:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFm-0000rS-P1; Wed, 02 Sep 2026 18:16:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFl-0000rC-AC for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:21 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x1tFj-0002MJ-Nh for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:21 -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 6A88E1F8C1; Wed, 2 Sep 2026 22:16:08 +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 6C1A413738; Wed, 2 Sep 2026 22:16: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 SIxdDyegmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387372; 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=+HimmgTbe7K3y33ib5i6jbgv1dL+8i9MPYl8UdJnm9Q=; b=vHY8FoOMXx3wHLfwDtVMgEBCDKDbY204TZTLgbTM573IUpRpI3DgEWdUW2HHWaNUC9i3yE 0Q1C441TbZsQjrSFOqg8yAovsNIU+pxlLVaSJZCudrQTGGykZgnkSFI7L6eb5sP18SE478 bttLQ68rHHzBD/qG53gVXEaRY+5W+WQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387372; 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=+HimmgTbe7K3y33ib5i6jbgv1dL+8i9MPYl8UdJnm9Q=; b=zvfz60EN6RQ94/uVfRWiPLZYCnUgi5TFTO8dAzdBpi0z+quXJcVnE3MskOzpZR5INfUTGw pyuPtR72Xn/cyGCQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387368; 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=+HimmgTbe7K3y33ib5i6jbgv1dL+8i9MPYl8UdJnm9Q=; b=TPuyDvIf3NyjtcmBRfPPOOFw0Mx1KYBCKYl7qHgzUmd7G7+BgF3gYjm3CQibuKwibIyjpd m/6FKgLtMGTmaeEa+gd/qzwt3RWD/WM180faFnjz7akSKhsheX2lt5wYa98z5stev1j3Vr Vb4+nYbVjbsnsVl2e9de4Jx8le3mgWM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387368; 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=+HimmgTbe7K3y33ib5i6jbgv1dL+8i9MPYl8UdJnm9Q=; b=hvwiRfIXm2kuJLS8Eg0BQvfIkqXbvDbDyCyrp3lwDNVLXwKz8PnfOFINt9IO7usF074+Hd pJ+0RJIu5kr5OaCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PATCH 02/18] migration/options.c: Don't export migrate_tls_opts_free Date: Wed, 2 Sep 2026 19:15:30 -0300 Message-ID: <20260902221547.1812481-3-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; URIBL_BLOCKED(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387419042154100 Content-Type: text/plain; charset="utf-8" The migrate_tls_opts_free function was never used outside options.c. Make it static. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/options.c | 2 +- migration/options.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index d2575edb6cb..79a61ac60d6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1055,7 +1055,7 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 -void migrate_tls_opts_free(MigrationParameters *params) +static void migrate_tls_opts_free(MigrationParameters *params) { qapi_free_StrOrNull(params->tls_creds); qapi_free_StrOrNull(params->tls_hostname); diff --git a/migration/options.h b/migration/options.h index b46221998a0..c272eb62084 100644 --- a/migration/options.h +++ b/migration/options.h @@ -93,5 +93,4 @@ uint64_t migrate_rdma_chunk_size(void); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); -void migrate_tls_opts_free(MigrationParameters *params); #endif --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387478; cv=none; d=zohomail.com; s=zohoarc; b=bwNWAFWoNtRJXz2JC0vFv2fbHO/NMewavLL8+qBG19snsTyv03slEun7mmQP0dORjdEwlZ+ttDwMZuKayBPhHfPzkZsBZrGNTGgQ4+1knxDv90eXGmkJO7KTlisUOx7P1qf2F+XslguyjnDN9Gkvt+hVoA1gjI4LvSNVGxfIbbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387478; 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=/7tPatPQuvMWp3JNW+Ezh3UH4BRhZlwseZ8/UCcImzw=; b=C9LeZskpJM1S6TQdEipPmPwdw5oVhNlIuIjXoH5TnRrf11lBLWyrFg4uENChGxoJz2XvL2ruMoU763CuvA6p2+DLgqTvaqC0lsQsGmCgLk6AwDyTb6TJjrqv6w/bd5dIkqQSpaSi9YfiHNUn1e8M8z2It0UjD2exWcgoK6M9f8g= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387478966159.36802626186636; Wed, 2 Sep 2026 15:17:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFp-0000si-5B; Wed, 02 Sep 2026 18:16:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFm-0000rT-OE for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:22 -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 1x1tFj-0002MR-S5 for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:22 -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 902C71F8D6; Wed, 2 Sep 2026 22:16: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 90F7113869; Wed, 2 Sep 2026 22:16:08 +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 0ORaGCigmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387373; 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=/7tPatPQuvMWp3JNW+Ezh3UH4BRhZlwseZ8/UCcImzw=; b=jr3Uwuo9+Fr/2ojDSwRxtJE6rnbfAHeyfTIeizA9CBf1lCQ1QphRysRm6Y9LNIB22BfPO8 apJE3ln4k8Pxhvj6Q6Wtsufed5xe0BD5CTyY6sT/+21Kz3+FOell9Oy1oCDFNDouGppyii UDSBVysSQ/MTFYbpnxd2gMSpCseWxvs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387373; 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=/7tPatPQuvMWp3JNW+Ezh3UH4BRhZlwseZ8/UCcImzw=; b=P54MAn5l+Afa5tJx8AZuloSWh+9v+/NRFR9sSKlC17B+XSNoULtPkT4O6zYUQyxIYNZkds GhYVAFMa0xUIAqCw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387369; 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=/7tPatPQuvMWp3JNW+Ezh3UH4BRhZlwseZ8/UCcImzw=; b=wlQLraxOU0czanQFTWJsoxTe9bGYOx7suwL+clXaOlOSJ/0rFCfsYTODuvUpADBIhKIg5t GFLFwIjr31aDmoHqrQqXDsdO4Q2jtW2ZLtZyWV4BPp7Pu090u83i/6DVv+Wpq6F5ISH2f7 +8sxVPWMnMbfI7IkXDqG4909EIPwVoI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387369; 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=/7tPatPQuvMWp3JNW+Ezh3UH4BRhZlwseZ8/UCcImzw=; b=uxZ/QKjGV0T3YAYMRwjv1I3jMlHcF88fIuEMc0XqeJ1yAa2Pdpeyo3T3hysuM+K2Oscy8T B/sfTw8nal8Wf8Ag== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PATCH 03/18] migration: Rename variables in qmp_migrate_set_parameters Date: Wed, 2 Sep 2026 19:15:31 -0300 Message-ID: <20260902221547.1812481-4-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; 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=lists1p.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: -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: qemu development 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: 1788387481151154100 Content-Type: text/plain; charset="utf-8" Give the variables in qmp_migrate_set_parameters more semantic names. s/params/input/ this is the user input from qapi s/tmp/new/ this is the combination of the current parameters and the input Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/options.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/options.c b/migration/options.c index 79a61ac60d6..388cb07dd0f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1583,9 +1583,9 @@ static void migrate_params_apply(MigrationParameters = *params) } } =20 -void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +void qmp_migrate_set_parameters(MigrationParameters *input, Error **errp) { - MigrationParameters tmp; + MigrationParameters new; =20 /* * Convert QTYPE_QNULL and NULL to the empty string (""). Even @@ -1595,18 +1595,18 @@ void qmp_migrate_set_parameters(MigrationParameters= *params, Error **errp) * the options to the rest of the migration code already use * return NULL when the empty string is found. */ - tls_opt_to_str(params->tls_creds); - tls_opt_to_str(params->tls_hostname); - tls_opt_to_str(params->tls_authz); + tls_opt_to_str(input->tls_creds); + tls_opt_to_str(input->tls_hostname); + tls_opt_to_str(input->tls_authz); =20 - migrate_params_test_apply(params, &tmp); + migrate_params_test_apply(input, &new); =20 - if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(params); - migrate_post_update_params(params, errp); + if (migrate_params_check(&new, errp)) { + migrate_params_apply(input); + migrate_post_update_params(input, errp); } =20 - migrate_tls_opts_free(&tmp); - qapi_free_BitmapMigrationNodeAliasList(tmp.block_bitmap_mapping); - qapi_free_strList(tmp.cpr_exec_command); + migrate_tls_opts_free(&new); + qapi_free_BitmapMigrationNodeAliasList(new.block_bitmap_mapping); + qapi_free_strList(new.cpr_exec_command); } --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387427; cv=none; d=zohomail.com; s=zohoarc; b=da5OVykUctegVg2ISgkLnThW/kcKr33WHzjzIOgYO1/SA+BXnyZYsGxs5XeSiPEtuqkbtwLTkYAAK6qx5wDG4rP1iYSE3MghXLyyaa63T3yblzdzb9Y80xRdySpjLAO8WFgDxajHy4Z5qEZCryETcKIRhDEEdAN5WuLJc9hMrzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387427; 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=f2aIC02/P5dqceKH+UcXsFh0q78ZC2LoV4iCaKX9gz8=; b=CWe1vZEDDG41g7D+zpz9EKzD4TDsT96b3TyCyr2O1B/j5o3B0/sZe/77AJ3ZhXL2GPR5wDY/6mv7ZkIn7HR6hWbHajMH0OkpiF8Zh1Leq9/hoCnzLimjzsBTSjDdZpKKO/6SRHNUhou3fvj0UR/lZMD+OPt4BhfmrKjzN3Ek2XY= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387427116522.1549744011205; Wed, 2 Sep 2026 15:17:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFq-0000tG-Oj; Wed, 02 Sep 2026 18:16:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFn-0000rk-3B for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:23 -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 1x1tFk-0002Mb-Bs for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:22 -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 E363F1FA8F; Wed, 2 Sep 2026 22:16:10 +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 B791713874; Wed, 2 Sep 2026 22:16: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 kF7HISmgmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387375; 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=f2aIC02/P5dqceKH+UcXsFh0q78ZC2LoV4iCaKX9gz8=; b=n38/w0O/MMA1k78dOqmyA2V+SAfmCV1vJ5oiRTdpYcGK5jPcndm+XD4yirPjeci0QIV3Bm uEda0U85XNX4pK9L08uw4Pa4hShrkrixvW3oiAx7JxlArKAWfJCnyiFDUMVcKKJ9PvWs7d ZUDIk2oM94VAaVPMnIyZLN5v1sui5Bw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387375; 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=f2aIC02/P5dqceKH+UcXsFh0q78ZC2LoV4iCaKX9gz8=; b=tiggtW7oyyEUqIvXumgdDJ8n8xoWGQ+aHvmgVx+1Tpc7ig/ZlI9JyFfC2iBwNmum8Z+4Fo jbrIC0WQqGOAG3Ag== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=DfaYYxi2; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BXx20utd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387370; 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=f2aIC02/P5dqceKH+UcXsFh0q78ZC2LoV4iCaKX9gz8=; b=DfaYYxi2jdqWz6EySuRxYZOXYLhMb9oDNmu0czz5TPZuqdp1AuPoeYL7e2sG6MtBwW3xJ5 rbDyPcLMk6dOI/c9rIxztS4u7MjMdshAlJHT1NdtJe189sDOBywCuLyw10AzUsthnWPWGk cQ4eXYAi3yRkMKrBMEjaMvcPqabgWrw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387370; 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=f2aIC02/P5dqceKH+UcXsFh0q78ZC2LoV4iCaKX9gz8=; b=BXx20utd6aGyToTsA9O3Dyzh4KR4RYwn4xPq+YMWsK07c3setdhsumRxAlmvq5aYNOfZ+Q vdSf7mJcoJ7MP1DA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PATCH 04/18] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Date: Wed, 2 Sep 2026 19:15:32 -0300 Message-ID: <20260902221547.1812481-5-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: E363F1FA8F 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)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(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]; 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)[3]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:email,suse.de:mid]; 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=lists1p.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: -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: qemu development 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: 1788387430675154101 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. Since parameters are not individually checked anymore, the setting of s->has_block_bitmap_mapping moves into migrate_post_update_params(). Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/options.c | 141 +++++--------------------------------------- 1 file changed, 14 insertions(+), 127 deletions(-) diff --git a/migration/options.c b/migration/options.c index 388cb07dd0f..6b787950808 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1160,6 +1160,10 @@ static void migrate_post_update_params(MigrationPara= meters *new, Error **errp) migration_rate_set(new->max_postcopy_bandwidth); } } + + if (new->has_block_bitmap_mapping) { + s->has_block_bitmap_mapping =3D true; + } } =20 /* @@ -1451,136 +1455,19 @@ static void migrate_params_test_apply(MigrationPar= ameters *params, } } =20 +/* + * Caller must ensure the has_* fields of @params are true so they all + * get copied and the pointer members don't dangle. + */ 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 */ - - 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; - } - - if (params->has_x_rdma_chunk_size) { - s->parameters.x_rdma_chunk_size =3D params->x_rdma_chunk_size; - } - - if (params->has_cpr_exec_command) { - qapi_free_strList(s->parameters.cpr_exec_command); - s->parameters.cpr_exec_command =3D - QAPI_CLONE(strList, params->cpr_exec_command); - } + migrate_tls_opts_free(cur); + qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); + qapi_free_strList(cur->cpr_exec_command); + QAPI_CLONE_MEMBERS(MigrationParameters, cur, params); } =20 void qmp_migrate_set_parameters(MigrationParameters *input, Error **errp) @@ -1602,7 +1489,7 @@ void qmp_migrate_set_parameters(MigrationParameters *= input, Error **errp) migrate_params_test_apply(input, &new); =20 if (migrate_params_check(&new, errp)) { - migrate_params_apply(input); + migrate_params_apply(&new); migrate_post_update_params(input, errp); } =20 --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387507; cv=none; d=zohomail.com; s=zohoarc; b=SYcr0yLEk19iskDDBXN9+0c+tQlZ2ZG1goSiFmQaK8T25DUkq4Am+vsg0M+EtOugMswmZ57a5tzlP/MzldYBy7tCRZEl6h4a1iMvM2xeLEj+3G16+ZuzQCqpC4LSkTbSVRi6DMmLKmbQM9TX895o7wCd3Ge0uZ+VNLmtVw/dc48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387507; 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=AFPfzUU2OEdpmxfPl+scf6BGZCY/9rjJZQSZQYyvRXY=; b=HSAWAGXFMtZoA+GJvMzFm8gxKPrG798+2jc5FZiewPYkhAT68N1r77jE2rdbvBfHWtusmbLLeP0dXDAunoPr8d0ReBuB28iDBETQ/DEfPshNuDeku+33F9mW8M1tizhtCMz8v9HeOwVLjTPdoL8oLyfcJjEgGR22DGQbApAgPTA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178838750744655.78198313770474; Wed, 2 Sep 2026 15:18:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFs-0000u4-T6; Wed, 02 Sep 2026 18:16:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFp-0000t7-Vo for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:26 -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 1x1tFn-0002N4-L2 for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:25 -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 44CD51FA90; Wed, 2 Sep 2026 22:16:14 +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 169E613888; Wed, 2 Sep 2026 22:16:10 +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 OOAaNiqgmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387378; 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=AFPfzUU2OEdpmxfPl+scf6BGZCY/9rjJZQSZQYyvRXY=; b=yC7SCJo/7Kz5q3zl0pecIOpsK2ZzlU4KN75qfFspfSKjwXcAMF9pYopjqnafNwmp4oIrX8 oVEQo5xk7IVpkJVFMC2FFzh9okKDbwr5jw7BA6J1QzGSN4Nm39RiuTbi/gLt8PjWRTpHPH Y1j2b8qJ8HWbgqY7J8GnJ6WF5mFSMj0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387378; 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=AFPfzUU2OEdpmxfPl+scf6BGZCY/9rjJZQSZQYyvRXY=; b=EFyR2n7RRhl1oCbM+vQDIOXhQmvrNljdNdfn6uWh+BYUcuhJ37ov5QP8bxFh1NHgpFlaEh mzeLwyivLVs2jZAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=jPCD8Wjn; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BsvM5ln5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387374; 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=AFPfzUU2OEdpmxfPl+scf6BGZCY/9rjJZQSZQYyvRXY=; b=jPCD8Wjn6NPVhquwAPT5k6ziptFOQyxwMG/Ne7mkHIIK9FEIcNbtd2DVr1iZmQ2OB9asH4 huvmGrxch7xQIaMDLlfWiNo5/D4Pnu27/m+zroWPD2IYwNxvaYdTghkdkNQJ7AWo5MubTq f1m+OqPF8RgOeSN5tGr/IOZOnyA0nIo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387374; 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=AFPfzUU2OEdpmxfPl+scf6BGZCY/9rjJZQSZQYyvRXY=; b=BsvM5ln5bejDskG8K/Jb4XOx9WXGJu1TnnNtlzFK/1mu+8oPJpoI0FPS2r+5jKrY32ZzGQ U/QLrLKk2NZDfDCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PATCH 05/18] migration: Merge parameter structs instead of assigning one by one Date: Wed, 2 Sep 2026 19:15:33 -0300 Message-ID: <20260902221547.1812481-6-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 44CD51FA90 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] 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=lists1p.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: -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: qemu development 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: 1788387509681154100 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 merge operation using QAPI visitors and QDict. The purpose of that routine is to update a temporary structure (pre-populated with the current migration parameters), with the values received from the user via QAPI. As a result, the temporary structure will then contain the "to be applied" parameters and it's validated before being used to overwrite the parameters currently in use. The update is currently done as follows: where 'params' is the user input from QAPI, for each parameter: a) check if the option is present params->has_ =3D=3D true params-> !=3D NULL // for strings b) if the parameter is a pointer, free the to-be-assigned member and allocate memory for the copy from params c) assign the user provided value to the temporary structure. Step (a) is the same in principle as what the QAPI visitors do at visit_type_MigrationParameters_members(). Steps (b) and (c) are roughly the same as what the QDict implementation does when qdict_del() and qdict_put_obj() are combined. Therefore, replace the open-coded function with migrate_params_merge(), which achieves the same goal, but uses visitors and QDict. This hides the details of QAPI (has_*) from the migration code and avoids the need to update migrate_params_test_apply() every time a new migration parameter is added. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/options.c | 201 +++++++++++++++----------------------------- 1 file changed, 66 insertions(+), 135 deletions(-) diff --git a/migration/options.c b/migration/options.c index 6b787950808..de091d2eee3 100644 --- a/migration/options.c +++ b/migration/options.c @@ -20,6 +20,9 @@ #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 "qobject/qdict.h" #include "qobject/qnull.h" #include "system/runstate.h" #include "migration/colo.h" @@ -1074,6 +1077,28 @@ static void tls_opt_to_str(StrOrNull *opt) opt->u.s =3D g_strdup(""); } =20 +static QDict *migrate_params_to_dict(MigrationParameters *p, Error **errp) +{ + QObject *obj =3D NULL; + Visitor *v =3D qobject_output_visitor_new(&obj); + + if (visit_type_MigrationParameters(v, NULL, &p, errp)) { + visit_complete(v, &obj); + } + visit_free(v); + return qobject_to(QDict, obj); +} + +static MigrationParameters *migrate_params_from_dict(QDict *d, Error **err= p) +{ + Visitor *v =3D qobject_input_visitor_new(QOBJECT(d)); + MigrationParameters *tmp =3D NULL; + + visit_type_MigrationParameters(v, NULL, &tmp, errp); + visit_free(v); + return tmp; +} + /* * query-migrate-parameters expects all members of MigrationParameters * to be present, but we cannot mark them non-optional in QAPI because @@ -1166,6 +1191,39 @@ static void migrate_post_update_params(MigrationPara= meters *new, Error **errp) } } =20 +static bool migrate_params_merge(MigrationParameters *in1, + MigrationParameters *in2, + MigrationParameters **out, + Error **errp) +{ + g_autoptr(QDict) d1 =3D NULL; + g_autoptr(QDict) d2 =3D NULL; + const QDictEntry *e; + + d1 =3D migrate_params_to_dict(in1, errp); + if (!d1) { + return false; + } + + d2 =3D migrate_params_to_dict(in2, errp); + if (!d2) { + return false; + } + + for (e =3D qdict_first(d2); e; e =3D qdict_next(d2, e)) { + const char *key =3D qdict_entry_key(e); + QObject *value =3D qdict_entry_value(e); + + qdict_del(d1, key); + qobject_ref(value); + qdict_put_obj(d1, key, value); + } + + *out =3D migrate_params_from_dict(d1, errp); + + return !!*out; +} + /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. @@ -1328,133 +1386,6 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) return true; } =20 -static void migrate_params_test_apply(MigrationParameters *params, - MigrationParameters *dest) -{ - MigrationState *s =3D migrate_get_current(); - - 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; - } - - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; - } - - if (params->tls_creds) { - qapi_free_StrOrNull(dest->tls_creds); - dest->tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_creds); - } - - if (params->tls_hostname) { - qapi_free_StrOrNull(dest->tls_hostname); - dest->tls_hostname =3D QAPI_CLONE(StrOrNull, params->tls_hostname); - } - - if (params->tls_authz) { - qapi_free_StrOrNull(dest->tls_authz); - dest->tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_authz); - } - - if (params->has_max_bandwidth) { - dest->max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_avail_switchover_bandwidth) { - dest->avail_switchover_bandwidth =3D params->avail_switchover_band= width; - } - - if (params->has_downtime_limit) { - dest->downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - dest->x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_multifd_channels) { - dest->multifd_channels =3D params->multifd_channels; - } - 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) { - qapi_free_BitmapMigrationNodeAliasList(dest->block_bitmap_mapping); - dest->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAlias= List, - params->block_bitmap_mappi= ng); - } - - 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; - } - - if (params->has_x_rdma_chunk_size) { - dest->x_rdma_chunk_size =3D params->x_rdma_chunk_size; - } - - if (params->has_cpr_exec_command) { - qapi_free_strList(dest->cpr_exec_command); - dest->cpr_exec_command =3D QAPI_CLONE(strList, params->cpr_exec_co= mmand); - } -} - /* * Caller must ensure the has_* fields of @params are true so they all * get copied and the pointer members don't dangle. @@ -1472,7 +1403,8 @@ static void migrate_params_apply(MigrationParameters = *params) =20 void qmp_migrate_set_parameters(MigrationParameters *input, Error **errp) { - MigrationParameters new; + MigrationParameters *cur =3D &migrate_get_current()->parameters; + g_autoptr(MigrationParameters) new =3D NULL; =20 /* * Convert QTYPE_QNULL and NULL to the empty string (""). Even @@ -1486,14 +1418,13 @@ void qmp_migrate_set_parameters(MigrationParameters= *input, Error **errp) tls_opt_to_str(input->tls_hostname); tls_opt_to_str(input->tls_authz); =20 - migrate_params_test_apply(input, &new); + /* merge input on top of current */ + if (!migrate_params_merge(cur, input, &new, errp)) { + return; + } =20 - if (migrate_params_check(&new, errp)) { - migrate_params_apply(&new); + if (migrate_params_check(new, errp)) { + migrate_params_apply(new); migrate_post_update_params(input, errp); } - - migrate_tls_opts_free(&new); - qapi_free_BitmapMigrationNodeAliasList(new.block_bitmap_mapping); - qapi_free_strList(new.cpr_exec_command); } --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387508; cv=none; d=zohomail.com; s=zohoarc; b=UjvVjoU0tNK/qindc91MWr3yernZJqCUZEU3vJ33t8KDqP95LuuLV54ayQhJVFf1V33kyeUlgNcaXD4nxG6KOJ/rxKXiR2qSoMjKb3knH5zHf81f3a055jMd8+Ml9CtML+z+NIt/ptYdglUagpULJfzTuyfUaXqQoYxXYpADT5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387508; 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=X3OytNN0qIsfTEtxTlsxiaPkakfwsHemkEXqKysUj5M=; b=oHr5v8pMe7NbWXJsyg5tm4M/Nra4xwcFkGUgq4/5mCAaLnNx0qRNLzW38HOeT6Tq+7aHYYdfzJ76hbEK1FJ9OxsQNi8UsfyJOkSsq6sh4D5XJs141qNLKobFp9WY80YqVwpm27Jx79D+JLY5o3LVmT1hrXr307n17DHnyb95dzE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387508406982.0351811470433; Wed, 2 Sep 2026 15:18:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFr-0000tS-DF; Wed, 02 Sep 2026 18:16:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFp-0000sv-Ly for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:25 -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 1x1tFo-0002N9-4N for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:25 -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 6270F1FA9A; Wed, 2 Sep 2026 22:16:14 +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 3B7C513918; Wed, 2 Sep 2026 22:16:12 +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 WKN+AyygmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387378; 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=X3OytNN0qIsfTEtxTlsxiaPkakfwsHemkEXqKysUj5M=; b=kAVWVdeX06OsCBg7ULhK7K397IvP361FUoWPIaRMuaH+602BHtHwMtqTdNiy45nnlM3fau FioHkyxXlBwFDHvsoKUeK5Rhy7bcqRXf0s8QYPu1jEDpOsdepiZUfLniWe/dJaW0R5Js+Q Pabfaiv/qEfm6mDpc/t17IajnSqnHXM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387378; 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=X3OytNN0qIsfTEtxTlsxiaPkakfwsHemkEXqKysUj5M=; b=2sADHfe4iRBHl02sLhzPx/A8b0Engnm7eafs4WYzeMorOMzgRYBO77zAP83Me6Rj/7exsE ck9fB8GSX8srAeAQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387374; 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=X3OytNN0qIsfTEtxTlsxiaPkakfwsHemkEXqKysUj5M=; b=Ss7Rx8IhVapVNNjdzhPpDNIsgj+WCMIPnNcWVe2gBP7zevgIdVz4DGOzNxHpbpDtRHUmUs eAJ4BKschRp1iPzI3ouxZOonIW/e/6QRLFkRmt7zmlf4CgqvxdTIZmZ4cIXus584q2naZO rGlDkX2ZoifCEaKMYDYocFbn6oMURmo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387374; 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=X3OytNN0qIsfTEtxTlsxiaPkakfwsHemkEXqKysUj5M=; b=JsGd6vUoRaiIFpCrYynsgtv9nETwBk2kN1IbSnlmnQ/t9enWa9lrJKY7yUVL6IYVzkchmC cSPXoMfP4HRGYJBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PATCH 06/18] migration: Open code migrate_params_apply Date: Wed, 2 Sep 2026 19:15:34 -0300 Message-ID: <20260902221547.1812481-7-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; 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]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387510328158500 Content-Type: text/plain; charset="utf-8" Remove migrate_params_apply so the logic of setting migration parameters is all in one spot. Suggested-by: Prasad Pandit Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/options.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/migration/options.c b/migration/options.c index de091d2eee3..f7c154079bd 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1386,21 +1386,6 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return true; } =20 -/* - * Caller must ensure the has_* fields of @params are true so they all - * get copied and the pointer members don't dangle. - */ -static void migrate_params_apply(MigrationParameters *params) -{ - MigrationState *s =3D migrate_get_current(); - MigrationParameters *cur =3D &s->parameters; - - migrate_tls_opts_free(cur); - qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); - qapi_free_strList(cur->cpr_exec_command); - QAPI_CLONE_MEMBERS(MigrationParameters, cur, params); -} - void qmp_migrate_set_parameters(MigrationParameters *input, Error **errp) { MigrationParameters *cur =3D &migrate_get_current()->parameters; @@ -1423,8 +1408,15 @@ void qmp_migrate_set_parameters(MigrationParameters = *input, Error **errp) return; } =20 - if (migrate_params_check(new, errp)) { - migrate_params_apply(new); - migrate_post_update_params(input, errp); + if (!migrate_params_check(new, errp)) { + return; } + + migrate_tls_opts_free(cur); + qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); + qapi_free_strList(cur->cpr_exec_command); + + QAPI_CLONE_MEMBERS(MigrationParameters, cur, new); + + migrate_post_update_params(input, errp); } --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387498; cv=none; d=zohomail.com; s=zohoarc; b=eISMVuBBrgNP3vWxrtX1P6MyNbIBmcidSadt3rJf+prDyTIwOUA/VMc/+vkYEi2jMYWaEk5a58KxhJKtIUU7OVvY3W55WnV0zW5MZ92iOU/8+OfsNnhCABMHUe+PhNEbhVDfrHRIC66f9/luRpLp4q3mdJ2A6qf5bJP0JCwTnAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387498; 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=1rGk1nT0vkk2bDXEEWz1WOpRQavZ9e8ic5mdHS6qWjA=; b=JQC0+/MMf9BTi2PqbE05s6EUwyNhywME7JmPl08/BSPF0jEMpoMm2pUqfmCv76iPPdBACrtU3EwklEKp25pKlPX6ntMcoIRungTKhhUFdT2w5/N4gbv822GnqI2DmRe+YlF1fdPrGbVMrYIMI8UpQsUq+7mrYjH2XJXZ9YJJ2VI= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387498042528.3624399627414; Wed, 2 Sep 2026 15:18:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFt-0000u7-6v; Wed, 02 Sep 2026 18:16:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFq-0000tH-VT for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:26 -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 1x1tFo-0002NK-W5 for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16: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 8818E1FAA0; Wed, 2 Sep 2026 22:16:15 +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 8DC1D1393C; Wed, 2 Sep 2026 22:16:13 +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 cIybFy2gmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387379; 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=1rGk1nT0vkk2bDXEEWz1WOpRQavZ9e8ic5mdHS6qWjA=; b=00ufZaTxakvRaCrPYnHEx66kMmg7wVWmBRSP+v8rI1WNETjvk1z6kK5101KYvruU+ayXHY j0iUCJ7V1lXZaHUKD5S+HlYeEXBTYS3Yn6GLYlGPq/Hn2bF5nWCeOV61yW1KpitBeBK+J5 QDEc8Kg6MRp56NCGW8f2/LMGJU8F/PI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387379; 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=1rGk1nT0vkk2bDXEEWz1WOpRQavZ9e8ic5mdHS6qWjA=; b=7dEO2cdR2KLb8h6srdbZOEG4mEi5nykxlmvUgq4NFLh1cG6ogALzgypSTm3UHKt7MOZ3vW wC0mhwMAg79rUSDQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=mSwedDFr; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=+DxNBwbK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387375; 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=1rGk1nT0vkk2bDXEEWz1WOpRQavZ9e8ic5mdHS6qWjA=; b=mSwedDFreCZpDP4TNwoWUZrmPRMajLcJSpQymLHkz5uM+8qyRRl+J8gI4Qgsk7oH5ydtwP QbA3giPAW3pAnezQew6IdFn1g35m6+UwLWRIF9NBV+U8/pFN33i91h9WxrJuZmul48/dEP wbdrBa4+il720p20SA8KCuXcw54Tj0A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387375; 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=1rGk1nT0vkk2bDXEEWz1WOpRQavZ9e8ic5mdHS6qWjA=; b=+DxNBwbKhQM/gb3s6TblDpTmunjZpHO3omaiNLa9utr36VGWdoB3HE5JXP/rHu0zwhTPWN C6iXH2GXdDcXRoCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PATCH 07/18] migration: Stop freeing s->parameters members individually Date: Wed, 2 Sep 2026 19:15:35 -0300 Message-ID: <20260902221547.1812481-8-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 8818E1FAA0 X-Spamd-Result: default: False [-3.01 / 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)[]; 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_DN_SOME(0.00)[]; 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]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim,suse.de:email,suse.de:mid]; RCVD_COUNT_TWO(0.00)[2]; 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387499416154100 Content-Type: text/plain; charset="utf-8" Expecting every pointer member from s->parameters to be freed individually is prone to leave some fields forgotten when the code is eventually updated. Use a dealloc visitor to free them all at once. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/options.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/migration/options.c b/migration/options.c index f7c154079bd..6d7ef2df986 100644 --- a/migration/options.c +++ b/migration/options.c @@ -16,6 +16,7 @@ #include "qemu/units.h" #include "exec/target_page.h" #include "qapi/clone-visitor.h" +#include "qapi/dealloc-visitor.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" @@ -1058,11 +1059,21 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 -static void migrate_tls_opts_free(MigrationParameters *params) +static bool migrate_params_free(MigrationParameters *params, Error **errp) { - qapi_free_StrOrNull(params->tls_creds); - qapi_free_StrOrNull(params->tls_hostname); - qapi_free_StrOrNull(params->tls_authz); + Visitor *v =3D qapi_dealloc_visitor_new(); + bool ret; + + /* + * qapi_free_MigrationParameters can't be used here because + * MigrationParameters is embedded in MigrationState due to qdev + * needing to access the offset of the migration properties inside + * the migration object. + */ + ret =3D visit_type_MigrationParameters_members(v, params, errp); + visit_free(v); + + return ret; } =20 /* normalize QTYPE_QNULL to QTYPE_QSTRING "" */ @@ -1412,9 +1423,9 @@ void qmp_migrate_set_parameters(MigrationParameters *= input, Error **errp) return; } =20 - migrate_tls_opts_free(cur); - qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); - qapi_free_strList(cur->cpr_exec_command); + if (!migrate_params_free(cur, errp)) { + return; + } =20 QAPI_CLONE_MEMBERS(MigrationParameters, cur, new); =20 --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387506; cv=none; d=zohomail.com; s=zohoarc; b=j4NcxTMUMJKWwV9sc2L7aUjCl2KF3KyPa516YOsy+xvRmwqEa6DnXn9N0soMLml3RokZnyeKOo2q5UMgf1ueceTVjdP+oS2Head+A1KK9cx2kLbGaUAhauO3r+2DgF+9GP7m6BxU83v+omX+XceCH8MhmSUFGQ7jsca9qQJmIIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387506; 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=dcn2r8s+aQuk9aLNAj/vFTPpl6cE/XVCbFEBQsbFe7w=; b=VQ0FLhGIBLXBGrH/LbTdD9hfk0NzuX6pD34e3Nqgam9lGlTs4ILm0AgcCaAkUyoxupXNOp4nS9IwtbWd3RKCFqY1IJ9TmnITrxjjYD1yAbDl25OWyiHkb+JoLZRS8oQOwHnu2Dl7wYNo2bqoXkCX49mGqv18B2BWtP8M6c3C61k= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387506751626.9296181770823; Wed, 2 Sep 2026 15:18:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFt-0000uG-Df; Wed, 02 Sep 2026 18:16:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFr-0000tI-2g for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16: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 1x1tFp-0002NM-1C for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16: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 A90F51FAA3; Wed, 2 Sep 2026 22:16:15 +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 B66B713515; Wed, 2 Sep 2026 22:16:14 +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 +MGDIS6gmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387379; 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=dcn2r8s+aQuk9aLNAj/vFTPpl6cE/XVCbFEBQsbFe7w=; b=uyizPf1E+nDOlDyENggEA9lbZEkqBM1qKPXNsO2npekIzVj8Xcs3mvhTOZCrRQUtiEByS7 InOTR/kQ8IhoALg4cylPYOIxje+KNdpYVwm3jQhxKlN2htFB2v/JRsPo5Be6QaEKmUGQKd D1FCajQhkZA1t98Znv3tCLAZelrareM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387379; 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=dcn2r8s+aQuk9aLNAj/vFTPpl6cE/XVCbFEBQsbFe7w=; b=J131wIFQ5BWV8HrWsantqvkViYA3/7N8lM6tDyz1i3g504+leUPRUT67D+MMMtoMFe+oeQ KTwb8U+yk9sWzYCg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="KcKZ8E/C"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="a7cQmy/j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387375; 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=dcn2r8s+aQuk9aLNAj/vFTPpl6cE/XVCbFEBQsbFe7w=; b=KcKZ8E/C/74YWA8QUgr812kPQGnFtCKxMktqBRKKk0ZeFTWqjFh50h6rvaZo4YBzwV+TL1 1VlBiDr9TJN9NfozQogJKA6m9dtBiZBCoCcTQwMA5AgkDg/4A3nxjtTGpjPvuHFz2e0DW+ c7wuL+GmGg65HPV1hIc0p5yr0le7R/w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387375; 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=dcn2r8s+aQuk9aLNAj/vFTPpl6cE/XVCbFEBQsbFe7w=; b=a7cQmy/jimy31Gqe+h00wmDXmHY2t1oB7h2mzsamy3CgaTPh4X4/34Yj9yJzpuMutkUz9W ZuPbUWM0gnomE+CA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PATCH 08/18] migration: Use migrate_params_free during finalize Date: Wed, 2 Sep 2026 19:15:36 -0300 Message-ID: <20260902221547.1812481-9-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: A90F51FAA3 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email,suse.de:mid]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] 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=lists1p.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: -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: qemu development 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: 1788387508310158500 Content-Type: text/plain; charset="utf-8" Use the recently introduced migrate_params_free routine at migration_instance_finalize() so that newly added pointers are already freed by default. Special case: The TLS options are currently the only pointers that also have a qdev property implementation, so they will be freed by qdev using the .release method. Update the method so that a second invocation of qapi_free_StrOrNull doesn't assert. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 3 +-- migration/options.c | 7 ++++--- migration/options.h | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b413d28622a..dab282dd2f3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4039,8 +4039,7 @@ static void migration_instance_finalize(Object *obj) { MigrationState *ms =3D MIGRATION(obj); =20 - qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); - qapi_free_strList(ms->parameters.cpr_exec_command); + migrate_params_free(&ms->parameters, NULL); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); diff --git a/migration/options.c b/migration/options.c index 6d7ef2df986..bd7be8f9832 100644 --- a/migration/options.c +++ b/migration/options.c @@ -271,8 +271,9 @@ static void set_StrOrNull(Object *obj, Visitor *v, cons= t char *name, =20 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)); + StrOrNull **ptr =3D object_field_prop_ptr(obj, opaque); + + g_clear_pointer(ptr, qapi_free_StrOrNull); } =20 static void set_default_value_tls_opt(ObjectProperty *op, const Property *= prop) @@ -1059,7 +1060,7 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 -static bool migrate_params_free(MigrationParameters *params, Error **errp) +bool migrate_params_free(MigrationParameters *params, Error **errp) { Visitor *v =3D qapi_dealloc_visitor_new(); bool ret; diff --git a/migration/options.h b/migration/options.h index c272eb62084..c7da2d0b5b0 100644 --- a/migration/options.h +++ b/migration/options.h @@ -93,4 +93,5 @@ uint64_t migrate_rdma_chunk_size(void); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); +bool migrate_params_free(MigrationParameters *params, Error **errp); #endif --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387475; cv=none; d=zohomail.com; s=zohoarc; b=iQA+Ps4afZACcVulbRAHtEfWKss+sHu/B67QHujH/W4QEY8O3PzxvkbccLTvBBYoCH7dREsR8No7wsIxNJN4/sG/rNKjmX+KeO02rJS6jMp5kScMZw7l9tqqgXp65AUGlGIDbMckQIW47XfprJAAgglq2QWuEDk8S4S4lKSRilo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387475; 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=R4GL64pN6fgcArizW0/7XTLoD2qsTEoytqZferYG/WY=; b=PPpzb7INmDMMwS21M9EU+CXOms69S73fOBzjlCgG1K71LjyCZGBlXDDF4xDXASSFdZAj3RBDIllV6GYZbV27fHEZuQc6qIuFBrigXzQsPR73cPw1lMC/P8NporjZIzU6lu0uKmDwpu92dssrqNQFo0XIoK7ifhbTuxAv60c5IcA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387475522101.45751933735107; Wed, 2 Sep 2026 15:17:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFu-0000v2-GX; Wed, 02 Sep 2026 18:16:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFt-0000u5-0B for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:29 -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 1x1tFq-0002NZ-FK for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:28 -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 202EE21CCB; Wed, 2 Sep 2026 22:16:17 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DCD7313736; Wed, 2 Sep 2026 22:16:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ACrxKi+gmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387381; 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=R4GL64pN6fgcArizW0/7XTLoD2qsTEoytqZferYG/WY=; b=PWUjzXAV1TuGR51jTdjE1I3IQxhg1FudY3pIfSb90kvuyD1WQbHYqLkFuuRXUxoblKt00D UqhcgfFeuPs8a8bYhT0TDlZl4KWgmDM6zSd5T4qVxHLwMrlw/MwJyCzNkIpx34tkGl0m9D ZO1bHMDCeI+ikTp2q3ABWpnZheDskz0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387381; 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=R4GL64pN6fgcArizW0/7XTLoD2qsTEoytqZferYG/WY=; b=oRxp8u8AAZBx205SNK/temM/aK/ya3vbUoa7Y+PmcCQa3OtYNzPx3kc3ZbY+wUotW8KeRN 4+7OgyvYxOLw16Cg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=P6l3hyYH; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=NJDiahZ5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387377; 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=R4GL64pN6fgcArizW0/7XTLoD2qsTEoytqZferYG/WY=; b=P6l3hyYHpc+dwbDnzvpcna31csqMK5psk9f8ZIBjkOOQ1FVOzoamtpsBln/MrzXwWYm0BR J3TJZRdZH07rj2yVXNKK17bz3a8d36bCDJVR+SrFhEpplIYLLva8eMo13lxRRROYLgF3Xj WJJCgLvTNStw6+EFUeQjYCU3JCkz0U8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387377; 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=R4GL64pN6fgcArizW0/7XTLoD2qsTEoytqZferYG/WY=; b=NJDiahZ5noWN6YxjjQx4RoeJo4A067CCVSn1Ea/oTsaK7wy78TM3opRUWu5kxatLpe/57m Ekg76Aeym/RlMLAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH 09/18] tests/qtest/migration: Add a test for HMP Date: Wed, 2 Sep 2026 19:15:37 -0300 Message-ID: <20260902221547.1812481-10-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 202EE21CCB X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 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)[]; 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)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] 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=lists1p.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: qemu development 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: 1788387477168154100 Content-Type: text/plain; charset="utf-8" The following patches will change how parameters are set and shown in HMP, including readline completion so add two minimal tests. - set/info migrate_parameters The test uses qtest facilities to issue HMP migrate_set_parameters for each of the existing migration parameters and queries them back with the info command. A list is kept with the expected strings. A substring match function inspired by glib's g_str_match_string is implemented for this test so the test can produce a decent error output instead of just assert failure. E.g: # HMP output mismatch for entry at line 55: # expected vs. found: # # max-bandwidth: 10356305952768 bytes/hour # --- # max-bandwidth: 10356305952768 bytes/second (note that line 55 above is the source line where the test case for max-bandwith is) - readline completion The test puts the monitor on a chardev via socket and bypasses qtest facilities because it needs to emit raw codes to readline. It therefore requires a couple of new helpers to read/write to the monitor socket. Usage: QTEST_QEMU_BINARY=3D./qemu-system-x86_64 \ ./tests/qtest/migration-test --full -p /x86_64/migration/hmp Signed-off-by: Fabiano Rosas Acked-by: Peter Xu --- tests/qtest/migration/misc-tests.c | 319 +++++++++++++++++++++++++++++ 1 file changed, 319 insertions(+) diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 4e0deb7f188..3554900b758 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -11,6 +11,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/sockets.h" #include "qapi/error.h" #include "qobject/qjson.h" #include "libqtest.h" @@ -21,6 +22,320 @@ #define ANALYZE_SCRIPT "scripts/analyze-migration.py" =20 static char *tmpfs; +static int test_case_line; + +#define TEST(i1, i2, e) { i1, i2, e , .line =3D __LINE__, } +#define SKIP(i1, i2, e) { i1, i2, e , .skip =3D true, } +#define BG_SNAP_MSG ("Error: Background-snapshot is not compatible with " \ + "currently set capabilities") + +typedef struct HMPTestData { + const char *input1; + const char *input2; + const char *output1; + bool skip; + int line; +} HMPTestData; + +/* + * .input1: string to be used as parameter name + * .input2: string to be used as parameter value + * .output1: expected output of migrate_set_parameters + * E.g: + * (qemu) migrate_set_parameters .input1 .input2 + * .output1 + */ +HMPTestData test_cases[] =3D { + TEST("", "", "migrate_set_parameter: string expected"), + TEST("foo", "", "migrate_set_parameter: string expected"), + TEST("foo", "on", "Error: invalid parameter value: foo"), + + /* bool */ + TEST("cpu-throttle-tailslow", "on", "on"), + TEST("direct-io", "on", "on"), + + /* uint64_t */ + TEST("announce-initial", "60", "60 ms"), + TEST("announce-max", "600", "600 ms"), + TEST("announce-rounds", "6", "6"), + TEST("announce-step", "15", "15 ms"), + TEST("downtime-limit", "400", "400 ms"), + TEST("avail-switchover-bandwidth", "2097152", "2199023255552 bytes/sec= ond"), + TEST("max-bandwidth", "9876543", "10356305952768 bytes/second"), + TEST("max-postcopy-bandwidth", "1048576", "1048576 bytes/second"), + TEST("vcpu-dirty-limit", "20", "20 MB/s"), + TEST("x-rdma-chunk-size", "1048576", "1048576 bytes"), + TEST("x-vcpu-dirty-limit-period", "750", "750 ms"), + TEST("xbzrle-cache-size", "67108864", "67108864 bytes"), + + /* uint32_t */ + TEST("x-checkpoint-delay", "5000", "5000 ms"), + + /* uint8_t */ + TEST("cpu-throttle-increment", "15", "15"), + TEST("cpu-throttle-initial", "25", "25"), + TEST("max-cpu-throttle", "85", "85"), + TEST("multifd-channels", "8", "8"), + TEST("throttle-trigger-threshold", "65", "65"), + + /* complex types */ + TEST("mode", "cpr-exec", "cpr-exec"), + TEST("multifd-compression", "zlib", "zlib"), + TEST("zero-page-detection", "none", "none"), + TEST("tls-authz", "my_authz", "'my_authz'"), + TEST("tls-creds", "null", "'null'"), + TEST("tls-hostname", "localhost", "'localhost'"), + TEST("cpr-exec-command", "/bin/true foobar", "/bin/true foobar"), + + /* can be set but are currently missing in the query output */ + SKIP("multifd-qatzip-level", "5", "5"), + SKIP("multifd-zlib-level", "4", "4"), + SKIP("multifd-zstd-level", "6", "6"), + + /* cannot be set */ + TEST("block-bitmap-mapping", "[]", + "Error: The block-bitmap-mapping parameter " + "can only be set through QMP"), +}; + +/* + * .input1: partial string with an ending TAB (as if pressed by + * the user). + * .input2: common root of the completions, i.e. what the partial + * part of .input1 string completes to. + * .expected: full list of completion suggestions for the string + * in .input2. + * E.g: + * (qemu) .input1 + * + * (qemu) .input2 + * .output1 + */ +HMPTestData completion_cases[] =3D { + TEST("migra\t", + "migrate", + "migrate migrate_cancel migrate_continue migrate_incoming " + "migrate_pause migrate_recover migrate_set_capability " + "migrate_set_parameter migrate_start_postcopy"), + + /* + * Note QEMU doesn't keep 'info' when offering the completions + * suggestions. + */ + TEST("info migra\t", + "migrate", + "migrate migrate_capabilities migrate_parameters"), +}; + +/* + * Find a contiguous run of tokens in @larger that match the sequence + * of tokens in @smaller. If @strip_empty, ignore mismatches due to + * sequences of empty tokens. + * + * Returns whether a match was found. + * Updates the indices: + * @last_match: which token in @larger last matched a token in + * @smaller + * @last_tried: which token in @smaller was last compared with a + * token in @larger + */ +static bool token_list_is_substr(char **smaller, char **larger, + int *last_match, int *last_tried, + bool skip_empty) +{ + int i, j, k =3D 0; + bool match =3D true; + + for (i =3D 0; smaller[i]; i++) { + for (j =3D k; larger[j]; j++) { + + if (!*larger[j] && skip_empty) { + continue; + } + + if (!g_str_has_prefix(larger[j], smaller[i])) { + continue; + } + + match =3D true; + k =3D j; + goto next; + } + + match =3D false; + break; + next: + ; + } + + *last_match =3D k; + *last_tried =3D i; + + return match; +} + +static void assert_hmp_match(const char *str, const char *text, bool per_l= ine) +{ + const char *delim =3D per_line ? ":\n" : " \r\n"; + g_auto(GStrv) t1 =3D g_strsplit_set(str, delim, -1); + g_auto(GStrv) t2 =3D g_strsplit_set(text, delim, -1); + int match, mismatch; + + if (token_list_is_substr(t1, t2, &match, &mismatch, !per_line)) { + return; + } + + g_test_message("HMP output mismatch for entry at line %d:", test_case_= line); + + if (per_line) { + if (mismatch =3D=3D 0) { + g_test_message("'%s' not present in output", t1[mismatch]); + } else { + g_test_message("expected vs. found:\n\n%s\n---\n%s:%s", str, + t2[match], t2[match + 1]); + /* + * + 1 above is safe because HMP output has an ending newline + * and the glib array ends on two NULL slots. + */ + } + } else { + g_test_message("expected vs. found (whitespace ignored):" + "\n---\n%s\n---\n%s\n---", str, g_strjoinv(" ", t2)= ); + } + g_assert_not_reached(); +} + +static void assert_hmp_success(const char *str) +{ + if (!g_str_equal(str, "")) { + g_test_message("HMP command failed:\n\n%s", str); + g_assert_not_reached(); + } +} + +static void test_hmp_migration_parameters(char *name, MigrateCommon *args) +{ + QTestState *qts; + + /* force TCG so it can run in all targets */ + qts =3D qtest_init("-accel tcg -nodefaults -S"); + + for (int i =3D 0; i < G_N_ELEMENTS(test_cases); i++) { + g_autofree char *resp =3D NULL; + g_autofree char *line =3D NULL; + struct HMPTestData *t =3D &test_cases[i]; + + if (t->skip) { + continue; + } + + test_case_line =3D t->line; + + resp =3D qtest_hmp(qts, "migrate_set_parameter %s %s", t->input1, + t->input2); + + if (g_str_has_prefix(t->output1, "Error:") || + g_str_has_prefix(resp, "migrate_set_parameter:")) { + + assert_hmp_match(t->output1, resp, true); + continue; + } + assert_hmp_success(resp); + g_free(resp); + + resp =3D qtest_hmp(qts, "info migrate_parameters"); + + line =3D g_strconcat(t->input1, ": ", t->output1, NULL); + assert_hmp_match(line, resp, true); + } + + qtest_quit(qts); +} + +static void hmp_sock_write(int fd, const char *buf) +{ + size_t sz =3D strlen(buf); + + assert(fd > 0); + assert(write(fd, buf, sz) =3D=3D sz); +} + +static void hmp_sock_read(int fd, char *buf, size_t buf_sz) +{ + char *p =3D buf; + size_t sz =3D buf_sz - 1; + + assert(fd >=3D 0); + memset(buf, 0, buf_sz); + + while (sz > 0) { + ssize_t r =3D read(fd, p, sz); + char *prompt; + + if (!r) { + break; + } else if (r < 0) { + if (errno =3D=3D EINTR) { + continue; + } + g_assert_not_reached(); + } + + p +=3D r; + sz -=3D r; + + prompt =3D strstr(buf, "(qemu) "); + if (prompt) { + *prompt =3D '\0'; + break; + } + } +} + +static void test_hmp_completion(char *name, MigrateCommon *args) +{ + g_autofree char *cmdline; + QTestState *qts; + char buf[1024]; + int sockfds[2]; + + assert(!qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)); + qemu_clear_cloexec(sockfds[1]); + + cmdline =3D g_strdup_printf("-chardev socket,id=3Dmon0,fd=3D%d " + "-mon chardev=3Dmon0,mode=3Dreadline -S", + sockfds[1]); + qts =3D qtest_init(cmdline); + close(sockfds[1]); + + /* read HMP banner */ + hmp_sock_read(sockfds[0], buf, sizeof(buf)); + + for (int i =3D 0; i < G_N_ELEMENTS(completion_cases); i++) { + const struct HMPTestData *t =3D &completion_cases[i]; + char *output; + + hmp_sock_write(sockfds[0], t->input1); + hmp_sock_read(sockfds[0], buf, sizeof(buf)); + + /* + * readline first rewrites the input to the common root of the + * completions, then outputs the completion suggestions: + * + * (qemu) info migr + * (qemu) migrate migrate_parameters + * migrate_capabilities ... + */ + output =3D strstr(buf, t->input2); + assert_hmp_match(t->output1, output, false); + + /* ^U backward kill line */ + hmp_sock_write(sockfds[0], "\x15"); + } + + close(sockfds[0]); + qtest_quit(qts); +} =20 static void test_baddest(char *name, MigrateCommon *args) { @@ -260,4 +575,8 @@ void migration_test_add_misc(MigrationTestEnv *env) test_validate_uri_channels_both_set); migration_test_add("/migration/validate_uri/channels/none_set", test_validate_uri_channels_none_set); + migration_test_add("/migration/hmp/parameters", + test_hmp_migration_parameters); + migration_test_add("/migration/hmp/completion", + test_hmp_completion); } --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387458; cv=none; d=zohomail.com; s=zohoarc; b=B+wRU+Ks+7xq/k/uemLuojf+pwxK5DWvJIa1AIsMaP0HgGSVUYjAr6MH88u8TvKSVCBp+eU1zNGlnMda5TmFLIjDdMcQe7FTaNAXwUR64V37h8kx0otjYYt73AL28DaYW9GLVKiNV6/QipSinRA2GCDK5VMgVtqHL1GIY1ySeE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387458; 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=p0pVrT4YFXzQmFQwbGKMWn4S5JMORyy3+9+74k8tjWk=; b=lyeZF7JORh7Olz86ItDpdholePcX/FSdaTcEKmkbNBGiFj4lXR0fm+y5Kw97bDXc3nqNnPKcZPfoLeCdgA684rDPJPECi6lNnryGgJEwU596du9NbbvZ1r3VtfjbHW67I73fmxG0CghfHi/4RptCObLy5z8/ihTkLRJXZIrkPC0= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387458229648.9967234414535; Wed, 2 Sep 2026 15:17:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFv-0000vb-RN; Wed, 02 Sep 2026 18:16:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFu-0000v0-EE for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:30 -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 1x1tFr-0002Nt-Mf for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16: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-out2.suse.de (Postfix) with ESMTPS id 454B31F8B0; Wed, 2 Sep 2026 22:16:18 +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 681BF13738; Wed, 2 Sep 2026 22:16:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wL9sDjGgmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387382; 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=p0pVrT4YFXzQmFQwbGKMWn4S5JMORyy3+9+74k8tjWk=; b=ijxNbEbtAUL54ofHjx1wvCjR/95I9RCGw5eLleZ0r7a8huHnICGCW2RjQ8cL4skmlygunm c6b1n0eLn43FRmxTNfcZnKR4eOA//K9gec1Rff0IrufkAVVD7bM5I4Oo+IcJxp+LaV7wfb LpK4eITYBRhNrXiEmjCYaR++zWY+4P8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387382; 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=p0pVrT4YFXzQmFQwbGKMWn4S5JMORyy3+9+74k8tjWk=; b=kUwK2l2DbmJyhdNZfen0+t26shbqjGmCTeZqB918yEgMTYvOb1NadMTiHCTrBaOsuJnf/c Qbjprg7okD3wExAw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=dzT7Dz8C; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=VxhKYfo3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387378; 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=p0pVrT4YFXzQmFQwbGKMWn4S5JMORyy3+9+74k8tjWk=; b=dzT7Dz8CmdZdHbk2nVVWtAvPnyxOzU8AlLOF/LNbuxkdf728iuUoRi6jPzNm1YnEXj0jJJ fEMaxaioa/6dE79OqyaT9aZ+J1pXx/g3lBB9GZHukWS2D0sdKF/tSWw/UxPv+w/G9wG0tk meEX4CRWgFh1st8xabjlgtm0eXyH1Bg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387378; 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=p0pVrT4YFXzQmFQwbGKMWn4S5JMORyy3+9+74k8tjWk=; b=VxhKYfo3ureXUriyaawD28IHTNOtpQidNCnJ0MnCMu0anc8Y7XI8A6WV7hOEEra3NIoGmK HggQfiwWmGe+lNAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PATCH 10/18] migration: Validate that all params are set for query Date: Wed, 2 Sep 2026 19:15:38 -0300 Message-ID: <20260902221547.1812481-11-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 454B31F8B0 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_DN_SOME(0.00)[]; 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]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; 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=lists1p.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: -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: qemu development 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: 1788387460178158501 Content-Type: text/plain; charset="utf-8" There are a couple of situations where all fields of a MigrationParameters object need to be marked as present: when cloning an entire object and when creating the transient object in qmp_query_migrate(). The query-migrate-parameters QMP command contract requires that all parameters, except block-bitmap-mapping, are present in the output. Validate that a given object has all has_* fields set to true. Signed-off-by: Fabiano Rosas --- migration/options.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/migration/options.c b/migration/options.c index bd7be8f9832..5d17acdd881 100644 --- a/migration/options.c +++ b/migration/options.c @@ -12,6 +12,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/units.h" #include "exec/target_page.h" @@ -23,8 +24,10 @@ #include "qapi/qmp/qerror.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" +#include "qobject/qbool.h" #include "qobject/qdict.h" #include "qobject/qnull.h" +#include "qobject/qstring.h" #include "system/runstate.h" #include "migration/colo.h" #include "migration/cpr.h" @@ -1149,12 +1152,63 @@ static void migrate_mark_all_params_present(Migrati= onParameters *p) } } =20 +static bool assert_all_params_present(MigrationParameters *params, Error *= *errp) +{ + g_autoptr(QDict) d =3D migrate_params_to_dict(params, errp); + const QDictEntry *e =3D NULL; + int i =3D 0; + + if (!d) { + return false; + } + + for (e =3D qdict_first(d); e; e =3D qdict_next(d, e), i++) { + const char *key =3D qdict_entry_key(e); + const char *p; + + if (strstart(key, "tls-", &p)) { + QString *s =3D qobject_to(QString, qdict_entry_value(e)); + + if (!s) { + break; + } + } else if (strstart(key, "has-", &p)) { + if (qdict_haskey(d, p)) { + QBool *b =3D qobject_to(QBool, qdict_entry_value(e)); + + if (!b || !qbool_get_bool(b)) { + break; + } + } + } + } + + if (i && !e) { + return true; + } + + /* + * Should never happen, but avoid asserting becase this is + * reachable from QMP. + */ + error_setg(errp, "Missing parameter. Query output will be incomplete."= ); + return false; +} + MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationState *s =3D migrate_get_current(); MigrationParameters *params =3D QAPI_CLONE(MigrationParameters, &s->parameters); =20 + /* + * Validate all parameters have their has_* field set to true as + * consequence of the initial migrate_mark_all_params_present(). + */ + if (!assert_all_params_present(params, errp)) { + return NULL; + } + /* * The block-bitmap-mapping breaks the expected API of * query-migrate-parameters of having all members present. To keep --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387504; cv=none; d=zohomail.com; s=zohoarc; b=AwKH3C4yHbY+YX9Jf/ImSz0DKt4dkjyTKwZJjFpwPWJUV+kDKYdi2KZrP4WlBj5oc3/wYmBdYp5Xh/t+Eo1pz0LU4H97U7JMU27YYUQWZ4XFs1BMT6xbmlfDwzO8WDwCt9lPYcl/iuvyMpm1sZoTKs96Lcn4TON/ID3Um3/dQFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387504; 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=gcoUpKgYIlBLsctoD0QWUa07MN/yO31xDC/RQk74F60=; b=AzbLZb+iPkanJvfSyS6WBazkp/P3VgvPDTmKUyWdHCZ5+R9WgkCkGO+udK8dlMS/GVFKhlKvW3IymKy9amHer7vTNkgh6/Kkp77cLIdg1lmyDIPc/c5sXRaZLc3pJR6mPfcJ/2Q1V2hh6j894VNhAIL1sDGoL7G+eQQZj1MY02U= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387504803978.0672618766679; Wed, 2 Sep 2026 15:18:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFx-0000vy-23; Wed, 02 Sep 2026 18:16:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFv-0000va-PP for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:31 -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 1x1tFt-0002O5-Af for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16: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 C5C5A21CCC; Wed, 2 Sep 2026 22:16:19 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9024913869; Wed, 2 Sep 2026 22:16: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 EBguGDKgmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387383; 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=gcoUpKgYIlBLsctoD0QWUa07MN/yO31xDC/RQk74F60=; b=rKl/i4TM5BmKhG9EXOoIVP6U4x8k4L7TcQzkZY99g0GpUeKx+OGqSdppl2isyga5fUbvgq FdLLiOb+BU+ot3m8DEershdovS04WFEcITmcOGyl8zaJXZDcbcu6JQOj1nlK/rRkRz2b0G IbSxRV4T/2P2/Ub5lC9yJXOSC09Ym+E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387383; 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=gcoUpKgYIlBLsctoD0QWUa07MN/yO31xDC/RQk74F60=; b=rhmTqw5m5hJnpODzYXdlysbaNZ4JlwiBHXzxek7SzZwWjNpoCbiQyOZG+WyQB6Eqj7ktBR f1mrbHJw1CNQG3Cg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387379; 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=gcoUpKgYIlBLsctoD0QWUa07MN/yO31xDC/RQk74F60=; b=HlFla339vP4h9/u9SM8+sWKOq/FiOthLmXgfbCRU6m6wNQO2RwocYnvnY3kl6v8YPFz67x mrBkTD6QvzRA2aa4y4C9SGO4m/ntXr3rJPujtVldJTRavX4hVJKfnZ8qvOxVqBIKlP75tw in1JJS8+JocGODgFOGwuRU8v2zCuvXU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387379; 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=gcoUpKgYIlBLsctoD0QWUa07MN/yO31xDC/RQk74F60=; b=z0GqMwhyRHhRBSyUEOeH1pf2Dpq9L/q+w5UBwV8nafNmJ3Bdg1pnCaJ2P+82YUUckhP2hv A/S6BqGFzWwNi6DQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH 11/18] migration: Use keyval input visitor in HMP set command Date: Wed, 2 Sep 2026 19:15:39 -0300 Message-ID: <20260902221547.1812481-12-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; 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]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_COUNT_TWO(0.00)[2]; 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387506437158500 Content-Type: text/plain; charset="utf-8" Change the hmp_migrate_set_parameter command to use a keyval input visitor. Currently a string visitor is used and due to limitations of that particular visitor's implementation it's necessary to consult the QAPI type enum (MigrationParameter_lookup) and call each visit_type_* function individually. Which makes using a visitor pointless. Since there are other visitors implemented properly and generated code to iterate the QAPI object, prefer using one of those. The keyval input visitor is adequate because HMP provides basically one key and one value for each migrate_set_parameter command. To switch from string_input_visitor to keyval_input_visitor simply put the parameter name and value into a dict and invoke visit_type_MigrationParameters(). Note that it's not necessary to go through any of the keyval_* code because due to the nature of HMP, there's no parsing to do (no '=3D', no ',', etc). With this the migrate_set_parameters HMP commands will be automatically updated anytime a new migration parameter is added. The bad part: Some parameters accept a non-standard data format, I moved them to a "legacy" suffixed function in this patch as there's only 3 of them: - "max-bandwidth" and "avail-switchover-bandwidth" take MiB instead of B for a size parameter; - "cpr-exec-command" takes the strList type which needs to be built manually. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 203 +++++++++-------------------- tests/qtest/migration/misc-tests.c | 2 +- 2 files changed, 59 insertions(+), 146 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index ad68fa23aa4..220ac28b5e3 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -24,7 +24,9 @@ #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" +#include "qapi/qobject-input-visitor.h" #include "qobject/qdict.h" +#include "qobject/qstring.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" #include "qemu/cutils.h" @@ -589,59 +591,16 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) +static void hmp_migrate_set_parameter_legacy(Monitor *mon, const QDict *qd= ict) { 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); MigrationParameters *p =3D g_new0(MigrationParameters, 1); uint64_t valuebw =3D 0; - uint64_t cache_size; Error *err =3D NULL; - int val, ret; + int ret; =20 - val =3D qapi_enum_parse(&MigrationParameter_lookup, param, -1, &err); - if (val < 0) { - goto cleanup; - } - - switch (val) { - case MIGRATION_PARAMETER_THROTTLE_TRIGGER_THRESHOLD: - p->has_throttle_trigger_threshold =3D true; - visit_type_uint8(v, param, &p->throttle_trigger_threshold, &err); - break; - case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL: - p->has_cpu_throttle_initial =3D true; - visit_type_uint8(v, param, &p->cpu_throttle_initial, &err); - break; - case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT: - p->has_cpu_throttle_increment =3D true; - visit_type_uint8(v, param, &p->cpu_throttle_increment, &err); - break; - case MIGRATION_PARAMETER_CPU_THROTTLE_TAILSLOW: - p->has_cpu_throttle_tailslow =3D true; - visit_type_bool(v, param, &p->cpu_throttle_tailslow, &err); - break; - case MIGRATION_PARAMETER_MAX_CPU_THROTTLE: - p->has_max_cpu_throttle =3D true; - visit_type_uint8(v, param, &p->max_cpu_throttle, &err); - break; - case MIGRATION_PARAMETER_TLS_CREDS: - p->tls_creds =3D g_new0(StrOrNull, 1); - p->tls_creds->type =3D QTYPE_QSTRING; - visit_type_str(v, param, &p->tls_creds->u.s, &err); - break; - case MIGRATION_PARAMETER_TLS_HOSTNAME: - p->tls_hostname =3D g_new0(StrOrNull, 1); - p->tls_hostname->type =3D QTYPE_QSTRING; - visit_type_str(v, param, &p->tls_hostname->u.s, &err); - break; - case MIGRATION_PARAMETER_TLS_AUTHZ: - p->tls_authz =3D g_new0(StrOrNull, 1); - p->tls_authz->type =3D QTYPE_QSTRING; - visit_type_str(v, param, &p->tls_authz->u.s, &err); - break; - case MIGRATION_PARAMETER_MAX_BANDWIDTH: + if (g_str_equal(param, "max-bandwidth")) { p->has_max_bandwidth =3D true; /* * Can't use visit_type_size() here, because it @@ -651,109 +610,21 @@ void hmp_migrate_set_parameter(Monitor *mon, const Q= Dict *qdict) if (ret < 0 || valuebw > INT64_MAX || (size_t)valuebw !=3D valuebw) { error_setg(&err, "Invalid size %s", valuestr); - break; + return; } p->max_bandwidth =3D valuebw; - break; - case MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BANDWIDTH: + + } else if (g_str_equal(param, "avail-switchover-bandwidth")) { p->has_avail_switchover_bandwidth =3D true; ret =3D qemu_strtosz_MiB(valuestr, NULL, &valuebw); if (ret < 0 || valuebw > INT64_MAX || (size_t)valuebw !=3D valuebw) { error_setg(&err, "Invalid size %s", valuestr); - break; + return; } p->avail_switchover_bandwidth =3D valuebw; - break; - case MIGRATION_PARAMETER_DOWNTIME_LIMIT: - p->has_downtime_limit =3D true; - visit_type_size(v, param, &p->downtime_limit, &err); - break; - case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY: - p->has_x_checkpoint_delay =3D true; - visit_type_uint32(v, param, &p->x_checkpoint_delay, &err); - break; - case MIGRATION_PARAMETER_MULTIFD_CHANNELS: - p->has_multifd_channels =3D true; - visit_type_uint8(v, param, &p->multifd_channels, &err); - break; - case MIGRATION_PARAMETER_MULTIFD_COMPRESSION: - p->has_multifd_compression =3D true; - visit_type_MultiFDCompression(v, param, &p->multifd_compression, - &err); - break; - case MIGRATION_PARAMETER_MULTIFD_ZLIB_LEVEL: - p->has_multifd_zlib_level =3D true; - visit_type_uint8(v, param, &p->multifd_zlib_level, &err); - break; - case MIGRATION_PARAMETER_MULTIFD_QATZIP_LEVEL: - p->has_multifd_qatzip_level =3D true; - visit_type_uint8(v, param, &p->multifd_qatzip_level, &err); - break; - case MIGRATION_PARAMETER_MULTIFD_ZSTD_LEVEL: - p->has_multifd_zstd_level =3D true; - visit_type_uint8(v, param, &p->multifd_zstd_level, &err); - break; - case MIGRATION_PARAMETER_ZERO_PAGE_DETECTION: - p->has_zero_page_detection =3D true; - visit_type_ZeroPageDetection(v, param, &p->zero_page_detection, &e= rr); - break; - case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE: - p->has_xbzrle_cache_size =3D true; - if (!visit_type_size(v, param, &cache_size, &err)) { - break; - } - if (cache_size > INT64_MAX || (size_t)cache_size !=3D cache_size) { - error_setg(&err, "Invalid size %s", valuestr); - break; - } - p->xbzrle_cache_size =3D cache_size; - break; - case MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWIDTH: - p->has_max_postcopy_bandwidth =3D true; - visit_type_size(v, param, &p->max_postcopy_bandwidth, &err); - break; - case MIGRATION_PARAMETER_ANNOUNCE_INITIAL: - p->has_announce_initial =3D true; - visit_type_size(v, param, &p->announce_initial, &err); - break; - case MIGRATION_PARAMETER_ANNOUNCE_MAX: - p->has_announce_max =3D true; - visit_type_size(v, param, &p->announce_max, &err); - break; - case MIGRATION_PARAMETER_ANNOUNCE_ROUNDS: - p->has_announce_rounds =3D true; - visit_type_size(v, param, &p->announce_rounds, &err); - break; - case MIGRATION_PARAMETER_ANNOUNCE_STEP: - p->has_announce_step =3D true; - visit_type_size(v, param, &p->announce_step, &err); - break; - case MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING: - error_setg(&err, "The block-bitmap-mapping parameter can only be s= et " - "through QMP"); - break; - case MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERIOD: - p->has_x_vcpu_dirty_limit_period =3D true; - visit_type_size(v, param, &p->x_vcpu_dirty_limit_period, &err); - break; - case MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT: - p->has_vcpu_dirty_limit =3D true; - visit_type_size(v, param, &p->vcpu_dirty_limit, &err); - break; - case MIGRATION_PARAMETER_MODE: - p->has_mode =3D true; - visit_type_MigMode(v, param, &p->mode, &err); - break; - case MIGRATION_PARAMETER_DIRECT_IO: - p->has_direct_io =3D true; - visit_type_bool(v, param, &p->direct_io, &err); - break; - case MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE: - p->has_x_rdma_chunk_size =3D true; - visit_type_size(v, param, &p->x_rdma_chunk_size, &err); - break; - case MIGRATION_PARAMETER_CPR_EXEC_COMMAND: { + + } else if (g_str_equal(param, "cpr-exec-command")) { /* * NOTE: g_autofree will only auto g_free() the strv array when * needed, it will not free the strings within the array. It's @@ -766,15 +637,14 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) =20 if (!g_shell_parse_argv(valuestr, NULL, &strv, &gerr)) { error_setg(&err, "%s", gerr->message); - break; + return; } for (int i =3D 0; strv[i]; i++) { QAPI_LIST_APPEND(tail, strv[i]); } p->has_cpr_exec_command =3D true; - break; - } - default: + + } else { g_assert_not_reached(); } =20 @@ -784,12 +654,55 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) =20 qmp_migrate_set_parameters(p, &err); =20 - cleanup: +cleanup: qapi_free_MigrationParameters(p); + hmp_handle_error(mon, err); +} + +static void hmp_migrate_set_parameter_qapi(Monitor *mon, const QDict *qdic= t) +{ + const char *param =3D qdict_get_str(qdict, "parameter"); + const char *valuestr =3D qdict_get_str(qdict, "value"); + g_autoptr(QDict) input =3D qdict_new(); + g_autoptr(MigrationParameters) p =3D NULL; + Visitor *v; + Error *err =3D NULL; + + /* the same as keyval_parse(), but here there's no need to parse */ + qdict_put_obj(input, param, QOBJECT(qstring_from_str(valuestr))); + + v =3D qobject_input_visitor_new_keyval(QOBJECT(input)); + if (visit_type_MigrationParameters(v, NULL, &p, &err)) { + qmp_migrate_set_parameters(p, &err); + } + visit_free(v); hmp_handle_error(mon, err); } =20 +void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) +{ + const char *param =3D qdict_get_str(qdict, "parameter"); + + if (g_str_equal(param, "block-bitmap-mapping")) { + Error *err =3D NULL; + + error_setg(&err, "The %s parameter can only be set through QMP", p= aram); + hmp_handle_error(mon, err); + return; + } + + /* these have non-standard setters */ + if (g_str_equal(param, "max-bandwidth") || + g_str_equal(param, "avail-switchover-bandwidth") || + g_str_equal(param, "cpr-exec-command")) { + + return hmp_migrate_set_parameter_legacy(mon, qdict); + } + + hmp_migrate_set_parameter_qapi(mon, qdict); +} + void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 3554900b758..ba8183978b3 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -48,7 +48,7 @@ typedef struct HMPTestData { HMPTestData test_cases[] =3D { TEST("", "", "migrate_set_parameter: string expected"), TEST("foo", "", "migrate_set_parameter: string expected"), - TEST("foo", "on", "Error: invalid parameter value: foo"), + TEST("foo", "on", "Error: Parameter 'foo' is unexpected"), =20 /* bool */ TEST("cpu-throttle-tailslow", "on", "on"), --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387482; cv=none; d=zohomail.com; s=zohoarc; b=Nnsa6gFUJcmZYWsjQVNlTxi1UfYY890pgJeca9FA6ceY4Mflx2RFYAcDTpSq+6AxUcW0M2hljxxmGRo6Kx82jt8j1O54lOHfOegxeDARzpNYbhGfQ6EGkheV5zOBbNo5CETSRO6HSfrmwY9ULBkf+dTqeZ0lHOYtwIFCtf/6Alw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387482; 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=pH3MKb5YzB+rnU9zEsOyvTRfO2RczCCPz4ovZI8ofyM=; b=Y0L6vjukNedFjUJ6cqG2O3EkNiDiiziFteYswW49ZOgbd9hxxj9jYrk3/6hd1m/nHvUm1gA/fcMOW8hdkIM6QXIr5B1qdwtZeyKPjRzI03xYrDiinvq+XqeaW4O6FUwOxz+zx03Tvk8m8izcro4ydOXoQEGZkqse3AnnE80vyAQ= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387482106390.9618560205961; Wed, 2 Sep 2026 15:18:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tFy-0000wN-IC; Wed, 02 Sep 2026 18:16:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFx-0000wD-RW for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:33 -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 1x1tFv-0002OX-A0 for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:33 -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 D4C491F8B4; Wed, 2 Sep 2026 22:16:21 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1F98613874; Wed, 2 Sep 2026 22:16:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ABBOODOgmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387386; 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=pH3MKb5YzB+rnU9zEsOyvTRfO2RczCCPz4ovZI8ofyM=; b=eKIdj8wWbISTgg1Atl3B2A75nlqDT7PXLE0FhjE4OGHD4otdKHJ/tr1jjo+fBweDGvjqrM 0kUfDUTeS13WOnzpD65WgGBKfI4gaXtSj6t+o/eg5fGpOkGXNyQ3sB74sSJHTXDSMyhg1N pDzud7wH6lsWpDJDVP5nJ5XJVhwbYas= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387386; 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=pH3MKb5YzB+rnU9zEsOyvTRfO2RczCCPz4ovZI8ofyM=; b=MF4XtYPrTVWUVDcmkPsHT+5p4+mBXAG/PxN4Ld2oBxkOSY8MTy0S5m8pRv2P8ELNFEuWvz U4ACcH4vYUERCgCA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387381; 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=pH3MKb5YzB+rnU9zEsOyvTRfO2RczCCPz4ovZI8ofyM=; b=AG1Qg0aFTJNThmw0y4HPJTnIJ+jAYySY3T3WDNws/JVg6IDKVPJgpjf18DyKA3R1rsdvNR yfZEb8KQ9oA7UJr/n8+QqlruCY5rYW4q2FtHHxg9HUL3V4eVMfZ7RIBPpnkHH32lAuk40G if/cXEXfAmn3+kJV+0ib/WA/TV7s2VE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387381; 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=pH3MKb5YzB+rnU9zEsOyvTRfO2RczCCPz4ovZI8ofyM=; b=a29u1p1BP37NfRxXVPKSQT1T1o/t959+6H1PAfpj4lMjuZTDJN7Ra549Q0LOZaa3AELVLO zVWEPaiYI+bccpAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Kevin Wolf , Hanna Reitz , Laurent Vivier , Paolo Bonzini Subject: [PATCH 12/18] migration: Change HMP 'info migrate_parameters' output Date: Wed, 2 Sep 2026 19:15:40 -0300 Message-ID: <20260902221547.1812481-13-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; 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]; URIBL_BLOCKED(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387485350154100 Content-Type: text/plain; charset="utf-8" The output of 'info migrate_parameters' includes units of measurement for a few parameters. This is convenient for a user. It also requires every parameter to be individually listed in the hmp_migrate_set_parameter() function, which in turn requires the MigrationParameter (singular) enum to exist. While the latter is not bothersome at all, the former is. From a development and maintenance perspective, having a list of parameters explicitly written in several parts of the code brings several annoyances: conflicts during rebase, multiple extra hits when grepping, requires contributors to search for every location a change needs to be mirrored to, etc. Remove the units from the output so we can write this code in a more convenient way. The HMP output is not part of any ABI. Also remove quotes from around the TLS options strings as this is inconsistent with all the other strings. Change block-bitmap-mapping format to a single line. This requires updating one of the iotests to match. Signed-off-by: Fabiano Rosas Acked-by: Peter Xu --- migration/migration-hmp-cmds.c | 70 +++++++++++++++++------------- tests/qemu-iotests/300 | 20 ++++++--- tests/qtest/migration/misc-tests.c | 30 ++++++------- 3 files changed, 69 insertions(+), 51 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 220ac28b5e3..089c6d4ff46 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -336,16 +336,16 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) params =3D qmp_query_migrate_parameters(NULL); =20 if (params) { - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_INITIAL), params->announce_initial); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_printf(mon, "%s: %" PRIu64 "\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", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_STEP), params->announce_step); assert(params->has_throttle_trigger_threshold); @@ -369,35 +369,35 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_MAX_CPU_THROTTLE), params->max_cpu_throttle); assert(params->tls_creds); - monitor_printf(mon, "%s: '%s'\n", + 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", + monitor_printf(mon, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), params->tls_hostname->u.s); assert(params->tls_authz); - monitor_printf(mon, "%s: '%s'\n", + monitor_printf(mon, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), params->tls_authz->u.s); assert(params->has_max_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), params->max_bandwidth); assert(params->has_avail_switchover_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BA= NDWIDTH), params->avail_switchover_bandwidth); assert(params->has_max_postcopy_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), params->max_postcopy_bandwidth); assert(params->has_downtime_limit); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT), params->downtime_limit); assert(params->has_x_checkpoint_delay); - monitor_printf(mon, "%s: %u ms\n", + monitor_printf(mon, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY), params->x_checkpoint_delay); monitor_printf(mon, "%s: %u\n", @@ -411,41 +411,51 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_ZERO_PAGE_DETECTION= ), qapi_enum_lookup(&ZeroPageDetection_lookup, params->zero_page_detection)); - monitor_printf(mon, "%s: %" PRIu64 " bytes\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); =20 if (s->has_block_bitmap_mapping) { - const BitmapMigrationNodeAliasList *bmnal; + BitmapMigrationNodeAliasList *nal; + BitmapMigrationNodeAlias *na; + BitmapMigrationBitmapAliasList *bal; + BitmapMigrationBitmapAlias *ba; + BitmapMigrationBitmapAliasTransform *bat; =20 - monitor_printf(mon, "%s:\n", + monitor_printf(mon, "%s:", MigrationParameter_str( MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); =20 - for (bmnal =3D params->block_bitmap_mapping; - bmnal; - bmnal =3D bmnal->next) + for (nal =3D params->block_bitmap_mapping; nal; nal =3D nal->n= ext) { - const BitmapMigrationNodeAlias *bmna =3D bmnal->value; - const BitmapMigrationBitmapAliasList *bmbal; + na =3D nal->value; + monitor_printf(mon, " bitmaps:"); + for (bal =3D na->bitmaps; bal; bal =3D bal->next) { + ba =3D bal->value; + bat =3D ba->transform; =20 - monitor_printf(mon, " '%s' -> '%s'\n", - bmna->node_name, bmna->alias); - - for (bmbal =3D bmna->bitmaps; bmbal; bmbal =3D bmbal->next= ) { - const BitmapMigrationBitmapAlias *bmba =3D bmbal->valu= e; - - monitor_printf(mon, " '%s' -> '%s'\n", - bmba->name, bmba->alias); + monitor_printf(mon, " name: %s", ba->name); + if (bat && bat->has_persistent) { + if (bat->persistent) { + monitor_printf(mon, " persistent: on"); + } else { + monitor_printf(mon, " persistent: off"); + } + } + monitor_printf(mon, " alias: %s", ba->alias); } + monitor_printf(mon, " node-name: %s alias: %s", + na->node_name, na->alias); } + + monitor_printf(mon, "\n"); } =20 - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), params->x_vcpu_dirty_limit_period); =20 - monitor_printf(mon, "%s: %" PRIu64 " MB/s\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), params->vcpu_dirty_limit); =20 @@ -462,7 +472,7 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) } =20 if (params->has_x_rdma_chunk_size) { - monitor_printf(mon, "%s: %" PRIu64 " bytes\n", + monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str( MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), params->x_rdma_chunk_size); diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 index e46616d7b19..03248f4474b 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -147,8 +147,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): =20 result =3D vm.qmp('human-monitor-command', command_line=3D'info migrate_parameters') - - m =3D re.search(r'^block-bitmap-mapping:\r?(\n .*)*\n', + m =3D re.search(r'^block-bitmap-mapping:(.*)\r\n', result['return'], flags=3Dre.MULTILINE) hmp_mapping =3D m.group(0).replace('\r', '') if m else None =20 @@ -158,15 +157,24 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): =20 @staticmethod def to_hmp_mapping(mapping: BlockBitmapMapping) -> str: - result =3D 'block-bitmap-mapping:\n' + result =3D 'block-bitmap-mapping:' =20 for node in mapping: - result +=3D f" '{node['node-name']}' -> '{node['alias']}'\n" - assert isinstance(node['bitmaps'], list) + result +=3D ' bitmaps:' for bitmap in node['bitmaps']: - result +=3D f" '{bitmap['name']}' -> '{bitmap['alias']}= '\n" + result +=3D f" name: {bitmap['name']}" + if 'transform' in bitmap: + if 'persistent' in bitmap['transform']: + if bitmap['transform']['persistent']: + result +=3D " persistent: on" + else: + result +=3D " persistent: off" + result +=3D f" alias: {bitmap['alias']}" =20 + result +=3D f" node-name: {node['node-name']} alias: {node['al= ias']}" + + result +=3D '\n' return result =20 =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index ba8183978b3..34b376562ff 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -55,21 +55,21 @@ HMPTestData test_cases[] =3D { TEST("direct-io", "on", "on"), =20 /* uint64_t */ - TEST("announce-initial", "60", "60 ms"), - TEST("announce-max", "600", "600 ms"), + TEST("announce-initial", "60", "60"), + TEST("announce-max", "600", "600"), TEST("announce-rounds", "6", "6"), - TEST("announce-step", "15", "15 ms"), - TEST("downtime-limit", "400", "400 ms"), - TEST("avail-switchover-bandwidth", "2097152", "2199023255552 bytes/sec= ond"), - TEST("max-bandwidth", "9876543", "10356305952768 bytes/second"), - TEST("max-postcopy-bandwidth", "1048576", "1048576 bytes/second"), - TEST("vcpu-dirty-limit", "20", "20 MB/s"), - TEST("x-rdma-chunk-size", "1048576", "1048576 bytes"), - TEST("x-vcpu-dirty-limit-period", "750", "750 ms"), - TEST("xbzrle-cache-size", "67108864", "67108864 bytes"), + TEST("announce-step", "15", "15"), + TEST("downtime-limit", "400", "400"), + TEST("avail-switchover-bandwidth", "2097152", "2199023255552"), + TEST("max-bandwidth", "9876543", "10356305952768"), + TEST("max-postcopy-bandwidth", "1048576", "1048576"), + TEST("vcpu-dirty-limit", "20", "20"), + TEST("x-rdma-chunk-size", "1048576", "1048576"), + TEST("x-vcpu-dirty-limit-period", "750", "750"), + TEST("xbzrle-cache-size", "67108864", "67108864"), =20 /* uint32_t */ - TEST("x-checkpoint-delay", "5000", "5000 ms"), + TEST("x-checkpoint-delay", "5000", "5000"), =20 /* uint8_t */ TEST("cpu-throttle-increment", "15", "15"), @@ -82,9 +82,9 @@ HMPTestData test_cases[] =3D { TEST("mode", "cpr-exec", "cpr-exec"), TEST("multifd-compression", "zlib", "zlib"), TEST("zero-page-detection", "none", "none"), - TEST("tls-authz", "my_authz", "'my_authz'"), - TEST("tls-creds", "null", "'null'"), - TEST("tls-hostname", "localhost", "'localhost'"), + TEST("tls-authz", "my_authz", "my_authz"), + TEST("tls-creds", "null", "null"), + TEST("tls-hostname", "localhost", "localhost"), TEST("cpr-exec-command", "/bin/true foobar", "/bin/true foobar"), =20 /* can be set but are currently missing in the query output */ --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387470; cv=none; d=zohomail.com; s=zohoarc; b=hBfPDIrq/9Ou3nQ0TgmQ09PPno0s7x0dDxb/AaLCnDJKbr4vN+YuSPkahYwkyoXRBuDohmGvxoAiYVy9Eoo9qAFpz67/SUEhxN9/3POCR3HVnEQh4Ehp6+r7oG/uRtnokvqbsYJC9nXiI+2ESMRYkKBRJmIpxghkV/zWDfLpGJw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387470; 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=Jy8owL1HVPYi6saXX9DvuSPKdjr1vElO2c4RUXQ9pmU=; b=FMsIQtZ2CY+n/xJ1ZF3teSYWL7c+CZstDXbs0tsbr3JmeY/tg7E+rEgF66wBm0tAu4wDg6uC1T/AQS7BSB2KGFRWuqIv7/3Jn/kfRm996eJh1Ws89VPy/Kj3mmR1iqx5AJDTf+ZrXh1OndN1b1Xru9+jDJ5+2kEocDjjTsyi/aA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387470501231.49421043209202; Wed, 2 Sep 2026 15:17:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tG0-0000xH-E0; Wed, 02 Sep 2026 18:16:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFy-0000wP-Ue for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16: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 1x1tFw-0002Oe-9q for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:34 -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 D57F41F890; Wed, 2 Sep 2026 22:16: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 0570313976; Wed, 2 Sep 2026 22:16:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id METrMTWgmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387387; 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=Jy8owL1HVPYi6saXX9DvuSPKdjr1vElO2c4RUXQ9pmU=; b=YIXoygVRPGeSyX46SlL5cg0m/QqMVeBNHRiUpA/m2H6rAuYdY9dntDeE/Kno/Xd2AduKIq olDtfv+Wiji7BfV+iHOpZl393FDYBxk337hn9zYUGGnzrVmRv7PfG36QdTehzf6cUm3jtj gMJA4zM85VfCNPzlpDGqnubVRQxiU5E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387387; 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=Jy8owL1HVPYi6saXX9DvuSPKdjr1vElO2c4RUXQ9pmU=; b=F7Rc9qs+Qky6undNFG+mAgViOWM6P0Tnve5QAj6bc1NqsarcPQq9uF4HT1ghvK40Rom2bI +6D2aAl7YL3wi+AQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=aHbQ76ig; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ZF73Bnbg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387382; 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=Jy8owL1HVPYi6saXX9DvuSPKdjr1vElO2c4RUXQ9pmU=; b=aHbQ76igdID2ZNaii5mkwFJDyTgajIxSGRlktqdVf1A841CzDGq+dzRI1Xe0mbyqRy2Fge ntOjrNic39jecCCoTKdRIe9TDuA/q9L2qvjQpoAoDfsaHkCs1RclEy+c6enO6otQXj59Hz 0tqc7GgK8Z4VBmfHwD2Hva6aNVg0xhQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387382; 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=Jy8owL1HVPYi6saXX9DvuSPKdjr1vElO2c4RUXQ9pmU=; b=ZF73BnbgME3fUGioXy4G9rdzbNbSnHjMldXIRV2pV/wYw04hxwkaTS5oUmZ7yYX3xHc3PX 2xEHmsWQLh7cXNBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PATCH 13/18] migration: Use output visitor in info command Date: Wed, 2 Sep 2026 19:15:41 -0300 Message-ID: <20260902221547.1812481-14-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: D57F41F890 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 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)[]; 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] 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=lists1p.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: -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: qemu development 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: 1788387473298154100 Content-Type: text/plain; charset="utf-8" The hmp_info_migrate_parameters function currently open-codes the mon_printf calls for each migration parameter. As with the set command in the last patch, this should not be necessary as the QAPI infrastructure already has generated code that takes type and struct member names into account, including converting _ from C into the '-' character as part of parameter names strings. The current code is also quite painful to rebase if a series has been carried for a long time while parameters have been added in master. Replace all of this with a conversion from MigrationParameters to QDict using an output visitor and a loop over the QDict that prints per-QAPI-type formatted strings. Modelled after block/qapi.c:dump_qobject, but with some changes to keep the migration command output formatting. Note that this was not a for-free improvement, the HMP command format output was changed incompatibly in a previous patch. It doesn't output units anymore. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 243 ++++++++++++++------------------- 1 file changed, 100 insertions(+), 143 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 089c6d4ff46..dff69650a0c 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -25,7 +25,12 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" #include "qapi/qobject-input-visitor.h" +#include "qapi/qobject-output-visitor.h" +#include "qobject/qbool.h" #include "qobject/qdict.h" +#include "qobject/qjson.h" +#include "qobject/qlist.h" +#include "qobject/qnum.h" #include "qobject/qstring.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" @@ -316,170 +321,122 @@ void hmp_info_migrate_capabilities(Monitor *mon, co= nst QDict *qdict) qapi_free_MigrationCapabilityStatusList(caps); } =20 -static void monitor_print_cpr_exec_command(Monitor *mon, strList *args) +static QDict *migrate_params_to_dict(MigrationParameters *p, Error **errp) { - monitor_printf(mon, "%s:", - MigrationParameter_str(MIGRATION_PARAMETER_CPR_EXEC_COMMAND)); + QObject *obj =3D NULL; + Visitor *v =3D qobject_output_visitor_new(&obj); =20 - while (args) { - monitor_printf(mon, " %s", args->value); - args =3D args->next; + if (visit_type_MigrationParameters(v, NULL, &p, errp)) { + visit_complete(v, &obj); } - monitor_printf(mon, "\n"); + visit_free(v); + return qobject_to(QDict, obj); } =20 -void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) +static void hmp_migrate_print_qobject(Monitor *mon, const char *label, + QObject *obj) { - MigrationParameters *params; - MigrationState *s =3D migrate_get_current(); + const char *sep; =20 - params =3D qmp_query_migrate_parameters(NULL); + if (!obj) { + return; + } =20 - if (params) { - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_INITIAL), - params->announce_initial); - monitor_printf(mon, "%s: %" PRIu64 "\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 "\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->tls_authz); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz->u.s); - assert(params->has_max_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), - params->max_bandwidth); - assert(params->has_avail_switchover_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BA= NDWIDTH), - params->avail_switchover_bandwidth); - assert(params->has_max_postcopy_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), - params->max_postcopy_bandwidth); - assert(params->has_downtime_limit); - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT), - params->downtime_limit); - assert(params->has_x_checkpoint_delay); - monitor_printf(mon, "%s: %u\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 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), - params->xbzrle_cache_size); + /* + * Put a space after labels + * foo: bar + * ^ + */ + if (label && label[0] && label[strlen(label) - 1] =3D=3D ':') { + sep =3D " "; + } else { + sep =3D ""; + } =20 - if (s->has_block_bitmap_mapping) { - BitmapMigrationNodeAliasList *nal; - BitmapMigrationNodeAlias *na; - BitmapMigrationBitmapAliasList *bal; - BitmapMigrationBitmapAlias *ba; - BitmapMigrationBitmapAliasTransform *bat; + switch (qobject_type(obj)) { + case QTYPE_NONE: + g_assert_not_reached(); + case QTYPE_QNULL: + break; + case QTYPE_QNUM: { + int64_t i64; =20 - monitor_printf(mon, "%s:", - MigrationParameter_str( - MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); + if (qnum_get_try_int(qobject_to(QNum, obj), &i64)) { + monitor_printf(mon, "%s%s%" PRId64, label, sep, i64); + } + break; + } + case QTYPE_QSTRING: { + QString *str =3D qobject_to(QString, obj); =20 - for (nal =3D params->block_bitmap_mapping; nal; nal =3D nal->n= ext) - { - na =3D nal->value; - monitor_printf(mon, " bitmaps:"); - for (bal =3D na->bitmaps; bal; bal =3D bal->next) { - ba =3D bal->value; - bat =3D ba->transform; + if (str) { + monitor_printf(mon, "%s%s%s", label, sep, qstring_get_str(str)= ); + } + break; + } + case QTYPE_QDICT: { + QDict *d =3D qobject_to(QDict, obj); + const QDictEntry *e; + int i =3D 0; =20 - monitor_printf(mon, " name: %s", ba->name); - if (bat && bat->has_persistent) { - if (bat->persistent) { - monitor_printf(mon, " persistent: on"); - } else { - monitor_printf(mon, " persistent: off"); - } - } - monitor_printf(mon, " alias: %s", ba->alias); + if (d) { + for (e =3D qdict_first(d); e; e =3D qdict_next(d, e), i++) { + g_autofree char *l =3D g_strdup_printf("%s:", qdict_entry_= key(e)); + if (i) { + monitor_printf(mon, " "); } - monitor_printf(mon, " node-name: %s alias: %s", - na->node_name, na->alias); + hmp_migrate_print_qobject(mon, l, qdict_entry_value(e)); } - - monitor_printf(mon, "\n"); } + break; + } + case QTYPE_QLIST: { + QList *l =3D qobject_to(QList, obj); + const QListEntry *e; =20 - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), - params->x_vcpu_dirty_limit_period); + if (l) { + monitor_printf(mon, "%s", label); =20 - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), - params->vcpu_dirty_limit); + for (e =3D qlist_first(l); e; e =3D qlist_next(e)) { + /* + * In the first iteration, this is the space after the + * colon, otherwise it's the space between list + * elements. + */ + monitor_printf(mon, " "); + hmp_migrate_print_qobject(mon, "", e->value); + } + } + break; + } + case QTYPE_QBOOL: { + QBool *b =3D qobject_to(QBool, obj); + if (b) { + monitor_printf(mon, "%s%s%s", label, sep, + qbool_get_bool(b) ? "on" : "off"); + } + break; + } + default: + g_assert_not_reached(); + break; + } +} =20 - assert(params->has_mode); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_MODE), - qapi_enum_lookup(&MigMode_lookup, params->mode)); +void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) +{ + MigrationParameters *params =3D qmp_query_migrate_parameters(NULL); + g_autoptr(QDict) d; + const QDictEntry *e; =20 - if (params->has_direct_io) { - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str( - MIGRATION_PARAMETER_DIRECT_IO), - params->direct_io ? "on" : "off"); - } + assert(params); =20 - if (params->has_x_rdma_chunk_size) { - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str( - MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), - params->x_rdma_chunk_size); - } + d =3D migrate_params_to_dict(params, NULL); + for (e =3D qdict_first(d); e; e =3D qdict_next(d, e)) { + g_autofree char *label =3D g_strdup_printf("%s:", qdict_entry_key(= e)); =20 - assert(params->has_cpr_exec_command); - monitor_print_cpr_exec_command(mon, params->cpr_exec_command); + hmp_migrate_print_qobject(mon, label, qdict_entry_value(e)); + monitor_printf(mon, "\n"); } =20 qapi_free_MigrationParameters(params); --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387435; cv=none; d=zohomail.com; s=zohoarc; b=Kj3ekfl6FjQJIgngpylmPEfujiWr+rDXJET8zb6TmIFQURr+xpAieWnzWnA7SpwyKbswdoXxsAgTh6M39tQn4aGMWHUYG0/jHzeNltOXJMEIY86CnVof0BEdF6LzYSiqyTZr9F7csRdvptNQTx4rc6mktsD3Rr66O0kJ4sROn7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387435; 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=IxsVlcQ9sD392huGe4djQLqhh3SePbOim0/nA4pkSic=; b=ZTH+0vYH+6LKq6zhES/K8BwLmHU/gPFwJElHBU29YPvHjg6DpQrQgkWlyB1KYUvObHcGjE4Vz14im61JSH1TcXQ42ivZnxIzyPGxQ1hW97RcMWTuy4eeUsqJ8v9E1mxiSU0sAx19KhzeiQIHAatIjqamlgImggW9/9LrHHDLLiE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387435129509.3758302598585; Wed, 2 Sep 2026 15:17:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tG1-0000xQ-0l; Wed, 02 Sep 2026 18:16:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tFy-0000wO-TX for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:34 -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 1x1tFx-0002On-DD for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:34 -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 05A0C1F8C1; Wed, 2 Sep 2026 22:16: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 28FD213888; Wed, 2 Sep 2026 22:16: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 aDaaOjagmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387388; 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=IxsVlcQ9sD392huGe4djQLqhh3SePbOim0/nA4pkSic=; b=TY/vB23+Rv5j/QrmgucW6SGMyPQ/2cReir7ME1Qtx9mHUhBDvskedeWm/yn9FEjQR66PEX 8CnZt/4x1TQkGdS+EEMkl3KXUMMhypw0/k7WtSkjcwBPUQvh+qmqh7yKfFTbBDP2EwO0mm VqRXBXZUM1eBe1VfF33iBTGewS9yIyg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387388; 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=IxsVlcQ9sD392huGe4djQLqhh3SePbOim0/nA4pkSic=; b=tPexCqb16EKnArNuGw2YbJKK3GDYPy9YR547RFPcfEvSeiv0IwNFXPnRUe8qj5Xmtgh4L5 GezcOtoNSG0JxVAg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=hYCr9ppt; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=H8YZCTi8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387384; 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=IxsVlcQ9sD392huGe4djQLqhh3SePbOim0/nA4pkSic=; b=hYCr9ppt7RtJzY+H8JoUb6J9x+Hx/czW4RLvcv2zF29jcYlwjymYaAl8X1WCBIkCebDaEM gjHTpmHyleV6kQ2ZQmI27b02lNuaEteSHDfThvLzRpzU+RGR/J0EfB3aMnBCVmuwC/i4KL zGi47Aj6vON8dEahaKwSl0HML6VMYYs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387384; 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=IxsVlcQ9sD392huGe4djQLqhh3SePbOim0/nA4pkSic=; b=H8YZCTi8fJ/AjV9m9/+idyjg7L5i8d4I/5pztEJBU5bs9PHBHxe3fYaxNtDCpJ+fcHfyuE u0AaR9Phvf8QpRBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PATCH 14/18] migration: Rewrite migrate_set_parameter_completion using QDict Date: Wed, 2 Sep 2026 19:15:42 -0300 Message-ID: <20260902221547.1812481-15-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 05A0C1F8C1 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)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387436362158500 Content-Type: text/plain; charset="utf-8" The migrate_set_parameter_completion function is the last user of the MigrationParameter enum. Write the code using an output visitor and QDict instead so we can remove the enum in a future patch. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index dff69650a0c..d0adda25090 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -791,14 +791,19 @@ void migrate_set_capability_completion(ReadLineState = *rs, int nb_args, void migrate_set_parameter_completion(ReadLineState *rs, int nb_args, const char *str) { + g_autoptr(MigrationParameters) params =3D g_new0(MigrationParameters, = 1); + g_autoptr(QDict) d =3D migrate_params_to_dict(params, NULL); + const QDictEntry *e; size_t len; =20 len =3D strlen(str); readline_set_completion_index(rs, len); if (nb_args =3D=3D 2) { - int i; - for (i =3D 0; i < MIGRATION_PARAMETER__MAX; i++) { - readline_add_completion_of(rs, str, MigrationParameter_str(i)); + for (e =3D qdict_first(d); e; e =3D qdict_next(d, e)) { + const char *key =3D qdict_entry_key(e); + if (!g_str_has_prefix(key, "has-")) { + readline_add_completion_of(rs, str, key); + } } } } --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387478; cv=none; d=zohomail.com; s=zohoarc; b=gFUx9Udl3N0PuFjpMGsZOKshipkEqtlfl2Y5Xbj/SvK1iTmn+Q1gNV7UAgt1zsW8/nSYWUMAUPHyRrC+pGRxH6/O1KI+OV3dfTHlb0x3q2MPnhyLXG9p9PZMTMBPqt/K9grIYzn7PD4ZIkaBsEIpiSFjT3cj767b8IWxaOrh3J8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387478; 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=tvOieIH2FqGnbBgCg99F3RW0hBUBq/tNxTru6TqDqy4=; b=TjtNdE1B5NXhKbA6TTruLdcIrITxniXWOUOeh+93P5QDyvlW+O1kV9Eb/SmJ0eoLhuq1omrKgBlPbDjZskZq5E1oVy0+m2L9BORXtwsf2AnLKaRhVFjLyKfsDBfJij/PHJpRcnSMuG2AqG5f/zldJ5CsWnDnt29eNStaKoWf0Yw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387478471835.087420448098; Wed, 2 Sep 2026 15:17:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tG2-0000xm-5i; Wed, 02 Sep 2026 18:16:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tG0-0000xI-Pv for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:36 -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 1x1tFy-0002Ox-Ur for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:36 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 85CFB1F8D6; Wed, 2 Sep 2026 22:16:25 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4FBDA13515; Wed, 2 Sep 2026 22:16: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 GGV6CDigmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387389; 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=tvOieIH2FqGnbBgCg99F3RW0hBUBq/tNxTru6TqDqy4=; b=hCHy6zu5jFuCKkumvp6OzApT2iizVTepo/Bgd+6+ki1xr9lX3C8td6xnQcQi+j8fu9aD/7 dWJKs4vdLZCpaoArdMlQatBful4khCiyKE9UlG7qHg0hqsCyXv67vOPw9NT2Ws3QCjpzoF GKvOjt5XTDJhG+7mEsoqs4i75fo9cmg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387389; 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=tvOieIH2FqGnbBgCg99F3RW0hBUBq/tNxTru6TqDqy4=; b=U5+OkLGyNZoaeQ7UMwL9TVrIRWwT9VJzRl/rx+khLK3OCtER+G0Rk/23ErR6Ln63vzOOO9 UH6M0kWmX2LwbzAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="xaW/rtiv"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=6l0NUAFn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387385; 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=tvOieIH2FqGnbBgCg99F3RW0hBUBq/tNxTru6TqDqy4=; b=xaW/rtiv1qi0ElsKJTQjnhI4Jhj/vg4VJYImUq1WQqnTIUqm0tCNhXeBw2qo6RnNLSFUip ImEjmStphQnQj6fO30Ua2sRn//tDqqGV5vzQGicdUVPcExXzEewniuFuHeSsmlWlV89ARK DWIqncmi3i5jNQIq7/LgfQQq7bpJb78= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387385; 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=tvOieIH2FqGnbBgCg99F3RW0hBUBq/tNxTru6TqDqy4=; b=6l0NUAFn8C6i6w+bkgvvq+bCwxCXSmpix9XLaCKzcdRa4ReS1ZzA2kk/1b5Jg8xQVD3j0f uXq1FR6e0U9nuzBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Eric Blake , Markus Armbruster Subject: [PATCH 15/18] qapi/migration: Remove MigrationParameter Date: Wed, 2 Sep 2026 19:15:43 -0300 Message-ID: <20260902221547.1812481-16-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 85CFB1F8D6 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)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(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]; 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:dkim,suse.de:email,suse.de:mid,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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387481155154100 Content-Type: text/plain; charset="utf-8" This enum is convenient in two ways (just how enums work): 1- It provides the number of migration parameters as its __MAX member. 2- It allows iterating over an integer range and get a migration parameter name string corresponding to that position in the enum. The migration code doesn't have the need for (2) anymore. Balancing the benefit of (1) versus the disadvantage of requiring migration.json to be updated in two different places whenever a parameter is added, experience shows that the latter churn is enough to decide to remove the enum. Signed-off-by: Fabiano Rosas Acked-by: Peter Xu Reviewed-by: Markus Armbruster --- migration/options.c | 6 +----- qapi/migration.json | 36 ------------------------------------ 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/migration/options.c b/migration/options.c index 5d17acdd881..f988b181f0e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1127,7 +1127,6 @@ static MigrationParameters *migrate_params_from_dict(= QDict *d, Error **errp) */ 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, @@ -1144,10 +1143,7 @@ static void migrate_mark_all_params_present(Migratio= nParameters *p) &p->has_x_rdma_chunk_size, &p->has_cpr_exec_command, }; =20 - len =3D ARRAY_SIZE(has_fields); - assert(len + n_str_args =3D=3D MIGRATION_PARAMETER__MAX); - - for (int i =3D 0; i < len; i++) { + for (int i =3D 0; i < ARRAY_SIZE(has_fields); i++) { *has_fields[i] =3D true; } } diff --git a/qapi/migration.json b/qapi/migration.json index b1eaf7b0545..78c6e933cf1 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -796,42 +796,6 @@ 'bitmaps': [ 'BitmapMigrationBitmapAlias' ] } } =20 -## -# @MigrationParameter: -# -# Migration parameters enumeration. The enumeration values mirror the -# members of @MigrationParameters. -# -# Features: -# -# @unstable: Members @x-checkpoint-delay, @x-rdma-chunk-size, and -# @x-vcpu-dirty-limit-period are experimental. -# -# Since: 2.4 -## -{ 'enum': 'MigrationParameter', - 'data': ['announce-initial', 'announce-max', - 'announce-rounds', 'announce-step', - 'throttle-trigger-threshold', - 'cpu-throttle-initial', 'cpu-throttle-increment', - 'cpu-throttle-tailslow', - 'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth', - 'avail-switchover-bandwidth', 'downtime-limit', - { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] }, - 'multifd-channels', - 'xbzrle-cache-size', 'max-postcopy-bandwidth', - 'max-cpu-throttle', 'multifd-compression', - 'multifd-zlib-level', 'multifd-zstd-level', - 'multifd-qatzip-level', - 'block-bitmap-mapping', - { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= }, - 'vcpu-dirty-limit', - 'mode', - 'zero-page-detection', - 'direct-io', - { 'name': 'x-rdma-chunk-size', 'features': [ 'unstable' ] }, - 'cpr-exec-command'] } - ## # @migrate-set-parameters: # --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387507; cv=none; d=zohomail.com; s=zohoarc; b=QlMSvNpb29ezTUvZlKZWuG3tKBblDjhcqI9EaT/FRmCj6axShbxc+MU9AjXZ5nYPTCZvF9GvYYWq3ONzD/RjSgQYZ8BVTGnG3HoCoLVx4KqbZhu9KFx47qD4DlifhDMRnW1tnGhUipelPZkNwys+AiDWE5KU/LURb2K6/lCIaXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387507; 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=FFhddMlOkM/E6coKvNvUjF3rxjo+YGrjoamLfMNjAvc=; b=VEs6hzDZkB8FbPUnzuCTEcUYR9O/J4OzwwCC9Od9W3eeeJGlwbISnnNRSP317ASBhH0HQPA+jeDh1sgIzKtcD4WgLIUW2k6D11hkipMk5WjVIt+RADA3YMT+uQj5iPyl8znNPeQ4UNkRTaMnuZsgqTSAhFYk88yIgInTp49/3CM= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387507061196.8824851836822; Wed, 2 Sep 2026 15:18:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tG4-0000yI-Tw; Wed, 02 Sep 2026 18:16:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tG3-0000y4-GQ for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:39 -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 1x1tG0-0002PE-IR for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16: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 19CFB21B2F; Wed, 2 Sep 2026 22:16:27 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D590213736; Wed, 2 Sep 2026 22:16:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MPcYKTmgmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387391; 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=FFhddMlOkM/E6coKvNvUjF3rxjo+YGrjoamLfMNjAvc=; b=kpeCXohRbjlNmGofFf/pi9SC1dJgzIYa+RmJKVX6hM4P5pKXDdzFk4XTju8MqPUWGNchmM lY4JMCVGAiADemZLMX9/w8vyvBvhK39BUNBnECL/8cpbgn54s+VPT6etThpp8DCT+MEzkr LB2C/S+DtdIQiII8l5fGh3fTIxOoQus= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387391; 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=FFhddMlOkM/E6coKvNvUjF3rxjo+YGrjoamLfMNjAvc=; b=h6wUHspsCODauM6BnRE4QYZuz5mR2UELXWEII2Evq+Ux3Lc+na547zp6epPhd6GjeSWFTC oGZWiRlLSlknrLAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387387; 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=FFhddMlOkM/E6coKvNvUjF3rxjo+YGrjoamLfMNjAvc=; b=lmomWaf4KRehtOBIREXP8s6xIpocugAFGxIZUtz5vlYxAyjV6LUOXQ9f65vR01BoebBytS jiYAPZgWE5i9ngdCiRM47OyfifgpO74ZvN/DWU0WR7VHF3d7ZEOMtYQkbiziKNKt2NscV+ wNb25NqbAM8MI/3+nZwCfCgg3gZmE4g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387387; 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=FFhddMlOkM/E6coKvNvUjF3rxjo+YGrjoamLfMNjAvc=; b=KzMmdGMUSN1dpVei6C7GBTFPGVI/qH91iNPoZfisnRim64jjleUembg09vuwKzsiu7Honj mnlbRHqW/t3amfCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Eric Blake , Markus Armbruster Subject: [PATCH 16/18] migration: Add capabilities into MigrationParameters Date: Wed, 2 Sep 2026 19:15:44 -0300 Message-ID: <20260902221547.1812481-17-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; 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]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387508387158500 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. 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. Acked-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 8 +++ migration/options.c | 127 ++++++++++++++++++++++++++++++++++++++++++ migration/options.h | 5 ++ qapi/migration.json | 118 ++++++++++++++++++++++++++++++++++++++- 4 files changed, 255 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index dab282dd2f3..c8e7e86ea05 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4086,6 +4086,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 f988b181f0e..7c638e204a1 100644 --- a/migration/options.c +++ b/migration/options.c @@ -778,6 +778,108 @@ 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_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; @@ -819,6 +921,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 */ @@ -1141,6 +1245,15 @@ static void migrate_mark_all_params_present(Migratio= nParameters *p) &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_x_rdma_chunk_size, &p->has_cpr_exec_command, + &p->has_xbzrle, &p->has_rdma_pin_all, + &p->has_auto_converge, &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_mult= ifd, + &p->has_dirty_bitmaps, &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_limit, &p->has_mapped_ram, }; =20 for (int i =3D 0; i < ARRAY_SIZE(has_fields); i++) { @@ -1465,6 +1578,20 @@ void qmp_migrate_set_parameters(MigrationParameters = *input, Error **errp) tls_opt_to_str(input->tls_hostname); tls_opt_to_str(input->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(cur, i); + } + if (!migrate_caps_check(migrate_get_current()->capabilities, new_caps, + errp)) { + return; + } + /* merge input on top of current */ if (!migrate_params_merge(cur, input, &new, errp)) { return; diff --git a/migration/options.h b/migration/options.h index c7da2d0b5b0..eedd1aa1f93 100644 --- a/migration/options.h +++ b/migration/options.h @@ -94,4 +94,9 @@ uint64_t migrate_rdma_chunk_size(void); bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); bool migrate_params_free(MigrationParameters *params, Error **errp); +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 78c6e933cf1..7952ef44db9 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -976,10 +976,101 @@ # Must be set to the same value on both source and destination # before migration starts. (Since 11.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) +# +# @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, @x-rdma-chunk-size, and -# @x-vcpu-dirty-limit-period are experimental. +# @unstable: Members @x-checkpoint-delay, @x-vcpu-dirty-limit-period, +# @x-colo, @x-ignore-shared and @x-rdma-chunk-size are +# experimental. # # Since: 2.4 ## @@ -1017,7 +1108,28 @@ '*direct-io': 'bool', '*x-rdma-chunk-size': { 'type': 'uint64', 'features': [ 'unstable' ] }, - '*cpr-exec-command': [ 'str' ]} } + '*cpr-exec-command': [ 'str' ], + '*xbzrle': 'bool', + '*rdma-pin-all': 'bool', + '*auto-converge': 'bool', + '*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.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387483; cv=none; d=zohomail.com; s=zohoarc; b=MOS0LCjvvuOB6TY3XauT3p/D4WjITt6NrIUruEmQk9TpTkZozrt3Ux0KqAThg3NmtQqogzrk5ou9nyUQiF1k7Bhjcgby3KjXw73ocSyMpEtdaKp2NyYjRDC748PVuav58/62dhNpO7njE20NO+1oV+9OuGzeHiODMGtKW7C0qhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387483; 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=EN3HZ2mcXSReFVChVzZV2TfNPS8MZAD8+fPNEM7GIb8=; b=Umb2BV4tyuuZNnA8iB+MiDyhikPiDbNbiGhIeXPk2aXAzfap5WPLlqxPi22aopDhdgMu3sUMfYXFP6GMzXct3LTQuMqLJUMcLNb/QP74tRjvxpp8cF0O8JVoBRSmLtsteDun6Aua+tVs069C4M3ptodWIYAAOwXY65ZlFvg8wrI= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178838748347270.92160142687123; Wed, 2 Sep 2026 15:18:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tG8-0000zc-0W; Wed, 02 Sep 2026 18:16:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tG6-0000yk-8g for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:42 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x1tG2-0002PO-HP for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:42 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D1D9721CCB; Wed, 2 Sep 2026 22:16:28 +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 6D0AB13738; Wed, 2 Sep 2026 22:16: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 sFSbDzugmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387392; 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=EN3HZ2mcXSReFVChVzZV2TfNPS8MZAD8+fPNEM7GIb8=; b=UBWvEcOEbfI+N5JP43ggI2QBMHMSZJ03uPa4qBlEwDApV5LU6fWJA/fCxMhlEFd7Kvd5bQ xz1iMQJn4mt/rrA82aqIDrhNukTqh7C1Z5E2BJEoOON9SF/cPGLz3O27DvbOXvbMw1NSVN aJk30iCRS06yMXrGYRyM1pF4FMPvPNQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387392; 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=EN3HZ2mcXSReFVChVzZV2TfNPS8MZAD8+fPNEM7GIb8=; b=wRqiPWwJazOEzY9LoVvvzj4QnRq8qTPJLJB9cW0bg9TG8+elBjnGrNgfSSPCkyRq1FTg7s jszNdJEQMyysimCw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387388; 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=EN3HZ2mcXSReFVChVzZV2TfNPS8MZAD8+fPNEM7GIb8=; b=bcp1KamQdwCOsJvKrb8plOxNKtI+ZE/+g7qwcE6E1C+uEqOYtImbXRw/OZ4UnPEEb/pgVa PDo6v8bnlhyM2nwrAec8qsRDnPdvSgywfXumyjdQ6a2l4I4I1gFoxKIqBznzfQLBTJXlPO IQGV+MFfrhnt7yAYkvwEgp51xp/Vp9I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387388; 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=EN3HZ2mcXSReFVChVzZV2TfNPS8MZAD8+fPNEM7GIb8=; b=Db5mo7dUzHvedVJN0/eMWInMVkmHDY2dCbeML9rPsXebnboGkYq17XjluUcBBLMgHcPGhH bWw/OdJKdo3lNsAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH 17/18] migration: Remove s->capabilities Date: Wed, 2 Sep 2026 19:15:45 -0300 Message-ID: <20260902221547.1812481-18-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; URIBL_BLOCKED(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid, suse.de:email, imap1.dmz-prg2.suse.org:helo] 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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: 1788387485567154100 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. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 22 +- migration/migration.h | 2 +- migration/options.c | 317 ++++++++++++----------------- migration/options.h | 19 +- migration/savevm.c | 8 +- tests/qtest/migration/misc-tests.c | 141 +++++++++++++ 6 files changed, 284 insertions(+), 225 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c8e7e86ea05..69dd4f3d050 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -255,9 +255,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; @@ -4079,22 +4080,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 e47ff4e3d11..e1204b7f0d5 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -357,7 +357,7 @@ struct MigrationState { /* Timestamp when VM is down (ms) to migrate the last stuff */ int64_t downtime_start; int64_t downtime; - bool capabilities[MIGRATION_CAPABILITY__MAX]; + int64_t expected_downtime; int64_t setup_time; =20 /* diff --git a/migration/options.c b/migration/options.c index 7c638e204a1..780693ceed9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -88,9 +88,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 *, \ @@ -198,32 +195,42 @@ const Property migration_properties[] =3D { parameters.x_rdma_chunk_size, DEFAULT_MIGRATE_X_RDMA_CHUNK_SIZE), =20 - /* 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-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("postcopy-blocktime", - MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME), - 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-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("postcopy-blocktime", + MigrationState, parameters.postcopy_blocktime, 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_MIG_CAP("x-ignore-shared", - MIGRATION_CAPABILITY_X_IGNORE_SHARED), + 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), + DEFINE_PROP_BOOL("x-ignore-shared", + MigrationState, parameters.x_ignore_shared, false), }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 @@ -306,7 +313,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) @@ -320,144 +327,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(); @@ -509,44 +514,6 @@ WriteTrackingSupport migrate_query_write_tracking(void) 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); - -/* Snapshot compatibility check list */ -static const -INITIALIZE_MIGRATE_CAPS_SET(check_caps_savevm, - MIGRATION_CAPABILITY_MULTIFD, -); - static bool migrate_incoming_started(void) { return !!migration_incoming_get_current()->transport_data; @@ -555,34 +522,28 @@ static bool migrate_incoming_started(void) bool migrate_can_snapshot(Error **errp) { MigrationState *s =3D migrate_get_current(); - int i; =20 - for (i =3D 0; i < check_caps_savevm.size; i++) { - int incomp_cap =3D check_caps_savevm.caps[i]; - - if (s->capabilities[incomp_cap]) { - error_setg(errp, - "Snapshots are not compatible with %s", - MigrationCapability_str(incomp_cap)); - return false; - } + if (migrate_capability_get_compat( + &s->parameters, MIGRATION_CAPABILITY_MULTIFD)) { + error_setg(errp, + "Snapshots are not compatible with multifd"); + return false; } =20 return true; } =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; } @@ -590,30 +551,23 @@ 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 #ifdef CONFIG_REPLICATION - if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { - if (!new_caps[MIGRATION_CAPABILITY_RETURN_PATH]) { + if (new->x_colo) { + if (!new->return_path) { error_setg(errp, "Capability 'x-colo' requires capability " "'return-path'"); return false; } } #else - 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"= ); @@ -621,27 +575,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. @@ -657,41 +611,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; } @@ -703,22 +661,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; @@ -731,30 +689,29 @@ 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_MAPPED_RAM] && - new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { - if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { + if (new->mapped_ram && new->postcopy_ram) { + if (new->multifd) { error_setg(errp, "Multifd is not supported with fast snapshot load"); return false; } =20 - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { + if (new->postcopy_preempt) { error_setg( errp, "Postcopy Preempt is incompatible with fast snapshot load"= ); @@ -772,7 +729,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; @@ -890,39 +847,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 */ @@ -983,9 +938,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) @@ -1555,6 +1509,9 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) !is_power_of_2(params->x_rdma_chunk_size))) { error_setg(errp, "Option x_rdma_chunk_size expects " "a power of 2 in the range 1MiB to 1024MiB"); + } + + if (!migrate_caps_check(params, errp)) { return false; } =20 @@ -1578,20 +1535,6 @@ void qmp_migrate_set_parameters(MigrationParameters = *input, Error **errp) tls_opt_to_str(input->tls_hostname); tls_opt_to_str(input->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(cur, i); - } - if (!migrate_caps_check(migrate_get_current()->capabilities, new_caps, - errp)) { - return; - } - /* merge input on top of current */ if (!migrate_params_merge(cur, input, &new, errp)) { return; diff --git a/migration/options.h b/migration/options.h index eedd1aa1f93..27a55c36a5f 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); bool migrate_can_snapshot(Error **errp); =20 /* parameters */ @@ -89,8 +77,6 @@ uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); uint64_t migrate_rdma_chunk_size(void); =20 -/* parameters helpers */ - bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); bool migrate_params_free(MigrationParameters *params, Error **errp); @@ -99,4 +85,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 5b0e89ca7c8..c284b76f609 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 bool configuration_pre_save(void *opaque, Error = **errp) 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; } } @@ -362,7 +364,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), diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 34b376562ff..ff11d80f79a 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -53,6 +53,147 @@ HMPTestData test_cases[] =3D { /* bool */ TEST("cpu-throttle-tailslow", "on", "on"), TEST("direct-io", "on", "on"), + TEST("events", "on", "on"), + + /* bool, with dependencies */ + + /* + * background-snapshot: + * rejects dirty-bitmaps + * rejects postcopy-blocktime + * rejects late-block-activate + * rejects multifd + * rejects pause-before-switchover + * rejects auto-converge + * rejects release-ram + * rejects rdma-pin-all + * rejects validate-uuid + * rejects zero-copy-send + * rejects postcopy-ram + */ + TEST("background-snapshot", "on", "on"), + TEST("dirty-bitmaps", "on", BG_SNAP_MSG), + TEST("postcopy-blocktime", "on", BG_SNAP_MSG), + TEST("late-block-activate", "on", BG_SNAP_MSG), + TEST("multifd", "on", BG_SNAP_MSG), + TEST("pause-before-switchover", "on", BG_SNAP_MSG), + TEST("auto-converge", "on", BG_SNAP_MSG), + TEST("release-ram", "on", BG_SNAP_MSG), + TEST("rdma-pin-all", "on", BG_SNAP_MSG), + TEST("validate-uuid", "on", BG_SNAP_MSG), + TEST("zero-copy-send", "on", BG_SNAP_MSG), + TEST("postcopy-ram", "on", BG_SNAP_MSG), + TEST("background-snapshot", "off", "off"), + + TEST("dirty-bitmaps", "on", "on"), + TEST("postcopy-blocktime", "on", "on"), + TEST("late-block-activate", "on", "on"), + TEST("pause-before-switchover", "on", "on"), + TEST("auto-converge", "on", "on"), + TEST("release-ram", "on", "on"), + TEST("rdma-pin-all", "on", "on"), + TEST("validate-uuid", "on", "on"), + + /* + * postcopy-preempt + * requires postcopy-ram: + */ + TEST("postcopy-preempt", "on", + "Error: Postcopy preempt requires postcopy-ram"), + + /* + * postcopy-ram: + * required by postcopy-preempt + * rejected by x-ignore-shared + * rejected by background-snapshot + * rejected by mapped-ram + */ + TEST("postcopy-ram", "on", "on"), + TEST("postcopy-preempt", "on", "on"), + TEST("x-ignore-shared", "on", + "Error: Postcopy is not compatible with ignore-shared"), + TEST("background-snapshot", "on", BG_SNAP_MSG), + TEST("mapped-ram", "on", + "Error: Postcopy Preempt is incompatible with fast snapshot load"= ), + TEST("postcopy-ram", "off", + "Error: Postcopy preempt requires postcopy-ram"), + TEST("postcopy-preempt", "off", "off"), + TEST("postcopy-ram", "off", "off"), + + /* + * x-ignore-shared: + * rejected by postcopy-ram + */ + TEST("x-ignore-shared", "on", "on"), + TEST("postcopy-ram", "on", + "Error: Postcopy is not compatible with ignore-shared"), + TEST("x-ignore-shared", "off", "off"), + + /* + * return-path: + * required by x-colo + * required by switchover-ack + * rejected by background-snapshot + */ + TEST("return-path", "on", "on"), + TEST("x-colo", "on", "on"), + TEST("switchover-ack", "on", "on"), + TEST("background-snapshot", "on", BG_SNAP_MSG), + + TEST("return-path", "off", + "Error: Capability 'x-colo' requires capability 'return-path'"), + TEST("x-colo", "off", "off"), + + TEST("return-path", "off", + "Error: Capability 'switchover-ack' requires capability " + "'return-path'"), + TEST("switchover-ack", "off", "off"), + TEST("return-path", "off", "off"), + + TEST("x-colo", "on", + "Error: Capability 'x-colo' requires capability 'return-path'"), + TEST("switchover-ack", "on", "Error: Capability 'switchover-ack' requi= res " + "capability 'return-path'"), + + /* + * xbzrle: + * rejected by multifd + */ + TEST("xbzrle", "on", "on"), + TEST("multifd", "on", "Error: Multifd is not compatible with xbzrle"), + TEST("xbzrle", "off", "off"), + + /* + * multifd: + * rejected by xbzrle + * required by zero-copy-send + */ + TEST("multifd", "on", "on"), + TEST("xbzrle", "on", "Error: Multifd is not compatible with xbzrle"), + TEST("zero-copy-send", "on", "on"), + TEST("multifd", "off", "Error: Zero copy only available for " + "non-compressed non-TLS multifd migration"), + TEST("zero-copy-send", "off", "off"), + TEST("multifd", "off", "off"), + + /* + * auto-converge: + * rejected by dirty-limit + */ + TEST("auto-converge", "on", "on"), + TEST("dirty-limit", "on", + "Error: dirty-limit conflicts with auto-converge " + "either of then available currently"), + TEST("auto-converge", "off", "off"), + + /* + * dirty-limit: + * rejected by auto-converge + * requires KVM acceleration + */ + TEST("dirty-limit", "on", + "Error: dirty-limit requires KVM with accelerator " + "property 'dirty-ring-size' set"), =20 /* uint64_t */ TEST("announce-initial", "60", "60"), --=20 2.53.0 From nobody Sat Sep 26 20:50:59 2026 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=1788387467; cv=none; d=zohomail.com; s=zohoarc; b=bo50t+Xge6A5RCrrEamb+mO/rj66uUVTpjM5df4twDxTDLEaY1S97cOehgGVlcJfv4Ei+pWaXFaYIbshhYWbc3pr1Ewk4qf39l0PqHH2eK9QvYFPd09kpjVvgMxwBqG4x0HoBzxpWWCk3aED3GyG5kCVnI7Emw8L+rv8Bse+j8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788387467; 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=BAv6LkJHJx033JkMMqCstqmpybVhPzeKa8QpAH7d8gg=; b=BecV5uB/69R8xnL9SvJrCeiH0G8kDQu6ZKZn9vwmiWcBHpfHUjW9XQWaRmeqOx7xNRWHIJFlY91wzeR9gy9hDMYIF0ojvZTQQQ7//t2zrTp9Kurwptc+poYvlEtKjVAGxx2dIQJJi0pVoL/IxMr9H/9qICTKnEDPHA6H1dKQke4= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788387467213716.8634305435785; Wed, 2 Sep 2026 15:17:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1tG7-0000z7-Fr; Wed, 02 Sep 2026 18:16:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1tG5-0000yX-JZ for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:41 -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 1x1tG3-0002PU-Rl for qemu-devel@nongnu.org; Wed, 02 Sep 2026 18:16:41 -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 8C1BA1F8B0; Wed, 2 Sep 2026 22:16:30 +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 2879613869; Wed, 2 Sep 2026 22:16:28 +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 cI+EOjygmGpxXwAAD6G6ig (envelope-from ); Wed, 02 Sep 2026 22:16:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387394; 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=BAv6LkJHJx033JkMMqCstqmpybVhPzeKa8QpAH7d8gg=; b=QOAXu7wIy6MQTEwnNIQlcORw5m2Nazmbi7AWOmKvd9Jmdb2Eol9r3MzRdqG0zq5CuDTBjo 40CSCSywNPLeE7dDR9t3kiDE9AagrC37AFF2rjLzE6de/tfcVFZUxF+pmpFIYXucnGjNl8 IA/Uwe5FZrAlQdK+xzOEIp5ybOMRElg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387394; 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=BAv6LkJHJx033JkMMqCstqmpybVhPzeKa8QpAH7d8gg=; b=P39HbhFhH2SKzhgnbmk6XF5SK9OwXpXbTYGsEQh4Qlo0UJgRRidDLcNujmVpDGvna2dd/p zeH9468KGlVSZ0Ag== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788387390; 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=BAv6LkJHJx033JkMMqCstqmpybVhPzeKa8QpAH7d8gg=; b=TFX+qD5X//xOnoxAh/rjsArYkzgqyIolX3isbM2z8ZqtdA13ZQhcKjRmFcEAvYo+FpIJW/ 7sCj9bSBBn9nSfOArkOeo98QCO1sVyyPbxLffjS/o+09palThejj/wKIRgLQtaT8G4b6lG yN+V5mVaAbczZe5LS93m3ZPtpJj36M0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788387390; 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=BAv6LkJHJx033JkMMqCstqmpybVhPzeKa8QpAH7d8gg=; b=BxOaIJkumjpP+hxv7E4bxsq3kUdh6SNrPIEXvD8rxL/wb6FtDGMs+95UGwBY1kYgPhVGsz 1dfMewo9ZS9go9Ag== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , Pierrick Bouvier , Eric Blake Subject: [PATCH 18/18] qapi/migration: Deprecate capabilities commands Date: Wed, 2 Sep 2026 19:15:46 -0300 Message-ID: <20260902221547.1812481-19-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902221547.1812481-1-farosas@suse.de> References: <20260902221547.1812481-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.de:mid, suse.de:email] 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=lists1p.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: -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: qemu development 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: 1788387468190158500 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 Reviewed-by: Markus Armbruster Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- docs/about/deprecated.rst | 13 +++++++++++++ migration/migration-hmp-cmds.c | 6 ++++++ qapi/migration.json | 16 ++++++++++++++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 05e4ce8cf16..a28211a98b7 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -477,3 +477,16 @@ If the user requests a modern x86 CPU model (i.e. not = one of ``486``, ``athlon``, ``kvm32``, ``pentium``, ``pentium2``, ``pentium3``or ``qemu32`= `) a warning will be displayed until a future QEMU version when such CPUs will be rejected. + +Migration +--------- + +``migrate-set-capabilities`` command (since 11.1) +''''''''''''''''''''''''''''''''''''''''''''''''' + +Use ``migrate-set-parameters`` instead. + +``query-migrate-capabilities`` command (since 11.1) +''''''''''''''''''''''''''''''''''''''''''''''''''' + +Use ``query-migrate-parameters`` instead. diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index d0adda25090..d7a8902da01 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -308,6 +308,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) { @@ -542,6 +545,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 7952ef44db9..19fcc7e6072 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -564,6 +564,11 @@ # # @capabilities: json array of capability modifications to make # +# Features: +# +# @deprecated: This command is deprecated. Use migrate-set-parameters +# instead. +# # Since: 1.2 # # .. qmp-example:: @@ -573,13 +578,19 @@ # <- { "return": {} } ## { 'command': 'migrate-set-capabilities', - 'data': { 'capabilities': ['MigrationCapabilityStatus'] } } + 'data': { 'capabilities': ['MigrationCapabilityStatus'] }, + 'features': ['deprecated'] } =20 ## # @query-migrate-capabilities: # # Return information about the current migration capabilities status # +# Features: +# +# @deprecated: This command is deprecated. Use +# query-migrate-parameters instead. +# # Since: 1.2 # # .. qmp-example:: @@ -594,7 +605,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.53.0