From nobody Sat Sep 26 20:51:03 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=1789430647; cv=none; d=zohomail.com; s=zohoarc; b=dwiaKRFf3raTUF1YNB47uzmb4cc4n5BjipY6/eU6oxydlQGTRkupzMhGPCrDjT5AfjYJBGmsQ1TzeO9dr4ukEgRZcxgdo0zobKv0K4E011gwFZabgQIcF93XSPl/maLNr7Jl9Lp2c3vSQ10eHhTPt+0XCBDpdcc7x3bsnqQ5OOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430647; 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=PZGSSzQYnTwqwkKB8Yyt6avqtEmbpcuPp0fGs8PrBic=; b=Zwtsbxki8+QEpylDQVOjaMXI4Wzni6U295Ccxwnx0vk994uYHcjvhUJBqW6CBsz9VW0wcKhk0rRcdhzRuyK7c78VAFHI+bkhsoux/IRdur0cN/1/fqrGxdEeCTt+RGJajYVKZDV7jSU0XPQ5hJSbp9HCwMjfDrfHs3P97lw+YaY= 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 1789430647698317.54225525058325; Mon, 14 Sep 2026 17:04:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Gd5-0003KW-Mi; Mon, 14 Sep 2026 20:02: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 1x6Gd4-0003Jz-5h for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02: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 1x6Gd2-0004mP-Cr for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:29 -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 9E7EA1FF21; Tue, 15 Sep 2026 00:02: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 3875113710; Tue, 15 Sep 2026 00:02: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 Gk6xFQeLqGqIFAAAD6G6ig:T2 (envelope-from ); Tue, 15 Sep 2026 00:02:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430542; 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=PZGSSzQYnTwqwkKB8Yyt6avqtEmbpcuPp0fGs8PrBic=; b=Lc7gcE5PIDro3pRlU+Wy1CqcFHAUboUpS1Zgor/KyR7dYQVK5FdrxtB1fzRgoDBVl7WdGi zJZA3+bCsg85AgJzA3dCY7+e3tgmfaXAdT7UwCRH3SILYsUs4K/e6zN7xuVetDWj6sAXU3 kwW6rDpLRMRs9eMp6PafUoag60nkwFM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430542; 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=PZGSSzQYnTwqwkKB8Yyt6avqtEmbpcuPp0fGs8PrBic=; b=bmow1ld6bnG9R44cD4V60msIGG87AzQuZlpZEQa8NHLAjxtK6jFmyEY66+5P46vyQyc8fL 6TiQ3jfHjULM6ZDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="fjnXHS/L"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=dnOhplmD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430538; 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=PZGSSzQYnTwqwkKB8Yyt6avqtEmbpcuPp0fGs8PrBic=; b=fjnXHS/Lpcu4OXgn2au2j0W6u+1Gs1fJC1kOuBfwbWyipSnBf8mkS27/RDJwpfrd5tg9Ju GpdQCULN1KbFI1OswCgM/35ZOfwyHHCFH7fYyrL/El1t7LK12CCGmzv5VOdYX+vjuWB/Qx ttRqiAPO+CXXYSEap1GX+ja5wO619Cs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430538; 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=PZGSSzQYnTwqwkKB8Yyt6avqtEmbpcuPp0fGs8PrBic=; b=dnOhplmDfYUCx4aarOwYqhQASFFAn5qVMjYfNwl40uu0jd+vXIr787QE6jrrBiF+J1LfbX /e+UZBScojd0kqAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Chao Liu Subject: [PATCH v3 01/20] checkpatch: Fix checking of newlines in error messages Date: Mon, 14 Sep 2026 21:01:49 -0300 Message-ID: <20260915000209.3692668-2-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 9E7EA1FF21 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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email,suse.de:mid]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; 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: 1789430649747158500 Content-Type: text/plain; charset="utf-8" Using newlines in error messages is not allowed as per qapi/error.h documentation. Checkpatch has been enforcing this for the error.h API, but also for g_test_message() which doesn't fall under the qapi/error.h prescription. Using newlines in that function's format string is fine and can help with readability of test code when formatting test results. Note that g_test_message() 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. Reviewed-by: Markus Armbruster Signed-off-by: Fabiano Rosas --- scripts/checkpatch.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9838a64178..1e9499ed9b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3347,13 +3347,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)\s*\(.*\".*\\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:51:03 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=1789430665; cv=none; d=zohomail.com; s=zohoarc; b=Z7PLVnegLyOnmphT+pZ3GWMhXiuKRWezhVztX23Ckznrs0kx0n0gDkbBF6E2RZ3SPuk08hPR8FEa0CSNdtL8tbUGv7YofAjIjE5x1TFLRRNQJ/ldANRgqrrDyA6DpzSm1QGgQM99jGyGQgRoTkqsSujYfsB2P3F2la+ShiC0DHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430665; 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=GOpER+kyEWo8fW1URf1jlOhjhXIM/Qlj5C5S6Edhpm0=; b=i3tVPC1nQQ23k88KwYdwdXZV2cLivfY4u3pG+f6ULi6pL8JjHhm3N8qgXC5Iw9EtyBuskS1JAhHe9HNVfdvqu50McwUYjXvi7m+b6vynUI5kB/sWvgCv+3bnhNfkttk29hPIl+DkL0/rx/34u/YScJ+R5Y9mENLMRWBNMdaluH0= 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 1789430665642520.5541868556672; Mon, 14 Sep 2026 17:04:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Gd6-0003Kn-Bo; Mon, 14 Sep 2026 20:02:32 -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 1x6Gd5-0003KR-CB for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:31 -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 1x6Gd3-0004ma-Uy for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:31 -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 29F411FF46; Tue, 15 Sep 2026 00:02:20 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E119413515; Tue, 15 Sep 2026 00:02: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 Gk6xFQeLqGqIFAAAD6G6ig:T3 (envelope-from ); Tue, 15 Sep 2026 00:02:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430544; 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=GOpER+kyEWo8fW1URf1jlOhjhXIM/Qlj5C5S6Edhpm0=; b=Y57OUeC6WFaPCqauOF+2Ox0fvLjyAB+iWJiiDzXpwqLz/a9ALr/7/y17+uIMCStxh6qgA/ 4WA0271EnrIglA5t6U2BTuDeB5P0SAq3ODdeqfpMetTw07RXLcCB9gBpcDEB4ccFfRZ3qo mmvv0vBpOj8i6eAk4VkzT0Y7GppJu7U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430544; 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=GOpER+kyEWo8fW1URf1jlOhjhXIM/Qlj5C5S6Edhpm0=; b=n4xBdou0LHkcNBRWO4yujocc+jLddut8DzKnrSE67wRtnf/Ajgiet200lapZlWkoamNhXY IxIZ8USO4Wu2sgAg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=PZqEoMI+; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=QLC1NQ2m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430540; 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=GOpER+kyEWo8fW1URf1jlOhjhXIM/Qlj5C5S6Edhpm0=; b=PZqEoMI+r7+IXmrmmPxDlhtJ94N2V4aFz8svznAnc+hgqfnw3vYOKFbQszI1SSKY9L4tA0 6rYO6k9iKkiqs1yIuBqxUX/jsXHWLH0JRbU2qSkYu0PY00EGqMa+ikH8rV3kI5Tgx0ZMvo yNGRPH7SewcvkTVib4O9BK//f1seYuA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430540; 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=GOpER+kyEWo8fW1URf1jlOhjhXIM/Qlj5C5S6Edhpm0=; b=QLC1NQ2muEWGZ7ciFCm0qF2zZS3+HKkihg/YqVeocX9YpdHUXpa1871BZDiFPYLDQGdS30 Aty4UrLB3Y1cBNAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v3 02/20] migration/options.c: Don't export migrate_tls_opts_free Date: Mon, 14 Sep 2026 21:01:50 -0300 Message-ID: <20260915000209.3692668-3-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 29F411FF46 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)[]; 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)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; 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=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: 1789430667740158500 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 05b026f4bf..f4bba8ca26 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1063,7 +1063,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 b46221998a..c272eb6208 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:51:03 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=1789430565; cv=none; d=zohomail.com; s=zohoarc; b=J9fIlIShRJOXASjaJ/t2YljHFDa9GnIwN43e2/RI30WhYwyxOLXdeI5FzQA4Is4IsNxHyDvRssGd+jmNDSu09G6TxufWvLmz7XtwrpX0DW9TcvTLWWUSpzAXQa1MY9BMKQG+c99763r1KL1Uju07HvqjeQgOPAckx7FbP/Gss6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430565; 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=64Xq9U2HGefS91lpIZP3cCz+meKL3Vo4eC1IGiTJXI8=; b=Gf+ufvQdq4ldE1HnVtGPDpOwnESFHaMgJw5JRwU1XFiOT3lcO1wzC9iOFRH8oGvnF3xmNfhnCGG6TU5u43bQT+b0gUCUClrmGiqYAZ5Y+kKBD6mktDCyxvRPY3L2UOjceYaULv6VZRJcMpY+T+jsykpfRJuKtbHzwUA1guwz5T4= 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 1789430565277297.2186286811625; Mon, 14 Sep 2026 17:02:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Gd9-0003LH-6E; Mon, 14 Sep 2026 20:02:35 -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 1x6Gd6-0003L1-M7 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:32 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x6Gd5-0004mp-3n for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:32 -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 C19DE21E1F; Tue, 15 Sep 2026 00:02: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 6676B13707; Tue, 15 Sep 2026 00:02:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T4 (envelope-from ); Tue, 15 Sep 2026 00:02:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430545; 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=64Xq9U2HGefS91lpIZP3cCz+meKL3Vo4eC1IGiTJXI8=; b=1gcuG8OAi9KNlmt2JSuol3jwhqafxkauvF/sHwXLD+jFuWLEXLzu13E2SLszOquvOwUaWq lC7nGGTKd0TaSZ54rDdg/Y3UC3jbZxU2ORPUvORF57I/B8T3y8YuArQjjpt1hnC6E+1hkC 5Q8veHtwBBsoVZl9GPRrKbX2dPtFTTI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430545; 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=64Xq9U2HGefS91lpIZP3cCz+meKL3Vo4eC1IGiTJXI8=; b=MfbA4/8ybqfRr0IqBsIprkmSshwQItZTxKPzzYZ7NQYDHuSt81t2bwrhBF/0WcCpadnrKB u1a7AwQm/mcZO2Cw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430541; 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=64Xq9U2HGefS91lpIZP3cCz+meKL3Vo4eC1IGiTJXI8=; b=sMLQC5KQ6OtyQJwrq4MSU10KiCShlZMGIufXls9pL7ewbKAvRWI0t4sxRLKvofthvvbZ0Z Z+RwRCj2nhvpsv4ye9fjUketLc/n9v56EajobvRfyKqaZ6iD6UpYYlLF8e+KeFwy0ZiKFr gd6vUtiI1UtDE7pJz4TplxcadDrEgq4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430541; 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=64Xq9U2HGefS91lpIZP3cCz+meKL3Vo4eC1IGiTJXI8=; b=yXZ0ablE53evbSqR7AhiNOkDBOimCYdYFg9NZ/Jp2/F1/9UplHH7WyaWG4sr91zZ4JtGzb Gs45AzEMmCFf17AA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v3 03/20] migration: Rename variables in qmp_migrate_set_parameters Date: Mon, 14 Sep 2026 21:01:51 -0300 Message-ID: <20260915000209.3692668-4-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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)[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=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: 1789430569568158500 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 Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/options.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/options.c b/migration/options.c index f4bba8ca26..3ce15497f8 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1599,9 +1599,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 @@ -1611,18 +1611,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:51:03 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=1789430620; cv=none; d=zohomail.com; s=zohoarc; b=FVu8tySFLrvRKpnNlyOQdFsFGaQS4jP6c/agjehcagiXPJijpLkL4ABIWFqHiuSu3kW/zHpvtV5LhrQbSwnpeO2E+5pUO6C9TgjyNUkEEgdhYaOMXTycI1vLCV4kGN3YI9ZzMh6EH6ECRVjfEZOccjaExkywCRWsBFCSMcInDsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430620; 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=GwXWb79mzGxn+yao6OoforC5cOXb9F1bY7PW2RJHwQI=; b=GCzo7AW0Ds67fANFwRFi/Uk7b8ZC2iWPufXvf296bUnpBO5xwZtPoAOMVKvdngP1pmksdChZ1SpGXAUOFvJbRNfFN+FmckZXjeKDF67qcfRP9rIdOPbepQKp5XEhZTq7xsb4J1x1w6rQs3LW9FJ9i4h4e1sTDeJTNDld5wD123A= 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 1789430620666793.9418904228909; Mon, 14 Sep 2026 17:03:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdE-0003Lp-4M; Mon, 14 Sep 2026 20:02: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 1x6GdC-0003Lf-K0 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:38 -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 1x6Gd7-0004n1-11 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:34 -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 775E61FF47; Tue, 15 Sep 2026 00:02:23 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DFB4B13806; Tue, 15 Sep 2026 00:02: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 Gk6xFQeLqGqIFAAAD6G6ig:T5 (envelope-from ); Tue, 15 Sep 2026 00:02:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430547; 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=GwXWb79mzGxn+yao6OoforC5cOXb9F1bY7PW2RJHwQI=; b=iufeFopcIj51U2XGlUmKDSbSlCf14BIl9a7PKLbw2IJQP3OPc9JIUxf0XYdSxzbKos0Flq DPN1Zh/H1Afpip1Sh8xcI/MozSCK+YR4ACHavB7vCdJRnA/7LA+qM9xWgPjjEC6aKNws+r 6fr5w/R+KfBt6oCFEVj/TQy4MYqb6sY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430547; 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=GwXWb79mzGxn+yao6OoforC5cOXb9F1bY7PW2RJHwQI=; b=wk7nTq2MdiT3R/WA0rSSK/cO91rZ4lH346COoE3TmT6+r8MgQrH+G6FK4yOymDM1nVD3Jb bMm8uN8V43PHZGDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430543; 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=GwXWb79mzGxn+yao6OoforC5cOXb9F1bY7PW2RJHwQI=; b=dfcLP3k7C4p24I0NszObwVV+eN/GTLfLtrHZxmZI9i7ZJUR6OxTcRn/h8mnWigyqoF7p8W JZcGq/2gQ9kCcDyP7TdaeE7m1aUwvsKd1G5PlK6cz0Q/P467Jn1Uv2CzCl9vdOdKyDUdn0 S6rhw/VUOdJE0jY9QczID8YZamerhb4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430543; 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=GwXWb79mzGxn+yao6OoforC5cOXb9F1bY7PW2RJHwQI=; b=hHkmkVXNkQvRGMdUXZz0MYAdgsWqrJnbAXfj7IKc2eKjfrwIwSTeINebfT7ExqXL59Zd8l N2sIwPAYvC/kkJAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Prasad Pandit Subject: [PATCH v3 04/20] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Date: Mon, 14 Sep 2026 21:01:52 -0300 Message-ID: <20260915000209.3692668-5-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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.996]; 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_FIVE(0.00)[5]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,fedoraproject.org:email,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.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: 1789430624500158500 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 | 145 +++++--------------------------------------- 1 file changed, 14 insertions(+), 131 deletions(-) diff --git a/migration/options.c b/migration/options.c index 3ce15497f8..ac7e94ed62 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1168,6 +1168,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 /* @@ -1463,140 +1467,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); - } - - if (params->has_local) { - s->parameters.local =3D params->local; - } + 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) @@ -1618,7 +1501,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:51:03 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=1789430683; cv=none; d=zohomail.com; s=zohoarc; b=mP7fPValMiK1BscEtzdT080s/HftyhV3jUMiSlxQUMaQ5VjgZBsjGudyeJGbhvFjqPgz2yJHf2uqVzAA1hiZOB8nuhjovMbXK9qPXyGFQje+DDXNPUPq73yCkX1Pex2QthF4+k+rvp1VV0U2lTVge2v+upA+IOGSllbtJHku/Kg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430683; 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=FoTZXTyVtqGz0iA556+8eviVAzDVcXsSW1coLubitAE=; b=VSyMZyBQ2xOltYI5/twHxO8z5BLLamnXabPEBtXFFspjsU46UX4IhILbpS6JKHuNDxtFD/5YaMb37DJf90QC58L2kQWHk/1qNLS5QGOxtr6BroM5VDKXwSUP/onGUU1T130BszXfZ/McJ4g8NsMKI8ZNJGOg06YMgTAYoSRfPGc= 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 1789430683307300.5647535086149; Mon, 14 Sep 2026 17:04:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdH-0003Mi-HT; Mon, 14 Sep 2026 20:02: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 1x6GdE-0003MF-Kf for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:40 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x6GdC-0004nB-C8 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:40 -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 5C1401FF5B; Tue, 15 Sep 2026 00:02: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 9161B1388C; Tue, 15 Sep 2026 00:02:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T6 (envelope-from ); Tue, 15 Sep 2026 00:02:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430549; 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=FoTZXTyVtqGz0iA556+8eviVAzDVcXsSW1coLubitAE=; b=IlPRW35LtFJOu1PkikyahOUN/vW2smn4gUnnLJy4LSRSR50twzPtroJP3iCMIJ4slbUF/1 NMyLUJ8BY7ygyW3gtw+6keWv94eQEWrFrVIG4FcKQ/HxPLdy4d+hbSbwDRb3JLAjGIE2l0 SwUlf7YK+1tKfkht5rm+6Qrynx5Rx28= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430549; 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=FoTZXTyVtqGz0iA556+8eviVAzDVcXsSW1coLubitAE=; b=NyXbT0rbgoA+4+5erdb8EF7gUmTgareENfZdnA/yXzaNIC0OKIfV4ZsH7BV58E+Dm3APbx /xgiavjRfVm1stAQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430545; 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=FoTZXTyVtqGz0iA556+8eviVAzDVcXsSW1coLubitAE=; b=2XktEpYfu4+OIPCnBEKARfSKZ0N5CDsHFNWsYJzRefXI17FgWFm5RN0ZS0oDee3xNI8DQj VXnJMujtbkQ73MFGqGV6rZJIt/u5UWcADIJZaKiNYMqEXSQC/WqkwKxV0C+qzIWVzvnrJF m5NeLOf/XW6jLJa4lbpqYdIIHJt4AB4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430545; 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=FoTZXTyVtqGz0iA556+8eviVAzDVcXsSW1coLubitAE=; b=Jrmo2UsHP/Gcl29IO6k177oTKI2elA6Ni7UlE+fed4v6SVRwpOx4GYNJUtr8vU+kzrLD+P gDNYd4gj73Zai6BA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v3 05/20] migration: Merge parameter structs instead of assigning one by one Date: Mon, 14 Sep 2026 21:01:53 -0300 Message-ID: <20260915000209.3692668-6-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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.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: 1789430683916158500 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. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/options.c | 204 ++++++++++++++------------------------------ 1 file changed, 65 insertions(+), 139 deletions(-) diff --git a/migration/options.c b/migration/options.c index ac7e94ed62..0f7478aa6a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -21,6 +21,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" @@ -1082,6 +1085,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 @@ -1174,6 +1199,38 @@ static void migrate_post_update_params(MigrationPara= meters *new, Error **errp) } } =20 +static bool migrate_params_merge(MigrationParameters *base, + MigrationParameters *updates, + MigrationParameters **new, + Error **errp) +{ + g_autoptr(QDict) d_base =3D NULL; + g_autoptr(QDict) d_upd =3D NULL; + const QDictEntry *e; + + d_base =3D migrate_params_to_dict(base, errp); + if (!d_base) { + return false; + } + + d_upd =3D migrate_params_to_dict(updates, errp); + if (!d_upd) { + return false; + } + + for (e =3D qdict_first(d_upd); e; e =3D qdict_next(d_upd, e)) { + const char *key =3D qdict_entry_key(e); + QObject *value =3D qdict_entry_value(e); + + qobject_ref(value); + qdict_put_obj(d_base, key, value); + } + + *new =3D migrate_params_from_dict(d_base, errp); + + return !!*new; +} + /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. @@ -1336,137 +1393,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); - } - - if (params->has_local) { - dest->local =3D params->local; - } -} - /* * Caller must ensure the has_* fields of @params are true so they all * get copied and the pointer members don't dangle. @@ -1484,7 +1410,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 @@ -1498,14 +1425,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:51:03 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=1789430641; cv=none; d=zohomail.com; s=zohoarc; b=k4s6RKNhcvAIaVBKTtYeOY0Ni6/8hv7Yc63yl2kALwWNw6KTkmtVu/FN+gO9SfT+aVy8/QrYPeZ7fdDbNt0NZannyD3/LJk2goOBPpU4yEXyI9UGFmZtJpXH1MHPp7p/w6/H4m5bWSkcaje24DzgL4IGfZLpMw9eMDr2PbX8AQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430641; 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=ZXM6n2K9OZ73m3J3n6F63FRlHXCPIFdAsdyaQqGrOOw=; b=l6up+hCNEfBz+nNdNJR7QqsYh0ewtgXD+Fi978f3H9pB9cM627LUWeuvJL/VCd8m/mDFZsnZAz/x6BT49+HzK8N+dYHw5RO5LGtrxm3j3NCMapkiuZJMYWrtqc99a9Zh3sdLVIWhEyhu+vI08wpXk89/IWjFXqW6Zaw3SJpggW4= 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 1789430640968778.2658323645743; Mon, 14 Sep 2026 17:04:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdG-0003Me-47; Mon, 14 Sep 2026 20:02:42 -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 1x6GdE-0003Lo-1V for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:40 -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 1x6GdC-0004nI-CZ for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:39 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9CD2321AC3; Tue, 15 Sep 2026 00:02:26 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 16A7D13890; Tue, 15 Sep 2026 00:02: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 Gk6xFQeLqGqIFAAAD6G6ig:T7 (envelope-from ); Tue, 15 Sep 2026 00:02:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430550; 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=ZXM6n2K9OZ73m3J3n6F63FRlHXCPIFdAsdyaQqGrOOw=; b=1dcSkHKisVobBYe55AubaErMAESNopDPch2YGIN9GHx+TZ6c+kSaTf5tMcajeoPn0xRCsl lhbBNq7G5vdOd61KqyR/dKpoxpcXPuoMCZ37+O9mM+weWbDgscXxWO5LcTp0NjWvl88tMm 4l7KrEqm5KuYhB6QtfKRpjYYPakeSWM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430550; 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=ZXM6n2K9OZ73m3J3n6F63FRlHXCPIFdAsdyaQqGrOOw=; b=28Ar3fxG7OL1Gnl8oVRwLfQCDeaglq302Kg++1omlzwVKgKk6WUROp5kFqstYRIkUinyYc pSiA3WGMXg+1SaAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ceESdqM+; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=MaX2V7fl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430546; 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=ZXM6n2K9OZ73m3J3n6F63FRlHXCPIFdAsdyaQqGrOOw=; b=ceESdqM+9apXYVGGnp6GpfBu4CY9c4S74tu4ingJ3O+ITV+24vCpzgoedZeHJjOmFtVltG bKmQ5hppLG1eAE9qqAXFa1xHNGP3IlK7p/FlZE182KNQUVIhjogY4rGSZ82rrYxVGOuEnT e4bnSd5fXvSvSXby9saQkax4dhQXxgQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430546; 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=ZXM6n2K9OZ73m3J3n6F63FRlHXCPIFdAsdyaQqGrOOw=; b=MaX2V7fl8EYmwOoYh+KC7SVRt+3RJXl+A83efEO6t/5ASBHwdU3xI7kExzxB8+rB/zi/h9 cw7F5oWrcbf/hVBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Prasad Pandit Subject: [PATCH v3 06/20] migration: Open code migrate_params_apply Date: Mon, 14 Sep 2026 21:01:54 -0300 Message-ID: <20260915000209.3692668-7-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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: 9CD2321AC3 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; 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: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: 1789430644248158500 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 0f7478aa6a..12f884caa4 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1393,21 +1393,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; @@ -1430,8 +1415,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:51:03 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=1789430655; cv=none; d=zohomail.com; s=zohoarc; b=Ww7xgCIOgAzkt9xu4fUJVbwnWzB53QkJhJ4B/2GLNIBue7lvCJC1sOlEp6eahufW0O3eIIM4WupwKii1D/sGSzmWP9LLN2VFsljHMLt+lrL2vRJJvb584oky/zVzNY0Vk/Od0795UBuxTPdvlYtI1AKBKbTcMGU7FDyY/WuvQ1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430655; 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=1hTM0ZCY7OaihXhzw/hVe+idx+ErDM+z3nHvYLW4FaQ=; b=FQnHf7b0eOJ/A5Pl6EelHqn5h3HkuL3k7BDYzjjmSVVqxDuPrP6Gty9hov/tweHhExcYYWJxarmXGL/LGwL1IyVVgGTqZkVcsCSj06nqPS+LtYfmgEp/Jr5bYUQk+sFjw+i6gI3UJbxBHHikZiZ0/0EtpMDQmBTjr7+hVuwOBZ8= 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 1789430655334280.75412938510954; Mon, 14 Sep 2026 17:04:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdH-0003Mp-KP; Mon, 14 Sep 2026 20:02: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 1x6GdF-0003MQ-9n for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:41 -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 1x6GdC-0004nQ-D0 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:41 -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 0325521E1B; Tue, 15 Sep 2026 00:02: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 BE75E136D9; Tue, 15 Sep 2026 00:02:26 +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 Gk6xFQeLqGqIFAAAD6G6ig:T8 (envelope-from ); Tue, 15 Sep 2026 00:02:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430552; 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=1hTM0ZCY7OaihXhzw/hVe+idx+ErDM+z3nHvYLW4FaQ=; b=nf7wQNyq3UqBF6m9Pie/kZdfFrsyG6KlPorL/bivEKpJYc6JHKjzh8+dLSdhfMHCDFGEcR LEb/aV/4OE66lN6wiD6f8ojDdnj6mYdvZo93pV/3V5S7/NCKw6f2SLL+rGHvwhBpHDdk9B oyqqdMOUede0lR45ISx9TspQRM/MNi0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430552; 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=1hTM0ZCY7OaihXhzw/hVe+idx+ErDM+z3nHvYLW4FaQ=; b=GRyOJ+wjlJHGu+vKxWsq3Y8JdolzkMtW2Abz4WeEOownJcrqKUY/w49L5t1WsH5yTZyoy4 D7lHUEGfUyUkHXAQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=CZq2GGQK; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=4OS7TYoH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430548; 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=1hTM0ZCY7OaihXhzw/hVe+idx+ErDM+z3nHvYLW4FaQ=; b=CZq2GGQKV1vcyQwDdfrDZLJGVHGwXFAYkcZ8SCCqGUw1i3QjQ8ZiUw3+bI91B85i/afAbh Ufy75tKqBcreAWBRZwFf3rfkAL+BpN5kelXK/RFMsmq6mi6kNSUBnJRgCfcBUnkV1utZ+7 9H7Vxd3tkDTRzBXr3Y1l8DktmO61f+w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430548; 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=1hTM0ZCY7OaihXhzw/hVe+idx+ErDM+z3nHvYLW4FaQ=; b=4OS7TYoHUsa11P4ecXBVZmtO9bBL/yVz2VVxZFApYixsmSuk4s7+CdjqAOd4qorY0HSr2B 4MWR/uJoYz0Z73Bg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v3 07/20] migration: Stop freeing s->parameters members individually Date: Mon, 14 Sep 2026 21:01:55 -0300 Message-ID: <20260915000209.3692668-8-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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: 0325521E1B 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: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)[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: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: 1789430655669158500 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 12f884caa4..bdcff002db 100644 --- a/migration/options.c +++ b/migration/options.c @@ -17,6 +17,7 @@ #include "qapi/util.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" @@ -1066,11 +1067,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 "" */ @@ -1419,9 +1430,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:51:03 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=1789430582; cv=none; d=zohomail.com; s=zohoarc; b=bZbO9VXMiOSng+69Zo6RonSyML1TQ6/ijDAfKOmkD1Qh28A0oYUc/fu0fOGy7+lgYFIc64n97eZmMqNfPm/DOEpoDPzyoHhftgowsd50GDAU9XiXR/UHUW9xV+VCe1kJCieWVxcCsMu5XOgPR8X0bpDLZt2XOWHgV7hgaykU614= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430582; 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=HKs/esBlOFAbBPmBNeIq0MYqcwqzt+NV/Ybw4pONbyc=; b=XfXHcOSFDNQWoU7BY7RNk+LAZmmNgLFLeO4mHhmY7iQSDINRAl01tWiARZeaj6IPHqCKZ5nqgrxt/ktdCe7efwFzZS3wPcxyvhcQPzGbCxuewMtlCrQ3U1+OwaA79eImewPnSyu+5oGv+6p+9o8F2IPGpsOCOgtEfIl1PoAAgSk= 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 178943058231120.723908310256775; Mon, 14 Sep 2026 17:03:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdJ-0003Pd-45; Mon, 14 Sep 2026 20:02:45 -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 1x6GdF-0003MR-H7 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:41 -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 1x6GdC-0004nY-ST for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:41 -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 7FEA021E24; Tue, 15 Sep 2026 00:02:29 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 46D6413710; Tue, 15 Sep 2026 00:02: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 Gk6xFQeLqGqIFAAAD6G6ig:T9 (envelope-from ); Tue, 15 Sep 2026 00:02:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430553; 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=HKs/esBlOFAbBPmBNeIq0MYqcwqzt+NV/Ybw4pONbyc=; b=ZODmR7iM7UXcHzCUwSUyCuVZBd7TDQ06H8wvCYAkIPhzIR1fs1S3RYW5bfVwu0A1rA/H5b fP/swk2pOFf+eTJe1SS9WgCYRcp6T+XBz2R2k5CKze4000fniK3pCyMl1FU2j534gUd21m o63EGWpFOeHOM/u+cw7Oz+rKPQLHRU4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430553; 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=HKs/esBlOFAbBPmBNeIq0MYqcwqzt+NV/Ybw4pONbyc=; b=Fw+6aLNf1SsJZIzPZIU8asbXpeUsnIAjERpuUFJFCe0ggfZGHcLOs7dM/MPpnbhN8Pv/1f JoZJhOefPPlmSbDg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=a6JsQcfa; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="g/vgvS74" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430549; 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=HKs/esBlOFAbBPmBNeIq0MYqcwqzt+NV/Ybw4pONbyc=; b=a6JsQcfab4aw9LbBMzajbyVuyu8e8ilbrdr6G4mXdKVB6tbXBnvWUSBvTlRmo/81zYIb9x ZeA7ogCUbLEo110d2orJDQeBYIpiYLceRdoX7wlnqRL9+d9yZZ1w24OkTs9R88TajOg0Bv Z+RL3gnEf0olaUcjq+wgLa7ASjSVZT4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430549; 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=HKs/esBlOFAbBPmBNeIq0MYqcwqzt+NV/Ybw4pONbyc=; b=g/vgvS74cKjT+xH/TClJPThl/tGijyvNqtGHKFp1JV0qdSDkYrXiKWJjU1ftbdxpaqrMEt 6t9aOJZh1Baf47CA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v3 08/20] migration: Use migrate_params_free during finalize Date: Mon, 14 Sep 2026 21:01:56 -0300 Message-ID: <20260915000209.3692668-9-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 7FEA021E24 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)[]; TO_DN_SOME(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[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:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; 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: 1789430583472158500 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 d14beb5d22..fab7949fe1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4052,8 +4052,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 bdcff002db..46d040fc3f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -273,8 +273,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) @@ -1067,7 +1068,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 c272eb6208..c7da2d0b5b 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:51:03 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=1789430691; cv=none; d=zohomail.com; s=zohoarc; b=QSI+bcdvu3Ryy8dpGnlo0rv8G7uZTyIjk/UPn4ravoLj2bKYivIFTPyA5o8I1QrUAtnvKklYOBA11uGTg4XpG+MVzzFW0037fkp5n/IeL+h08WplX1YZLXMp1kXFHzHQdajCQwpSmXoAjkw8wuagP6eAkclSx8ecJLsO9m3Xp8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430691; 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=T3S3wN8DiNwmev4ttv0k4VFYP+B990uqd2JDxzXQS3M=; b=K1IlS6aFj0d49QmiNZ/RGGIgWO9vZRGBAF3V2f8zn4aUs+VyGf6S7fxrq+7FBJOzYevAzL6RchS2A6x7gonu3vFTpkaaM2rRcz4kNEVSnmI3zeLJ+2TjGP6wn65u9v3zvGoIRen+wyp6rBGMefJM044gNojBG2i+qM7WfAPZ3Ng= 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 1789430690993458.04485508191976; Mon, 14 Sep 2026 17:04:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdN-0003Qy-47; Mon, 14 Sep 2026 20:02:49 -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 1x6GdG-0003Mh-Qw for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:42 -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 1x6GdE-0004np-Qf for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02: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-out2.suse.de (Postfix) with ESMTPS id 5F1971FF46; Tue, 15 Sep 2026 00:02:31 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C054513515; Tue, 15 Sep 2026 00:02:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T10 (envelope-from ); Tue, 15 Sep 2026 00:02:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430555; 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=T3S3wN8DiNwmev4ttv0k4VFYP+B990uqd2JDxzXQS3M=; b=zsnC574RKx5Bqo6mUBfkUsB/JFl7WdZ3+83C/gXk5xpGng4NMdc3ZkO7BdeINZXBi1AbWE rN+TM9+AOGsbeesfbBuYIek7PvNk37x7Dv+Un3VGtT0rhhsABfXMpelBC8H1PqiBt0Nj5/ apzOQu+0N1fVFFhj9T8IiwWqDI8fKyM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430555; 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=T3S3wN8DiNwmev4ttv0k4VFYP+B990uqd2JDxzXQS3M=; b=H4pI9E99Yw8xpKft/bwELD4YjGiwo+W+1COdQi/ZCWEQJ221KYMlkbfDKSPEfQYCTX78F4 n2bhcyM3f10xpqCA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430551; 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=T3S3wN8DiNwmev4ttv0k4VFYP+B990uqd2JDxzXQS3M=; b=wNEpbOwMdyV5W/bu7Cc1fAiHLY0OLP+OxvcvQO8eDDawTJds9mzm4kTAx8e8sNjpoAz6Pl 1W3+NmRvfc7vSVARetI6V2ZmaHuo5SCM+d9CSMIHaMbl11pMx6OX7Z6VDGmCnQKA2xIUoE Ic9SexISAVroYHf29tdpXk4Md5vf3wg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430551; 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=T3S3wN8DiNwmev4ttv0k4VFYP+B990uqd2JDxzXQS3M=; b=E7Zu30cZVlEY6UxBDTAovbTkRz6O4ehtaC3/YnTAwxaO0rBQ/dPa6lSosJPrN5Ui2Eqg3l LxuyNAnQGbQZHkDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 09/20] tests/qtest/migration: Add a test for HMP Date: Mon, 14 Sep 2026 21:01:57 -0300 Message-ID: <20260915000209.3692668-10-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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_FIVE(0.00)[6]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,treblig.org:email,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=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: 1789430691942158500 Content-Type: text/plain; charset="utf-8" The following patches will change how parameters are set and shown in HMP, add a test for it. The test issues 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, which helps find the failing test in the list) Usage: QTEST_QEMU_BINARY=3D./qemu-system-x86_64 \ ./tests/qtest/migration-test --full -p /x86_64/migration/hmp/parameters Acked-by: Peter Xu Acked-by: Dr. David Alan Gilbert Signed-off-by: Fabiano Rosas --- tests/qtest/migration/misc-tests.c | 200 +++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 4e0deb7f18..02469a92ff 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -22,6 +22,202 @@ =20 static char *tmpfs; =20 +#ifdef CONFIG_HMP +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, } + +typedef struct HMPTestData { + const char *input1; + const char *input2; + const char *output1; + bool skip; + int line; +} HMPTestData; + +/* + * Find a contiguous run of tokens in @larger that match the sequence + * of tokens in @smaller, ignoring mismatches due to sequences of + * empty tokens. + * + * Returns whether a match was found. @last is set if at least one + * token has matched. + */ +static bool token_list_is_substr(char **smaller, char **larger, int *last) +{ + int i, j, k =3D 0; + bool match =3D false; + + for (i =3D 0; smaller[i]; i++) { + for (j =3D k; larger[j]; j++) { + if (!*larger[j]) { + continue; + } + + /* readline adds several escape sequences */ + if (*larger[j] =3D=3D '\033') { + continue; + } + + if (g_str_equal(larger[j], smaller[i])) { + match =3D true; + *last =3D j; + k =3D j + 1; + break; + } + + if (match) { + return false; + } else { + match =3D false; + } + } + } + + return match; +} + +static void assert_hmp_match_line(const char *str, const char *text) +{ + g_auto(GStrv) tok_str =3D g_strsplit_set(str, " ", -1); + g_auto(GStrv) lines =3D g_strsplit_set(text, " \r\n", -1); + int i, idx =3D 0; + + /* + * Note that the reason the 'str' above is split is to allow + * token_list_is_substr() to first match on the parameter name so + * matching can stop immediately after a mismatched value is + * found. This provides a better output for failing test cases + * than simply "str !=3D line". + */ + + for (i =3D 0; lines[i]; i++) { + if (token_list_is_substr(tok_str, (char **)&lines[i], &idx)) { + return; + } + + if (idx) { + break; + } + } + + g_test_message("HMP output mismatch for entry at line %d:", test_case_= line); + g_test_message("expected vs. found:\n\n%s\n---\n%s %s", str, lines[idx= ], + lines[idx + 1]); + 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; + /* + * .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"), + TEST("local", "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/second"), + 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"), + }; + + /* 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_line(t->output1, resp); + 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(line, resp); + } + + qtest_quit(qts); +} +#endif /* CONFIG_HMP */ + static void test_baddest(char *name, MigrateCommon *args) { QTestState *from, *to; @@ -260,4 +456,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); +#ifdef CONFIG_HMP + migration_test_add("/migration/hmp/parameters", + test_hmp_migration_parameters); +#endif } --=20 2.53.0 From nobody Sat Sep 26 20:51:03 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=1789430688; cv=none; d=zohomail.com; s=zohoarc; b=DvYngbVsevEn5tBfTNn/NPaHfpB1mHdqAJsmzVXYozcnVQ52BWtAJY7MPJSKWK33wSpXAtGmlYsdNsYtPg2+7tRQ6o9hlXT6qrrbt4TNBHh7YSCJ/JJ+dx9BewAXTjj2F6JJN63FPpvmI9GIMktHvisfYd53H4FEtrDtj5k3tZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430688; 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=LQmGuUieg9ntOwCpKHX+vOejYK8gcY82r1qb8o5gXG8=; b=Hq/1coZ2a143vvZzO1qbz0/RCwKf+gS5wklHabqXUVqUtggKxepj3uHLoZcU7/lzreAXBZznYd4nA5AESpQy6qPmj8l7SSRK6LL1Lqrzzaf+eRc8P2HC3ZhLnYZcpwUKcYiKC68WYVb+AUkl+aJpstjgGEFLh84/M+aMvoljbDI= 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 1789430688778463.05396995212425; Mon, 14 Sep 2026 17:04:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdO-0003Rb-21; Mon, 14 Sep 2026 20:02:50 -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 1x6GdI-0003PH-W6 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:45 -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 1x6GdG-0004oC-JE for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:44 -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 3EA7D1FF5F; Tue, 15 Sep 2026 00:02:33 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9EE6613707; Tue, 15 Sep 2026 00:02:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T11 (envelope-from ); Tue, 15 Sep 2026 00:02:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430557; 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=LQmGuUieg9ntOwCpKHX+vOejYK8gcY82r1qb8o5gXG8=; b=BMKRxTnMjIqfcO/ahpGQRCA6UXj9W8+Wz4c7YXSffTVaGxaDMJ7KXmuQW//HK3UWmuxTde uuMrEIX6n4yaCYlRi5Z6Shho022gBzaVlK5aA0fdryJOda1fvaho2+AurplnrVSxAbYtVG 0oB5T1k0hKlidGwFlsWU++q2w+qwOmw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430557; 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=LQmGuUieg9ntOwCpKHX+vOejYK8gcY82r1qb8o5gXG8=; b=6t9FBqtaHJGGHa0WWCPZ4W+eCajJhzuAj27AywH90rbkKBIzgshg6bnK1gITft880Pw8Ex OxSv763IavZXI4DA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=zGgYJNlD; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ESC9ixaj DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430553; 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=LQmGuUieg9ntOwCpKHX+vOejYK8gcY82r1qb8o5gXG8=; b=zGgYJNlDvUFmacOT5w0ZqiPgzM7Ssc+vVK+MibTkGLGI+KiuV2DBdgZ6zKIN+dXbkbPv8X Vn4QsmNeH2XqTqha5ziJr3e0+GALxvAK06L1uhZjN/AG5Fwvv4fulvoxxRVdjf/s8pakqr WzOG4zsR+FOk9eh52KIB5oC/jbsyxmE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430553; 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=LQmGuUieg9ntOwCpKHX+vOejYK8gcY82r1qb8o5gXG8=; b=ESC9ixajnN74lNVCVstYRUduxyQ6HrRLvcfGHSCrpdo1qIr1wi/LMIyqd1E1C6EPBoIDV1 2CquaNeLdK52CmBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 10/20] tests/qtest/migration: Add a test for HMP completion Date: Mon, 14 Sep 2026 21:01:58 -0300 Message-ID: <20260915000209.3692668-11-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 3EA7D1FF5F 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)[]; TO_DN_SOME(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email,suse.de:mid]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; 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: 1789430689921158500 Content-Type: text/plain; charset="utf-8" The following patches will touch HMP readline completion for migration parameters, add a test case. 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/completion Acked-by: Peter Xu Signed-off-by: Fabiano Rosas --- tests/qtest/migration/misc-tests.c | 216 +++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 02469a92ff..41bf123359 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -11,6 +11,8 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" +#include "qemu/sockets.h" #include "qapi/error.h" #include "qobject/qjson.h" #include "libqtest.h" @@ -78,6 +80,22 @@ static bool token_list_is_substr(char **smaller, char **= larger, int *last) return match; } =20 +static void assert_hmp_match_text(const char *str, const char *text) +{ + g_auto(GStrv) tok_str =3D g_strsplit_set(str, " ", -1); + g_auto(GStrv) tok_txt =3D g_strsplit_set(text, " \r\n", -1); + int idx; + + if (token_list_is_substr(tok_str, tok_txt, &idx)) { + return; + } + + g_test_message("HMP output mismatch for entry at line %d:", test_case_= line); + g_test_message("expected vs. found (whitespace ignored):\n\n%s\n---\n%= s", + str, text); + g_assert_not_reached(); +} + static void assert_hmp_match_line(const char *str, const char *text) { g_auto(GStrv) tok_str =3D g_strsplit_set(str, " ", -1); @@ -216,6 +234,202 @@ static void test_hmp_migration_parameters(char *name,= MigrateCommon *args) =20 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; + + /* stop reading after the next prompt appears */ + prompt =3D strstr(buf, "(qemu) "); + if (prompt) { + *prompt =3D '\0'; + break; + } + } +} + +static gint comp(gconstpointer a, gconstpointer b) +{ + return qemu_pstrcmp0((const char **)a, (const char **)b); +} + +static char *get_migration_opts_sorted(QTestState *qts, const char *opt) +{ + GPtrArray *header =3D g_ptr_array_new_with_free_func(g_free); + GPtrArray *opts =3D g_ptr_array_new(); + char *sorted_str; + + if (g_str_equal(opt, "@params@")) { + const QDictEntry *e; + QDict *rsp; + + g_ptr_array_add(header, g_strdup("migrate_set_parameter")); + + rsp =3D qtest_qmp_assert_success_ref( + qts, "{ 'execute': 'query-migrate-parameters' }"); + + for (e =3D qdict_first(rsp); e; e =3D qdict_next(rsp, e)) { + g_ptr_array_add(opts, g_strdup(qdict_entry_key(e))); + } + + qobject_unref(rsp); + + /* + * query_migrate has this as optional, but for completion we want + * it present. + */ + g_ptr_array_add(opts, g_strdup("block-bitmap-mapping")); + + } else if (g_str_equal(opt, "@caps@")) { + int i; + + g_ptr_array_add(header, g_strdup("migrate_set_capability")); + + for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { + g_ptr_array_add(opts, + g_strdup(MigrationCapability_lookup.array[i])); + } + } else { + g_assert_not_reached(); + } + + g_ptr_array_sort(opts, comp); + g_ptr_array_extend_and_steal(header, opts); + + g_ptr_array_add(header, NULL); + sorted_str =3D g_strjoinv(" ", (char **)header->pdata); + + g_ptr_array_unref(header); + + return sorted_str; +} + +static void hmp_completion_single(QTestState *qts, int fd, + const struct HMPTestData *t) +{ + g_autofree char *exp =3D NULL; + char buf[8192]; + char *output; + + test_case_line =3D t->line; + + if (g_str_has_prefix(t->output1, "@")) { + exp =3D get_migration_opts_sorted(qts, t->output1); + } else { + exp =3D g_strdup(t->output1); + } + + hmp_sock_write(fd, t->input1); + hmp_sock_read(fd, 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_text(exp, output); + + /* ^U backward kill line */ + hmp_sock_write(fd, "\x15"); +} + +static void test_hmp_completion(char *name, MigrateCommon *args) +{ + g_autofree char *cmdline; + char buf[1024]; + QTestState *qts; + int sockfds[2]; + /* + * .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. + * .output1: 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"), + + TEST("migrate_se\t", + "migrate_set_", + "migrate_set_capability migrate_set_parameter"), + + /* + * parameters and capabilities are not listed here to avoid having + * to enumerate them all, see test_hmp_completion(). + */ + TEST("migrate_set_parameter \t", "migrate_set_parameter ", "@param= s@"), + TEST("migrate_set_capability \t", "migrate_set_capability ", "@cap= s@"), + }; + + 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++) { + hmp_completion_single(qts, sockfds[0], &completion_cases[i]); + } + + close(sockfds[0]); + qtest_quit(qts); +} #endif /* CONFIG_HMP */ =20 static void test_baddest(char *name, MigrateCommon *args) @@ -459,5 +673,7 @@ void migration_test_add_misc(MigrationTestEnv *env) #ifdef CONFIG_HMP migration_test_add("/migration/hmp/parameters", test_hmp_migration_parameters); + migration_test_add("/migration/hmp/completion", + test_hmp_completion); #endif } --=20 2.53.0 From nobody Sat Sep 26 20:51:03 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=1789430691; cv=none; d=zohomail.com; s=zohoarc; b=JIUAbD0kW5wfqZ+gl+PfJDe9lzHQipJZr3XC/lkgFXDKyc9DerjApjCqRzMxtHOfg38h5ipU6oJjgqMRE/1D6/VMMm23dBOK/KTqrCgvGXlCYOktTGKrnPkQAyjR8AUozUPpJtfay9IgY0QbpnfLKs20sHFUTKehNvC7BDnGynw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430691; 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=myFIaXNmvl469O/7W29LW3v/i9d5K9UTEqiLSqTboW0=; b=laVY77tdjbACLokrb8hJ4q2VlxIH4mOol5Z8R50ukpEEeg/DsDKeT6zwHa9CL6BpGo7/l4T8+w6nF0V9LBiAM7O8v9ql3wCaMFApEnptIqIb2Hn4/ZF6COgrnEvmqRmLQQQGEjZVoDvY6YUQqutIURxHcubEBWBp+noGlqdTGBk= 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 1789430691689739.8150482764144; Mon, 14 Sep 2026 17:04:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdO-0003Re-Fc; Mon, 14 Sep 2026 20:02:50 -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 1x6GdN-0003R3-BK for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:49 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x6GdI-0004oQ-I1 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:46 -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 1D9951FF68; Tue, 15 Sep 2026 00:02:35 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7E36F13806; Tue, 15 Sep 2026 00:02:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T12 (envelope-from ); Tue, 15 Sep 2026 00:02:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430559; 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=myFIaXNmvl469O/7W29LW3v/i9d5K9UTEqiLSqTboW0=; b=oftlW7OfUSqLC8cH7/6VpEnaJuUJFaMAwrFwIVlLGtCRmewchrGVAZ06VVdS1cTJer9n/4 D5yk5w4wzl5+Xj+AD4vWxCcuGYx+r+8otGOQzTOe7/gLU22dG4x6X7XlUvow3H8gqLt1Xr nOrk2ZhEWNsH7rwKL++MYTElKqwiyU0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430559; 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=myFIaXNmvl469O/7W29LW3v/i9d5K9UTEqiLSqTboW0=; b=GpR9h+wX4dVl50yq9Ys+hBg8mMDbEhYgEmFKG4ThnVJbWqvlCpSmT5h2wikiUQ9uoJNTyD ezQs61a6Yd9OefCQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=hUh9aCCc; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9mLm32Il DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430555; 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=myFIaXNmvl469O/7W29LW3v/i9d5K9UTEqiLSqTboW0=; b=hUh9aCCcyr1Gp1GeobYiBtKTAdafdwFfgXcZkQKhkN4gKxX636KCMQFD5Kd6IkbG9fL0y6 Xstps2zUHyjCb0vtBkLQ2deXJ8vRENPhq0UUd8847w7zLroqkmLOhWBAnAHNDT+Jp/KkLL kKkWkFbWWXjibAA7OcjLib+4yEO2jV4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430555; 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=myFIaXNmvl469O/7W29LW3v/i9d5K9UTEqiLSqTboW0=; b=9mLm32Ilcq5tLjgYbZCB2TYxOzRwsGyJ2uf/OvcRK5poSVzWTrWuciAsUS7j9Za+0qjgA8 Bx2+XvxJj93DeBBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 11/20] migration: HMP: Change bandwidth parameters expected input unit Date: Mon, 14 Sep 2026 21:01:59 -0300 Message-ID: <20260915000209.3692668-12-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 1D9951FF68 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)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[treblig.org:email,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)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; 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=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: 1789430693947158500 Content-Type: text/plain; charset="utf-8" The max-bandwidth and avail-switchover-bandwidth parameters are declared as bytes/second in migration.json and interpreted as such throughout the code, except in HMP input where they're expected to be provided as mebibytes. Adjust the HMP code to take the values as bytes to make it uniform. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 23 +++-------------------- tests/qtest/migration/misc-tests.c | 5 ++--- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 27b38d0e5f..67ea2eea15 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -596,10 +596,9 @@ void hmp_migrate_set_parameter(MonitorHMP *hmp, const = QDict *qdict) 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 val; =20 val =3D qapi_enum_parse(&MigrationParameter_lookup, param, -1, &err); if (val < 0) { @@ -644,27 +643,11 @@ void hmp_migrate_set_parameter(MonitorHMP *hmp, const= QDict *qdict) break; case MIGRATION_PARAMETER_MAX_BANDWIDTH: p->has_max_bandwidth =3D true; - /* - * Can't use visit_type_size() here, because it - * defaults to Bytes rather than Mebibytes. - */ - 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; - } - p->max_bandwidth =3D valuebw; + visit_type_size(v, param, &p->max_bandwidth, &err); break; case MIGRATION_PARAMETER_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; - } - p->avail_switchover_bandwidth =3D valuebw; + visit_type_size(v, param, &p->avail_switchover_bandwidth, &err); break; case MIGRATION_PARAMETER_DOWNTIME_LIMIT: p->has_downtime_limit =3D true; diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 41bf123359..f70d35c658 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -161,9 +161,8 @@ static void test_hmp_migration_parameters(char *name, M= igrateCommon *args) TEST("announce-rounds", "6", "6"), TEST("announce-step", "15", "15 ms"), TEST("downtime-limit", "400", "400 ms"), - TEST("avail-switchover-bandwidth", "2097152", - "2199023255552 bytes/second"), - TEST("max-bandwidth", "9876543", "10356305952768 bytes/second"), + TEST("avail-switchover-bandwidth", "2097152", "2097152 bytes/secon= d"), + TEST("max-bandwidth", "9876543", "9876543 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"), --=20 2.53.0 From nobody Sat Sep 26 20:51:03 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=1789430692; cv=none; d=zohomail.com; s=zohoarc; b=OYn5PFWJYsjDZEsbU2/Vw0TPY1FZhmrE81VNEAxyO+OduXW/YCbK45Z+EHSsZBkoeiWzabCUoMkWbT51Uh0lK03l+5zNXgp5gOlkayMO+cknY2sAT0mzJjo3t61BPOP9HJgo7usz/Ro7Risq342q0ZUkIXr74emtxOkBhX7acJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430692; 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=/DXE/id4ugWtIjlNn1UpgWZV0qHUesD6Nhy/EQlO1CQ=; b=awY1S976rGnsbLiQG9CCXPMrG9U1VntXp5YELgwY4dWxpz5YXUYS1KoaLDH/H5VXspbk61rvPtox9B4TYIrMe1g0THeiMQSVmZRbonSBMwNyv8xSSwokYV54J+rrNIc4t13ACBiymYTrLz6FRl8vqyG5JV6vft/GDjc8YMsnGrU= 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 1789430692162440.87789384621806; Mon, 14 Sep 2026 17:04:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdV-0003lt-2R; Mon, 14 Sep 2026 20:02:57 -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 1x6GdR-0003Xh-1k for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:53 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x6GdN-0004oh-3t for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:52 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5B3A31FF6B; Tue, 15 Sep 2026 00:02:37 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 621681388C; Tue, 15 Sep 2026 00:02:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T13 (envelope-from ); Tue, 15 Sep 2026 00:02:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430561; 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=/DXE/id4ugWtIjlNn1UpgWZV0qHUesD6Nhy/EQlO1CQ=; b=SLeihxUKlYsRmRJ2qXR+ocM1fBH3IiywmIPU0QMSUm92pKYi/cPoaJ/MBhMKydS9a1OAJw ia9I08XRoMm7brVNDQ4axaZFA0Ii9UhUa4ShGgoLX8wgtknFuKerv200+9iamHf+mR+9DL hxsbLgLMaZt28MUYmg2zqwy0vic4VLs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430561; 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=/DXE/id4ugWtIjlNn1UpgWZV0qHUesD6Nhy/EQlO1CQ=; b=zdU/01hAk/ZLw8E2gf6t3wRDzunX2SkBzGX/SGhsevfI2guWM1T8YcG2zX39H3keNqOzUz zT3TvtAdu5I66mDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="R/11tr+z"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=mo+OwUD5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430557; 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=/DXE/id4ugWtIjlNn1UpgWZV0qHUesD6Nhy/EQlO1CQ=; b=R/11tr+zxzRr0C4BwooG5B8TnA2AZImOMrVrsSxPTc5JDEZlB0j9FmSfVikSxawwtefamo 3mmitS6+JhS4fxl7m8l1c//aBp4DINBTsgYx952UY2ZUSnk2yMpJfJPJkZNnQhrHXMgyxD zmOUz/seHdpgPpqVjA9otNwY6bkWwUI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430557; 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=/DXE/id4ugWtIjlNn1UpgWZV0qHUesD6Nhy/EQlO1CQ=; b=mo+OwUD51MvwurgdO8R0TW14RM7QY+rWpA8JlcER1qwMPFaHD2vT6a2WYjXcBy1vYCYUWa KVOG9w+qNzzWezCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Kevin Wolf , Hanna Reitz , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 12/20] migration: Change HMP 'info migrate_parameters' output Date: Mon, 14 Sep 2026 21:02:00 -0300 Message-ID: <20260915000209.3692668-13-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 5B3A31FF6B 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)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DNSWL_BLOCKED(0.00)[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)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email,suse.de:mid]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; 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=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: 1789430694066158500 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. However, having the units also means that every parameter must have its own separate piece of code to handle the formatting. From a development and maintenance perspective, having a list of parameters explicitly written in several parts of the code brings annoyances: conflicts during rebase, extra hits when grepping, contributors need to mirror a change to various locations, etc. As the HMP output is not part of any ABI, remove the units from the output to avoid this requirement of having individualized code for every parameter. Next patches will take benefit from that and use generic code to output the parameters values in HMP. Aside from the units, also remove quotes from around the TLS options strings as this is inconsistent with all the other strings. Similarly, change block-bitmap-mapping format to remove the arrows (->) for the mappings as not all parameters represented as a list have this semantics. This requires updating one of the iotests. Before: After: (unchanged entries omitted) announce-initial: 50 ms announce-initial: 50 announce-max: 550 ms announce-max: 550 announce-rounds: 5 announce-rounds: 5 announce-step: 100 ms announce-step: 100 tls-creds: '' tls-creds: tls-hostname: '' tls-hostname: tls-authz: '' tls-authz: max-bandwidth: 134217728 bytes/second max-bandwidth: 134217728 avail-switchover-bandwidth: 0 bytes/second avail-switchover-bandwidth: 0 max-postcopy-bandwidth: 0 bytes/second max-postcopy-bandwidth: 0 downtime-limit: 300 ms downtime-limit: 300 x-checkpoint-delay: 20000 ms x-checkpoint-delay: 20000 xbzrle-cache-size: 67108864 bytes xbzrle-cache-size: 67108864 x-vcpu-dirty-limit-period: 1000 ms x-vcpu-dirty-limit-period: 1000 vcpu-dirty-limit: 1 MB/s vcpu-dirty-limit: 1 x-rdma-chunk-size: 1048576 bytes x-rdma-chunk-size: 1048576 block-bitmap-mapping: block-bitmap-mapping: 'node-src' -> 'node-dst' bitmaps: 'bmap0' -> 'bmap0' name: bmap0 alias: bmap0 node-name: node-src alias: no= de-dst Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 79 +++++++++++++++++------------- tests/qemu-iotests/300 | 20 +++++--- tests/qtest/migration/misc-tests.c | 30 ++++++------ 3 files changed, 74 insertions(+), 55 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 67ea2eea15..b3422b848a 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -335,16 +335,16 @@ void hmp_info_migrate_parameters(MonitorHMP *hmp, con= st QDict *qdict) params =3D qmp_query_migrate_parameters(NULL); =20 if (params) { - monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_INITIAL), params->announce_initial); - monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_MAX), params->announce_max); monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_ROUNDS), params->announce_rounds); - monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_STEP), params->announce_step); assert(params->has_throttle_trigger_threshold); @@ -368,35 +368,35 @@ void hmp_info_migrate_parameters(MonitorHMP *hmp, con= st QDict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_MAX_CPU_THROTTLE), params->max_cpu_throttle); assert(params->tls_creds); - monitor_hmp_printf(hmp, "%s: '%s'\n", + monitor_hmp_printf(hmp, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), params->tls_creds->u.s); assert(params->tls_hostname); - monitor_hmp_printf(hmp, "%s: '%s'\n", + monitor_hmp_printf(hmp, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), params->tls_hostname->u.s); assert(params->tls_authz); - monitor_hmp_printf(hmp, "%s: '%s'\n", + monitor_hmp_printf(hmp, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), params->tls_authz->u.s); assert(params->has_max_bandwidth); - monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), params->max_bandwidth); assert(params->has_avail_switchover_bandwidth); - monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BA= NDWIDTH), params->avail_switchover_bandwidth); assert(params->has_max_postcopy_bandwidth); - monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), params->max_postcopy_bandwidth); assert(params->has_downtime_limit); - monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT), params->downtime_limit); assert(params->has_x_checkpoint_delay); - monitor_hmp_printf(hmp, "%s: %u ms\n", + monitor_hmp_printf(hmp, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY), params->x_checkpoint_delay); monitor_hmp_printf(hmp, "%s: %u\n", @@ -410,41 +410,52 @@ void hmp_info_migrate_parameters(MonitorHMP *hmp, con= st QDict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_ZERO_PAGE_DETECTION= ), qapi_enum_lookup(&ZeroPageDetection_lookup, params->zero_page_detection)); - monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes\n", + monitor_hmp_printf(hmp, "%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_hmp_printf(hmp, "%s:\n", - MigrationParameter_str( - MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPIN= G)); + 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_hmp_printf(hmp, " bitmaps:\n"); + for (bal =3D na->bitmaps; bal; bal =3D bal->next) { + ba =3D bal->value; + bat =3D ba->transform; =20 - monitor_hmp_printf(hmp, " '%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_hmp_printf(hmp, " '%s' -> '%s'\n", - bmba->name, bmba->alias); + monitor_hmp_printf(hmp, " name: %s", ba->name); + if (bat && bat->has_persistent) { + monitor_hmp_printf(hmp, " transform:"); + if (bat->persistent) { + monitor_hmp_printf(hmp, " persistent: on"); + } else { + monitor_hmp_printf(hmp, " persistent: off"); + } + } + monitor_hmp_printf(hmp, " alias: %s\n", ba->alias); } + monitor_hmp_printf(hmp, " node-name: %s alias: %s\n", + na->node_name, na->alias); } + + monitor_hmp_printf(hmp, "\n"); } =20 - monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), params->x_vcpu_dirty_limit_period); =20 - monitor_hmp_printf(hmp, "%s: %" PRIu64 " MB/s\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), params->vcpu_dirty_limit); =20 @@ -461,10 +472,10 @@ void hmp_info_migrate_parameters(MonitorHMP *hmp, con= st QDict *qdict) } =20 if (params->has_x_rdma_chunk_size) { - monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes\n", - MigrationParameter_str( - MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), - params->x_rdma_chunk_size); + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", + MigrationParameter_str( + MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), + params->x_rdma_chunk_size); } =20 assert(params->has_cpr_exec_command); diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 index df2ba32632..7b97eef1fd 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -147,11 +147,9 @@ 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( .*\r\n)*', result['return'], flags=3Dre.MULTILINE) hmp_mapping =3D m.group(0).replace('\r', '') if m else None - self.assertEqual(hmp_mapping, self.to_hmp_mapping(mapping)) else: self.assert_qmp(result, 'error/desc', error) @@ -161,11 +159,21 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): result =3D 'block-bitmap-mapping:\n' =20 for node in mapping: - result +=3D f" '{node['node-name']}' -> '{node['alias']}'\n" - assert isinstance(node['bitmaps'], list) + result +=3D ' bitmaps:\n' for bitmap in node['bitmaps']: - result +=3D f" '{bitmap['name']}' -> '{bitmap['alias']}= '\n" + result +=3D f" name: {bitmap['name']}" + if 'transform' in bitmap: + result +=3D " transform:" + if 'persistent' in bitmap['transform']: + if bitmap['transform']['persistent']: + result +=3D " persistent: on" + else: + result +=3D " persistent: off" + result +=3D f" alias: {bitmap['alias']}\n" + + result +=3D f" node-name: {node['node-name']} alias: {node['al= ias']}" + result +=3D '\n' =20 return result =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index f70d35c658..182a8518a9 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -156,21 +156,21 @@ static void test_hmp_migration_parameters(char *name,= MigrateCommon *args) TEST("local", "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", "2097152 bytes/secon= d"), - TEST("max-bandwidth", "9876543", "9876543 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", "2097152"), + TEST("max-bandwidth", "9876543", "9876543"), + 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"), @@ -183,9 +183,9 @@ static void test_hmp_migration_parameters(char *name, M= igrateCommon *args) 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:51:03 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=1789430652; cv=none; d=zohomail.com; s=zohoarc; b=fKV83+LM+bDYZyM9UWufyUeRatmmExpVITcvg4TPc7FrAvGf+ly66MOqJBWhWiiYaYJDUajNtpoibBJ+v1Nk5iVy7BxS/fhN3g4NaV5lFOPu4fIggWq5tDbkCijH3ZJ8KMX4n2O6mLlF9ZAx2Vt8xLNbJ1ICDM7sLVyIqFHGiZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430652; 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=OXC1BYudS/2N47FH+WVo6cuTZ7MXBEajIyI24SO5N5g=; b=QNDNU4JtEJAsvrWYXRkDiknU/waq7bLYjyp6ULlyYpXo7nq6m6sfSbg1fPGCLDZCC1SrvjxBnswBNQM5XmPpnNx60H4bXB5/6XwFOqv40fSd2QapVAHH6pGkafEN5U4XYprTq8O0TFzOxZQtRR1dR0QjxV3eZlU2XfCB42MwSTA= 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 1789430652523660.12499053101; Mon, 14 Sep 2026 17:04:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdS-0003dd-NM; Mon, 14 Sep 2026 20:02:54 -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 1x6GdQ-0003XE-Rd for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:53 -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 1x6GdN-0004oq-4K for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:52 -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 38A3C21E25; Tue, 15 Sep 2026 00:02:39 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9ACEB136D9; Tue, 15 Sep 2026 00:02:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T14 (envelope-from ); Tue, 15 Sep 2026 00:02:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430563; 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=OXC1BYudS/2N47FH+WVo6cuTZ7MXBEajIyI24SO5N5g=; b=IT4d9ZJ1PyzAVIwa/kLGOAWTlfrIp0s6e4SiAIryhBx/6E7CLaPHpvFLfBXR0keFwLZnPa T1zR0Gwg9k3tOa8wOyX3y+6Spzn/u5mpvPAOOLozFFaC42RofpJN3vPakXk1ISxbFl12st EmrLaLtw0kFnpVIf5D/T70QO1ePBalg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430563; 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=OXC1BYudS/2N47FH+WVo6cuTZ7MXBEajIyI24SO5N5g=; b=y2bcoE0NbTgOX2U8R8hEsFa16BsJrhdYfmLuQL7NnQoJqp2VM9+K1sK1q4K1JZkvzAoj0B Tn0ZzWZsNjIZmXCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430559; 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=OXC1BYudS/2N47FH+WVo6cuTZ7MXBEajIyI24SO5N5g=; b=UXtqpKnbtUkwaqOv0xaw/XhMPOhOqM+y6N2Ca1N0LiOmRgyDRTN34ZKQJ5q5Ykbhh5V3OP L8Uriv0VXkHRPMG7M4jWliW0H95e/8zuspjvfXf5WHl35VjdSTWcre9//X/WFqiO81+HYX Y3Z/jAVYpBpvBra97cgmonHdnR5BQhk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430559; 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=OXC1BYudS/2N47FH+WVo6cuTZ7MXBEajIyI24SO5N5g=; b=u1ywRfg1T2ZNMnrN8rEj0VY9BOqydM1Uk1UvUpuxigejy7oTz0ZFWUCp6Ea4MITixOMqVh 5DcLJplxcadbrlCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 13/20] migration: Use keyval input visitor in HMP set command Date: Mon, 14 Sep 2026 21:02:01 -0300 Message-ID: <20260915000209.3692668-14-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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_FIVE(0.00)[6]; 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.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: 1789430653802158500 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. Note that one parameter, "cpr-exec-command", takes the strList type so the HMP string needs to be first converted to a QList. A small side-effect improvement of this change is that by not using the MigrationParameter enum as a means to verify whether the user-provided key is a valid parameter name, the message when an invalid parameter is given now changes from "invalid value x" to "parameter x is unexpected", which is more accurate. Signed-off-by: Fabiano Rosas Reviewed-by: Markus Armbruster --- migration/migration-hmp-cmds.c | 187 ++++------------------------- tests/qtest/migration/misc-tests.c | 2 +- 2 files changed, 26 insertions(+), 163 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index b3422b848a..7491c79a2e 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -25,7 +25,10 @@ #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/qlist.h" +#include "qobject/qstring.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" #include "qemu/cutils.h" @@ -605,183 +608,43 @@ void hmp_migrate_set_parameter(MonitorHMP *hmp, cons= t QDict *qdict) { const char *param =3D qdict_get_str(qdict, "parameter"); const char *valuestr =3D qdict_get_str(qdict, "value"); - Visitor *v =3D string_input_visitor_new(valuestr); - MigrationParameters *p =3D g_new0(MigrationParameters, 1); - uint64_t cache_size; + g_autoptr(QDict) input =3D qdict_new(); + g_autoptr(MigrationParameters) p =3D NULL; + QObject *value; + Visitor *v; Error *err =3D NULL; - int val; =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: - p->has_max_bandwidth =3D true; - visit_type_size(v, param, &p->max_bandwidth, &err); - break; - case MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BANDWIDTH: - p->has_avail_switchover_bandwidth =3D true; - visit_type_size(v, param, &p->avail_switchover_bandwidth, &err); - 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: { - /* - * NOTE: g_autofree will only auto g_free() the strv array when - * needed, it will not free the strings within the array. It's - * intentional: when strv is set, the ownership of the strings will - * always be passed to p->cpr_exec_command via QAPI_LIST_APPEND(). - */ + if (g_str_equal(param, "block-bitmap-mapping")) { + error_setg(&err, "The %s parameter can only be set through QMP", p= aram); + goto err; + } else if (g_str_equal(param, "cpr-exec-command")) { g_autofree char **strv =3D NULL; g_autoptr(GError) gerr =3D NULL; - strList **tail =3D &p->cpr_exec_command; + QList *list; =20 if (!g_shell_parse_argv(valuestr, NULL, &strv, &gerr)) { error_setg(&err, "%s", gerr->message); - break; + goto err; } + + list =3D qlist_new(); for (int i =3D 0; strv[i]; i++) { - QAPI_LIST_APPEND(tail, strv[i]); + qlist_append_str(list, strv[i]); + g_free(strv[i]); } - p->has_cpr_exec_command =3D true; - break; - } - default: - g_assert_not_reached(); + value =3D QOBJECT(list); + } else { + value =3D QOBJECT(qstring_from_str(valuestr)); } =20 - if (err) { - goto cleanup; + qdict_put_obj(input, param, value); + v =3D qobject_input_visitor_new_keyval(QOBJECT(input)); + if (visit_type_MigrationParameters(v, NULL, &p, &err)) { + qmp_migrate_set_parameters(p, &err); } =20 - qmp_migrate_set_parameters(p, &err); - - cleanup: - qapi_free_MigrationParameters(p); visit_free(v); +err: hmp_handle_error(hmp, err); } =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 182a8518a9..49280e5bc9 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -148,7 +148,7 @@ static void test_hmp_migration_parameters(char *name, M= igrateCommon *args) 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:51:03 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=1789430692; cv=none; d=zohomail.com; s=zohoarc; b=GbZokNtZwaZZPxsuNBX+fJAJmmTtzhUunl84WlKekuJTU84QEBxgcOzFUVqPv8zaqxen3I3yUR+AEcrLEb9wwkgHw29w6Ap8SrRI/JRCAiY5crC3hd/vfsWqSw2wvypQpbESyoTcU9I9QGrG7WkuUwITEZNdVDuo/u6nkFlqFK8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430692; 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=CqUe3TPv9qECyKsu1k70GVLFCuSujUErlrH9f8pYvrc=; b=PFoIAV6HY4wK87G/Dd/Bp6Nony9t1SDJafiL1Y/fl/GGlCGE+7TkbLmrE3bIY3vOP8qrU5BQCxvjlNATi2/eujKhU7EDnH2MojeUPFFooVOtD1tGMzZtbmqnBDVYtLmCChfJxYyUhWWs9u6HBWmzC4TWM051S53UauTDNGiXytI= 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 178943069292892.06498541082783; Mon, 14 Sep 2026 17:04:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdV-0003nC-C5; Mon, 14 Sep 2026 20:02:57 -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 1x6GdQ-0003Xe-VV for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:53 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x6GdO-0004p1-77 for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:52 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B7CB21FF47; Tue, 15 Sep 2026 00:02:40 +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 7D73013710; Tue, 15 Sep 2026 00:02:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T15 (envelope-from ); Tue, 15 Sep 2026 00:02:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430565; 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=CqUe3TPv9qECyKsu1k70GVLFCuSujUErlrH9f8pYvrc=; b=Vh2Uw4Z76RNj1qX4X0DmXqn7hxNdySz1wXVPx/YwLpnEXCKSt2bFJT7rdRXvoEWlbdeJc7 wJQvPX4fZYbAtZb/R9PmMqBo+SWtTE7I2zUHMRsHcF7bB/AgpMpfquo/g9l0jiwyg+Mowq z5Bo3HY6HHgMU9I0/i88NAbj0Hv+nSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430565; 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=CqUe3TPv9qECyKsu1k70GVLFCuSujUErlrH9f8pYvrc=; b=R+r81ZVF0SWx42McO8q4ihEifNOCOY4q5Ul//k2JcniCKKsZidUyljCSc/WixMOBvCuzw0 y05CB3DC4et+4FBw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=mXDBtZCc; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=xH5v82eD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430560; 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=CqUe3TPv9qECyKsu1k70GVLFCuSujUErlrH9f8pYvrc=; b=mXDBtZCctPva4bXzpFVzf8aeL/qAbAnC8VNk/gBEy6HaYuTvkrFfPwaWhn8ffXGmEacB4P /MSuyYIPec+D0eIqjDuWZErdEkffYqQaxM/GBNfHhMjf9YXWrDqvfkkgE5R6U6+m8n+VSj 8ph/45hMkvXLFt3mmOtGOrLkhPpxpcQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430560; 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=CqUe3TPv9qECyKsu1k70GVLFCuSujUErlrH9f8pYvrc=; b=xH5v82eD0qM+3WzSi0kRcF9ixA7TXJ9LRhVwVvv3zKvUhEA6YfMFsPqoHjGFg9TL3SbAKy ldfjZnHIYGn++oAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v3 14/20] migration: Use output visitor in info command Date: Mon, 14 Sep 2026 21:02:02 -0300 Message-ID: <20260915000209.3692668-15-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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: B7CB21FF47 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: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)[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=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: 1789430694033158500 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. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 234 +++++++++++---------------------- migration/options.c | 2 +- migration/options.h | 1 + 3 files changed, 81 insertions(+), 156 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 7491c79a2e..00d2d310af 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -26,8 +26,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" @@ -318,171 +322,91 @@ void hmp_info_migrate_capabilities(MonitorHMP *hmp, = const QDict *qdict) qapi_free_MigrationCapabilityStatusList(caps); } =20 -static void monitor_print_cpr_exec_command(MonitorHMP *hmp, strList *args) +static void hmp_migrate_print_qobject(MonitorHMP *hmp, const char *label, + QObject *obj) { - monitor_hmp_printf(hmp, "%s:", - MigrationParameter_str(MIGRATION_PARAMETER_CPR_EXEC_COMMAND)); + const char *sep; =20 - while (args) { - monitor_hmp_printf(hmp, " %s", args->value); - args =3D args->next; + if (!obj) { + return; + } + + /* + * Put a space after labels + * foo: bar + * ^ + */ + if (label && label[0] && label[strlen(label) - 1] =3D=3D ':') { + sep =3D " "; + } else { + sep =3D ""; + } + + switch (qobject_type(obj)) { + case QTYPE_QNUM: { + g_autofree char *str =3D qnum_to_string(qobject_to(QNum, obj)); + + monitor_hmp_printf(hmp, "%s%s%s", label, sep, str); + break; + } + case QTYPE_QSTRING: + monitor_hmp_printf(hmp, "%s%s%s", label, sep, + qstring_get_str(qobject_to(QString, obj))); + break; + case QTYPE_QDICT: { + QDict *d =3D qobject_to(QDict, obj); + const QDictEntry *e; + int i =3D 0; + + monitor_hmp_printf(hmp, "%s%s", label, sep); + + 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_hmp_printf(hmp, " "); + } + hmp_migrate_print_qobject(hmp, l, qdict_entry_value(e)); + } + break; + } + case QTYPE_QLIST: { + const QListEntry *e; + + monitor_hmp_printf(hmp, "%s\n", label); + for (e =3D qlist_first(qobject_to(QList, obj)); e; e =3D qlist_nex= t(e)) { + hmp_migrate_print_qobject(hmp, " ", e->value); + monitor_hmp_printf(hmp, "\n"); + } + + break; + } + case QTYPE_QBOOL: + monitor_hmp_printf(hmp, "%s%s%s", label, sep, + qbool_get_bool(qobject_to(QBool, obj)) ? + "on" : "off"); + break; + case QTYPE_NONE: + case QTYPE_QNULL: + default: + g_assert_not_reached(); + break; } - monitor_hmp_printf(hmp, "\n"); } =20 void hmp_info_migrate_parameters(MonitorHMP *hmp, const QDict *qdict) { - MigrationParameters *params; - MigrationState *s =3D migrate_get_current(); + MigrationParameters *params =3D qmp_query_migrate_parameters(NULL); + g_autoptr(QDict) d; + const QDictEntry *e; =20 - params =3D qmp_query_migrate_parameters(NULL); + assert(params); =20 - if (params) { - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_INITIAL), - params->announce_initial); - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_MAX), - params->announce_max); - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_ROUNDS), - params->announce_rounds); - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_STEP), - params->announce_step); - assert(params->has_throttle_trigger_threshold); - monitor_hmp_printf(hmp, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_THROTTLE_TRIGGER_TH= RESHOLD), - params->throttle_trigger_threshold); - assert(params->has_cpu_throttle_initial); - monitor_hmp_printf(hmp, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIA= L), - params->cpu_throttle_initial); - assert(params->has_cpu_throttle_increment); - monitor_hmp_printf(hmp, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREM= ENT), - params->cpu_throttle_increment); - assert(params->has_cpu_throttle_tailslow); - monitor_hmp_printf(hmp, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_TAILSL= OW), - params->cpu_throttle_tailslow ? "on" : "off"); - assert(params->has_max_cpu_throttle); - monitor_hmp_printf(hmp, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_CPU_THROTTLE), - params->max_cpu_throttle); - assert(params->tls_creds); - monitor_hmp_printf(hmp, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), - params->tls_creds->u.s); - assert(params->tls_hostname); - monitor_hmp_printf(hmp, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), - params->tls_hostname->u.s); - assert(params->tls_authz); - monitor_hmp_printf(hmp, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz->u.s); - assert(params->has_max_bandwidth); - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), - params->max_bandwidth); - assert(params->has_avail_switchover_bandwidth); - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BA= NDWIDTH), - params->avail_switchover_bandwidth); - assert(params->has_max_postcopy_bandwidth); - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), - params->max_postcopy_bandwidth); - assert(params->has_downtime_limit); - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT), - params->downtime_limit); - assert(params->has_x_checkpoint_delay); - monitor_hmp_printf(hmp, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY), - params->x_checkpoint_delay); - monitor_hmp_printf(hmp, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_CHANNELS), - params->multifd_channels); - monitor_hmp_printf(hmp, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_COMPRESSION= ), - MultiFDCompression_str(params->multifd_compression)); - assert(params->has_zero_page_detection); - monitor_hmp_printf(hmp, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_ZERO_PAGE_DETECTION= ), - qapi_enum_lookup(&ZeroPageDetection_lookup, - params->zero_page_detection)); - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), - params->xbzrle_cache_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 - if (s->has_block_bitmap_mapping) { - BitmapMigrationNodeAliasList *nal; - BitmapMigrationNodeAlias *na; - BitmapMigrationBitmapAliasList *bal; - BitmapMigrationBitmapAlias *ba; - BitmapMigrationBitmapAliasTransform *bat; - - monitor_hmp_printf(hmp, "%s:\n", - MigrationParameter_str( - MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); - - for (nal =3D params->block_bitmap_mapping; nal; nal =3D nal->n= ext) - { - na =3D nal->value; - monitor_hmp_printf(hmp, " bitmaps:\n"); - for (bal =3D na->bitmaps; bal; bal =3D bal->next) { - ba =3D bal->value; - bat =3D ba->transform; - - monitor_hmp_printf(hmp, " name: %s", ba->name); - if (bat && bat->has_persistent) { - monitor_hmp_printf(hmp, " transform:"); - if (bat->persistent) { - monitor_hmp_printf(hmp, " persistent: on"); - } else { - monitor_hmp_printf(hmp, " persistent: off"); - } - } - monitor_hmp_printf(hmp, " alias: %s\n", ba->alias); - } - monitor_hmp_printf(hmp, " node-name: %s alias: %s\n", - na->node_name, na->alias); - } - - monitor_hmp_printf(hmp, "\n"); - } - - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), - params->x_vcpu_dirty_limit_period); - - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), - params->vcpu_dirty_limit); - - assert(params->has_mode); - monitor_hmp_printf(hmp, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_MODE), - qapi_enum_lookup(&MigMode_lookup, params->mode)); - - if (params->has_direct_io) { - monitor_hmp_printf(hmp, "%s: %s\n", - MigrationParameter_str( - MIGRATION_PARAMETER_DIRECT_IO), - params->direct_io ? "on" : "off"); - } - - if (params->has_x_rdma_chunk_size) { - monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", - MigrationParameter_str( - MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), - params->x_rdma_chunk_size); - } - - assert(params->has_cpr_exec_command); - monitor_print_cpr_exec_command(hmp, params->cpr_exec_command); + hmp_migrate_print_qobject(hmp, label, qdict_entry_value(e)); + monitor_hmp_printf(hmp, "\n"); } =20 qapi_free_MigrationParameters(params); diff --git a/migration/options.c b/migration/options.c index 46d040fc3f..29b96f48c1 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1097,7 +1097,7 @@ 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) +QDict *migrate_params_to_dict(MigrationParameters *p, Error **errp) { QObject *obj =3D NULL; Visitor *v =3D qobject_output_visitor_new(&obj); diff --git a/migration/options.h b/migration/options.h index c7da2d0b5b..0d9f88c11e 100644 --- a/migration/options.h +++ b/migration/options.h @@ -94,4 +94,5 @@ 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); +QDict *migrate_params_to_dict(MigrationParameters *p, Error **errp); #endif --=20 2.53.0 From nobody Sat Sep 26 20:51:03 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=1789430643; cv=none; d=zohomail.com; s=zohoarc; b=dMjnOunNdiHLoUoWU5xeGr6SBE7Bb7m0mNqxlnz3gLPeWflHx8xF4SW0fboWwPdmhA0sBqmpM3sb6Yi/zEjVqvrsAUeqiTjxArdFgZ93nKpvcWSjiIIaRrciMbMvychNwpBzWAoYR6mF2UGYxZ3ox7CvFFO/RMn24V0K6j66kp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430643; 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=E/IWzzZSTNsMRvoaw/hmBnfTeFIvplh/DnfWhVHmTyw=; b=kP+V5Mo0h7b88a9XpiREiqjEOe3gVVkLE0aS6hwYnD9eVmipL1PsI7GuGWwHWA3H6JuwxA51YYMaaPJEuoxuL1WJN5K/Xc689QlnFhqngxK40er7zBOVPHs/7PRrwRX/LGgF6xvYkBDSZdCoSCEX8bc173UckesZ/uBdxAv+cOA= 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 17894306438503.9800459136356494; Mon, 14 Sep 2026 17:04:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdT-0003fp-61; Mon, 14 Sep 2026 20:02:55 -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 1x6GdR-0003Yy-AB for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:53 -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 1x6GdP-0004p9-Ki for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:53 -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 3EA1F21AC3; Tue, 15 Sep 2026 00:02:42 +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 04E0A13515; Tue, 15 Sep 2026 00:02:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T16 (envelope-from ); Tue, 15 Sep 2026 00:02:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430566; 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=E/IWzzZSTNsMRvoaw/hmBnfTeFIvplh/DnfWhVHmTyw=; b=qQs7Gp7lkS9U5B04AjTEw2Vq+glTzmdWLYEpMBTA5Q5zU/dCUm6s9vnEzMc5mnJR2+NLhW e1aWpjDYZnxSODBXNKghcyR20lpK6SftjWy0f3ElQt0VZgynj9WI4UxLsZNYdPYlEtiksv 682D4gyVLHkQ8kOSwJmdWEZIxL/jOQA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430566; 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=E/IWzzZSTNsMRvoaw/hmBnfTeFIvplh/DnfWhVHmTyw=; b=Z9+m3SoVyODWN01qFWsp9pOHlglmeXK6Ilvw5KHy18XexzKImuTIEVgPF9g6XHzKsJhX9H oe1bMWhQM9kf4/CA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=iPrCufTw; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=5LRLOCPM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430562; 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=E/IWzzZSTNsMRvoaw/hmBnfTeFIvplh/DnfWhVHmTyw=; b=iPrCufTwD1d9wvCV/XPH6sEXtvMYE/n2AS/wgYWVNmmm59P5QrnH0YpKjOLgo69NfMsYUJ t1njxNXsSyzVdLxWIks0olw34pi8pxklVk7DxxEuVXHI6h3E4ahDwBeWm7Y+965rwq+div EP8nISEfZ346co0r4c3NNhNxvhDG1SQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430562; 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=E/IWzzZSTNsMRvoaw/hmBnfTeFIvplh/DnfWhVHmTyw=; b=5LRLOCPM6jEmm5zWKRweMuHdk+dfrhP6Hyo1ylVDuP4A1vt9qYveJwHZhF4TfmaMQoMZvp 74wIiPg3UBrsMzDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v3 15/20] migration: Rewrite migrate_set_parameter_completion using QDict Date: Mon, 14 Sep 2026 21:02:03 -0300 Message-ID: <20260915000209.3692668-16-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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: 3EA1F21AC3 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)[]; 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: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)[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: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: 1789430645729158500 Content-Type: text/plain; charset="utf-8" We're moving towards having no open-coded access to the MigrationParameters members. Instances of parameters enumeration are being removed. The migrate_set_parameter_completion function is one of the last users of the MigrationParameter enum. Rewrite that code using an output visitor and QDict instead. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 00d2d310af..c63d7f1ccb 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -693,14 +693,20 @@ 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(QDict) d =3D NULL; + const QDictEntry *e; size_t len; =20 + /* Temporarily borrow the global parameters */ + d =3D migrate_params_to_dict(&migrate_get_current()->parameters, + &error_abort); + 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); + readline_add_completion_of(rs, str, key); } } } --=20 2.53.0 From nobody Sat Sep 26 20:51:03 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=1789430661; cv=none; d=zohomail.com; s=zohoarc; b=RxIVtrnS64LBUBcGNh07E9pe3OLYs+O7H71hYj6eeIPdKcf0yGqWvtJ/JK3BLXNnkV75zUYfWit+6KuMSLaSDQsih3dmwIz+fC46qEtpQKFF7ryA/2IDycSjhaeWucGg3zEJ1W2mG2WJYfU+MG52HmxqIOvJ2kfrXIi4KXuudg4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430661; 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=lowZqIMZKmk3M/EIU+fHuOkvoDzRKc5Y4jVxqb/ssHs=; b=V3M2+qCWrDYGKm7rvBVhuPm4aWfK6psjJSbSr/5tjS6hjIcy64fxcaY3IY8tRg3uWIEwUY0B9oNMo6WBNb2um578w3Yt5gyxwsvw2b6BMXinBneUIs3+D1iUGIioYl42EcoCZymqEaoIOq2dSQ8p696m8XkGsQIong3nKpnfGy0= 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 1789430661722371.95446826784564; Mon, 14 Sep 2026 17:04:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6GdW-0003qj-Nc; Mon, 14 Sep 2026 20:02:58 -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 1x6GdU-0003k5-AV for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:56 -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 1x6GdR-0004pX-JS for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:56 -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 EA8CB1FF21; Tue, 15 Sep 2026 00:02:43 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 83FBD13707; Tue, 15 Sep 2026 00:02:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T17 (envelope-from ); Tue, 15 Sep 2026 00:02:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430568; 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=lowZqIMZKmk3M/EIU+fHuOkvoDzRKc5Y4jVxqb/ssHs=; b=2IYr9HGUcMD9QLe0y4SU7S04gbah104RuVlMmTNgeYawKal6C0BhpUDqgUCkTgduZuIDO3 HhJAhSkD89aebBBOv7uQImigdf8yZIVoJNe/HubGNbNZ2RiQoan6WtrF6SXseOZy7F8OXl ocwYnkOe7jSeO2XH8dVSCwyObxsv/80= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430568; 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=lowZqIMZKmk3M/EIU+fHuOkvoDzRKc5Y4jVxqb/ssHs=; b=5PZ2T0k9MK3ovQU11CJuI4cBxdItCLUq/I6GJqtb50mUaHQj9y9U/uer5m9A5NzL21glYN Q08hJchuQZAyjZDg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430563; 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=lowZqIMZKmk3M/EIU+fHuOkvoDzRKc5Y4jVxqb/ssHs=; b=aY/wpmV0IUltjzsrf9rV/TPYL1NjX2WWNgldhrGM39EEn8y62HxJsGmPWTF7omsoD9tGwA I+XJSfjcc4PWnhgD8D7yZ9M9FgH4EoRbFt39gRILiOArsqlUzO78uDEGZDheQ4RsBQhubM C//uKeNS09us6ihfQ8s8QhZaxTXtRqY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430563; 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=lowZqIMZKmk3M/EIU+fHuOkvoDzRKc5Y4jVxqb/ssHs=; b=RLiBDsfecV1wbHpLdZUKD8rB/HU05cbzPfZvr62Q5oYQMHK9wMUxFxXVld+1rNLySDMSLW IummoYtdCdE8PvAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Eric Blake Subject: [PATCH v3 16/20] migration: Add capabilities into MigrationParameters Date: Mon, 14 Sep 2026 21:02:04 -0300 Message-ID: <20260915000209.3692668-17-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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_FIVE(0.00)[5]; 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.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: 1789430663891158500 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: Markus Armbruster #QAPI schema Acked-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 8 +++ migration/options.c | 71 ++++++++++++++++++++++++ migration/options.h | 5 ++ qapi/migration.json | 123 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 203 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index fab7949fe1..36db60ad58 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4099,6 +4099,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 29b96f48c1..432037aae0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -783,6 +783,52 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) return true; } =20 +static bool *migrate_capability_get_addr(MigrationParameters *params, + enum MigrationCapability i) +{ + bool *cap_addr[] =3D { + ¶ms->xbzrle, ¶ms->rdma_pin_all, + ¶ms->auto_converge, ¶ms->events, ¶ms->postcopy_ram, + ¶ms->x_colo, ¶ms->release_ram, ¶ms->return_path, + ¶ms->pause_before_switchover, ¶ms->multifd, + ¶ms->dirty_bitmaps, ¶ms->postcopy_blocktime, + ¶ms->late_block_activate, ¶ms->x_ignore_shared, + ¶ms->validate_uuid, ¶ms->background_snapshot, + ¶ms->zero_copy_send, ¶ms->postcopy_preempt, + ¶ms->switchover_ack, ¶ms->dirty_limit, ¶ms->mapped_ram, + }; + + assert(i >=3D 0 && i < MIGRATION_CAPABILITY__MAX); + return cap_addr[i]; +} + +/* 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; @@ -824,6 +870,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 */ @@ -1147,6 +1195,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_local, + &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 len =3D ARRAY_SIZE(has_fields); @@ -1422,6 +1479,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 0d9f88c11e..f7bf56e9ff 100644 --- a/migration/options.h +++ b/migration/options.h @@ -95,4 +95,9 @@ bool migrate_params_check(MigrationParameters *params, Er= ror **errp); void migrate_params_init(MigrationParameters *params); bool migrate_params_free(MigrationParameters *params, Error **errp); QDict *migrate_params_to_dict(MigrationParameters *p, 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 f7628b55e9..9ebd266fcf 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -831,7 +831,13 @@ 'direct-io', { 'name': 'x-rdma-chunk-size', 'features': [ 'unstable' ] }, 'cpr-exec-command', - 'local'] } + 'local', 'xbzrle', 'rdma-pin-all', 'auto-converge', 'events', + 'postcopy-ram', 'x-colo', 'release-ram', 'return-path', + 'pause-before-switchover', 'multifd', 'dirty-bitmaps', + 'postcopy-blocktime', 'late-block-activate', 'x-ignore-shared', + 'validate-uuid', 'background-snapshot', 'zero-copy-send', + 'postcopy-preempt', 'switchover-ack', 'dirty-limit', + 'mapped-ram'] } =20 ## # @migrate-set-parameters: @@ -1023,10 +1029,98 @@ # local migration optimizations. This will be documented against # the device backends where it applies. (Since 11.2) # +# @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 the destination has +# acknowledged that it is OK to switch over. The acknowledgement +# may depend, for example, on some device's data being loaded in +# the destination before doing switchover. This can reduce +# downtime if devices that support this capability are present. +# Capability @return-path 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 @local, @x-checkpoint-delay, @x-rdma-chunk-size, -# and @x-vcpu-dirty-limit-period are experimental. +# @unstable: Members @x-checkpoint-delay, @x-rdma-chunk-size, +# @x-vcpu-dirty-limit-period, @x-colo, @x-ignore-shared and are +# experimental. # # Since: 2.4 ## @@ -1066,7 +1160,28 @@ 'features': [ 'unstable' ] }, '*cpr-exec-command': [ 'str' ], '*local': { 'type': 'bool', - 'features': [ 'unstable' ] } } } + 'features': [ 'unstable' ] }, + '*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:51:03 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=1789430684; cv=none; d=zohomail.com; s=zohoarc; b=K3jn7mfKeUupgMN196GT0V7vQPyfivcBrogIleCyqfsXO0jM0+mKDKlYfJvVpV/3zUGKoT5JaKHGUttAFy7CTUHhoXMy/rBn5uq6UtWuj/ncusHFoVXPwTCQOfMZK3yOeKm4j4ut2HZxtr4l4/0AhSYvVzNP4o4bYDpAh78CVdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430684; 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=QYRBCqDPPuIVmN1iKVqpJBLkQx0JBSl1M9SmGWiaCDc=; b=eoU0lk94o57X+mAz91kBDAlF5EsJ8M9L2U4emUtFbvv9gKiG6uXqyrQgf7kiX+TAWhbJ8qQRt3VWGmq9khiw00LaRlrMNCc7E5Tf3RhfbHeF51lXdjgBH83i/OtrQqGIyVqV5v7AQJVIY45Jk6LUpxrWyTCPYs1lkALhjhR2G9I= 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 1789430684731503.1086663784605; Mon, 14 Sep 2026 17:04:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Gda-00045X-3B; Mon, 14 Sep 2026 20:03:02 -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 1x6GdX-0003v3-FE for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:59 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x6GdT-0004q4-FD for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:59 -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 0F03721E1B; Tue, 15 Sep 2026 00:02:46 +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 43D6813806; Tue, 15 Sep 2026 00:02:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T18 (envelope-from ); Tue, 15 Sep 2026 00:02:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430570; 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=QYRBCqDPPuIVmN1iKVqpJBLkQx0JBSl1M9SmGWiaCDc=; b=D5QAsldJUMlgEdWub1lw9C2qbOwnRC3XyWl/iPGM3AwDm1TX7ztncSEv48f//TmmoKcnW+ YdrGTq+EElkowHTmDHSupBGUSovNKqWzJVKarRQLJTrJjBg/kaPAZL8evq0eHUhmGEFhPS S8gAdY0dllFOO2meYNbwGw+VrkiiPGo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430570; 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=QYRBCqDPPuIVmN1iKVqpJBLkQx0JBSl1M9SmGWiaCDc=; b=WM7bC4KSH9HIWE8C7sF8fPvEc4SeHZggSgV/L425Fx1Ru6wcfM8GCz9gND8J12174KW2/m /0FpTydrKSuOk/Cg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="ZS/4TxaE"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=+IHsWKRX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430566; 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=QYRBCqDPPuIVmN1iKVqpJBLkQx0JBSl1M9SmGWiaCDc=; b=ZS/4TxaECt9vL0J8IAZADzMJQnQW3zeQNEyV4+0ah+cQTJpTH0KpKUQB92ej6+25Uwz4x5 LyWM1DNpzCeKCuSjl2/ZG342J+G6aq0tYKepdYBycYoEdZmEr768A3/Ymwgno2SbCnYtMM WDAn4I+hS1/wPKzDnkclb81FunvHD18= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430566; 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=QYRBCqDPPuIVmN1iKVqpJBLkQx0JBSl1M9SmGWiaCDc=; b=+IHsWKRXNvZLFJPm2rcb3Vx1bWFP+EvzyCfKhWSa1b98x/4Um7233TT9XCEvc0R5BxBdmD DZQ0Bwj96QOedWCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 17/20] migration: Remove s->capabilities Date: Mon, 14 Sep 2026 21:02:05 -0300 Message-ID: <20260915000209.3692668-18-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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: 0F03721E1B 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)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; RCVD_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_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_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; 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: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: 1789430685970158500 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 | 318 ++++++++++++----------------- migration/options.h | 19 +- migration/savevm.c | 8 +- tests/qtest/migration/misc-tests.c | 145 +++++++++++++ 6 files changed, 289 insertions(+), 225 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 36db60ad58..fcfb82ad57 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 if (migrate_local() && migrate_mode() !=3D MIG_MODE_CPR_EXEC && @@ -4092,22 +4093,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 683bc7bdd5..7f005bd12c 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 432037aae0..02b9c64ae6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -87,9 +87,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 *, \ @@ -197,32 +194,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 @@ -305,7 +312,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) @@ -319,42 +326,42 @@ 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_local(void) @@ -367,102 +374,100 @@ 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(); @@ -514,44 +519,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; @@ -560,34 +527,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; } @@ -595,30 +556,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"= ); @@ -626,27 +580,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. @@ -662,41 +616,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; } @@ -708,22 +666,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; @@ -736,30 +694,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"= ); @@ -777,7 +734,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; @@ -839,39 +796,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 */ @@ -932,9 +887,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) @@ -1459,6 +1413,10 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (!migrate_caps_check(params, errp)) { + return false; + } + return true; } =20 @@ -1479,20 +1437,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 f7bf56e9ff..28cf762ace 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); @@ -100,4 +86,5 @@ void migrate_capability_set_compat(MigrationParameters *= params, int i, bool val); void migrate_capabilities_set_compat(MigrationParameters *params, MigrationCapabilityStatusList *caps); +bool migrate_caps_check(MigrationParameters *new, Error **errp); #endif diff --git a/migration/savevm.c b/migration/savevm.c index 4b590ea672..27e68a4c7b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -296,7 +296,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++; } } @@ -318,7 +319,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; } } @@ -367,7 +369,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 49280e5bc9..ef94a47b83 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -27,8 +27,11 @@ static char *tmpfs; #ifdef CONFIG_HMP static int test_case_line; =20 +#define TEST_IF(i1, i2, e, c) { i1, i2, e , .line =3D __LINE__, .skip =3D = !c } #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") =20 typedef struct HMPTestData { const char *input1; @@ -136,6 +139,7 @@ static void assert_hmp_success(const char *str) =20 static void test_hmp_migration_parameters(char *name, MigrateCommon *args) { + MigrationTestEnv *env =3D migration_get_env(); QTestState *qts; /* * .input1: string to be used as parameter name @@ -154,6 +158,147 @@ static void test_hmp_migration_parameters(char *name,= MigrateCommon *args) TEST("cpu-throttle-tailslow", "on", "on"), TEST("direct-io", "on", "on"), TEST("local", "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_IF("background-snapshot", "on", "on", env->has_uffd), + TEST_IF("dirty-bitmaps", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("postcopy-blocktime", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("late-block-activate", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("multifd", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("pause-before-switchover", "on", BG_SNAP_MSG, env->has_uff= d), + TEST_IF("auto-converge", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("release-ram", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("rdma-pin-all", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("validate-uuid", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("zero-copy-send", "on", BG_SNAP_MSG, env->has_uffd), + TEST_IF("postcopy-ram", "on", BG_SNAP_MSG, env->has_uffd), + 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_IF("background-snapshot", "on", BG_SNAP_MSG, env->has_uffd), + TEST("mapped-ram", "on", + "Error: Postcopy Preempt is incompatible with fast snapshot l= oad"), + 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_IF("background-snapshot", "on", BG_SNAP_MSG, env->has_uffd), + + 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' " + "requires capability 'return-path'"), + + /* + * xbzrle: + * rejected by multifd + */ + TEST("xbzrle", "on", "on"), + TEST("multifd", "on", "Error: Multifd is not compatible with xbzrl= e"), + 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:51:03 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=1789430657; cv=none; d=zohomail.com; s=zohoarc; b=jcaPkq2PjH3CkOG6GufHPBgwa5WcIZym3K36BTV75JbQPAeRSBooVUUjtZ8EG+XikxU8fc4tolV68fASr5+I3+3IhfAnVLX8/y6nnRMqo5ht4wa8TdQ5zQk+7h+G+CUYvGH9eVjvR1TnnQG6rXeIvDaHhAukznkARHNLazUBz3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430657; 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=VHQlNkAB+fu+UNIC5p7LfJycWaxCByQ0SaRvTj5kkIQ=; b=NUVGG6y083Xcz0ofNuj9cbAoG43Gu6AQMVl4tt0U53N50j9fi69Y1T8DeOdqVdnlkO3O1h3+P+MJGXPjMMVtqUTdGr8jJC8rhmjAFgjT11h8gF9VBcFJ54XVC8dWnXZ4HcTbCL9JLSZf3maIh+xz5Sl+thCbNS8cN1ibxiP21+w= 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 1789430657015185.21159699474435; Mon, 14 Sep 2026 17:04:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Gda-000475-QF; Mon, 14 Sep 2026 20:03:02 -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 1x6GdX-0003uM-8Y for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:59 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x6GdV-0004qL-EF for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:02:58 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E507321E1F; Tue, 15 Sep 2026 00:02:47 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 520561388C; Tue, 15 Sep 2026 00:02:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T19 (envelope-from ); Tue, 15 Sep 2026 00:02:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430572; 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=VHQlNkAB+fu+UNIC5p7LfJycWaxCByQ0SaRvTj5kkIQ=; b=HFjgwSDk/a3enNLOWHxymkaak2MQIjWlPI6fJamnt2xGWa4CvQxf7XOJWcLDm8kHMtEfo/ GbaRrpQdCNG4VV8mjWsspoKJZSzTiQXUTyNJseDsoymgF8+cKxDQAibQOpnc1K7K0iSi7G rcgeluqbOcLX+38s8Fm1C+nKB8fsUNg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430572; 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=VHQlNkAB+fu+UNIC5p7LfJycWaxCByQ0SaRvTj5kkIQ=; b=segwyPdQIe1xWSKHI4o8troAceQcaTkf5uq7tWtgYYvV5CKzUbUYd9361RAupLK2/Hobvu BvSpzno6zrA028CQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=eG35jlLG; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9wUN2LcH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430567; 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=VHQlNkAB+fu+UNIC5p7LfJycWaxCByQ0SaRvTj5kkIQ=; b=eG35jlLGmDIqzSTyn96XqbS8FDXLEk6CyLAyJ72irnigRAjgyaor/alwjP9cs63+EKGNhS /DQcflPxncEXwEQiyqvW2L+L75l/Lmewn9RXz1WlOcK/S3ql0ig+o0HMevT1gIsWIEZ2cX Y5F0bKGDibVA6gRR5md5JUg1njUu5Cg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430567; 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=VHQlNkAB+fu+UNIC5p7LfJycWaxCByQ0SaRvTj5kkIQ=; b=9wUN2LcHHw717h2R3oW6n6u4rga85T+ivyT2NB0sGAnGvgnZ0/zLaHTR/dKu9tI2VqVKlG k28kNt43t9kc4+Dw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Pierrick Bouvier , Eric Blake Subject: [PATCH v3 18/20] qapi/migration: Deprecate capabilities commands Date: Mon, 14 Sep 2026 21:02:06 -0300 Message-ID: <20260915000209.3692668-19-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: E507321E1F 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)[]; TO_DN_SOME(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email,suse.de:mid]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; 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=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: 1789430657657158500 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 ccbc421949..910455df46 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -524,3 +524,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 c63d7f1ccb..9f530e3c57 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -309,6 +309,9 @@ void hmp_info_migrate_capabilities(MonitorHMP *hmp, con= st 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) { @@ -512,6 +515,9 @@ void hmp_migrate_set_capability(MonitorHMP *hmp, const = QDict *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 9ebd266fcf..b303e91456 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 From nobody Sat Sep 26 20:51:03 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=1789430672; cv=none; d=zohomail.com; s=zohoarc; b=D4HeA9KmVaO62iHn2VnhcYvJbhjzB911VqMbunlP5EkFl3FLQ/ZURxCVQ+qYFQrmMPWZZPoPVQ2e2Ny/CV+WdFY2Yl+eJmFiSFpurb7do8tOl8No7aZZIiBsIN217HsL2Ym6rV7u92JZ3NXOpELw3+4SpDrkPvzp3Y5UQ2r9DR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430672; 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=jPvwycNyQs2pn88XuN23N7lSvba6kB/+ocG2WCqZdu4=; b=WRikF1+fDws5Y1UK0v/n4xCsYYvCZOLctLK4edsQz08JKAIkT9A1CrE5R/lIMHKNZBO/ulLEX/FGl7BW8EjsA52ax054UoxLUm4X8uD1Ss3JqEGAREHKGyAWDMhGqrDhvgXz1ltT8+3OOyf4OqnLasn64BF4Pehmh+uPY+SoGp8= 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 1789430672446185.89238035694927; Mon, 14 Sep 2026 17:04:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Gdb-00049Y-BJ; Mon, 14 Sep 2026 20:03:03 -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 1x6GdZ-00043f-BU for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:03:01 -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 1x6GdX-0004qQ-5m for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:03:00 -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 9E34B21E23; Tue, 15 Sep 2026 00:02:49 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 36F30136D9; Tue, 15 Sep 2026 00:02:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T20 (envelope-from ); Tue, 15 Sep 2026 00:02:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430573; 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=jPvwycNyQs2pn88XuN23N7lSvba6kB/+ocG2WCqZdu4=; b=yfHxRgHRYHMhXGmBQpPAZ0W7WvfsTdAukWXXeUh8ZxV4/m/Q3oDhzDnDQVeCeHYIe6W5v2 +j3njbP7ZiM/6qz7lnuc6SJcCRjEa2RwZ0b8LNLgyqb6tNjB3OXUaZOZF5KGjJpf1j/05o Xjs3uQV28aq38C2yUJ+P4fbkGz1ylcU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430573; 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=jPvwycNyQs2pn88XuN23N7lSvba6kB/+ocG2WCqZdu4=; b=c7PTCtFa9+/nY1fOHBOIbdnxvwBnvfK4kU3xRSY8ii3hAtjDpuMaEbJLdl1VAFNcFSNdUT fRABsfw1vHUd1+CQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GBu2Vrqd; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=dupHrCj0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430569; 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=jPvwycNyQs2pn88XuN23N7lSvba6kB/+ocG2WCqZdu4=; b=GBu2VrqdX6W//vqCeJXCwvCVwPFmA4VmLB/RMeSvEbvef6YF87R6b4sA9j6IA77HaU1hYp NQshAYVX0HGjxEyYSXlo6taJ06ixKO9BCWKv6P+85krY+If6LKceCUZmrLYT8QH8GYkPyC s7z80OOj/fieUIJ6SaZsMYPVmCWNjM0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430569; 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=jPvwycNyQs2pn88XuN23N7lSvba6kB/+ocG2WCqZdu4=; b=dupHrCj0ePDeAF7rXlqbCmLOZo7S29BPjiR4Ks/TLPIxUI4RvasFews+20B+b2BhvjDNV0 wvzWmkToYGnXwGDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Michael Roth Subject: [PATCH v3 19/20] migration: Set the parameters present flag with a clone visitor Date: Mon, 14 Sep 2026 21:02:07 -0300 Message-ID: <20260915000209.3692668-20-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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: 9E34B21E23 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; 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.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: 1789430673921158500 Content-Type: text/plain; charset="utf-8" The MigrationParameters object is defined by the QAPI. It is also used by the migration code as its internal store of parameters. Due to a historic coupling of the migration code with qdev properties, when a migration parameter has its initial value set by qdev, the QAPI present flag for that parameter is kept unset. This is fine as long as the MigrationParameters object is not used to interact with the QAPI (e.g. as input to query-migrate) or the visitors infrastructure (e.g. using QAPI_CLONE to duplicate an object). Recent changes have removed code duplication and complexity in the aforementioned interactions by adding a helper that attempts to ensure consistency by setting all of the present flags for a (manually kept) list of parameters. See commit f55f4ef632 ("migration: Extract code to mark all parameters as present"). There are still some drawbacks to this scheme such as the need to keep the list of parameters updated. Replace the logic with a walk from a custom visitor that force sets each present flag and dispenses with all manual updates as it uses the QAPI generated code and will not become out of sync with MigrationParameters. This also allows the removal in the next patch of the MigrationParameter enum which is the last place where migration parameter names need to be replicated. Suggested-by: Markus Armbruster Signed-off-by: Fabiano Rosas --- include/qapi/clone-visitor.h | 1 + migration/migration.c | 2 +- migration/options.c | 77 ++++++++++++------------------------ migration/options.h | 2 +- qapi/qapi-clone-visitor.c | 13 ++++++ 5 files changed, 41 insertions(+), 54 deletions(-) diff --git a/include/qapi/clone-visitor.h b/include/qapi/clone-visitor.h index ebc182b034..04cd1a88d1 100644 --- a/include/qapi/clone-visitor.h +++ b/include/qapi/clone-visitor.h @@ -22,6 +22,7 @@ typedef struct QapiCloneVisitor QapiCloneVisitor; =20 Visitor *qapi_clone_visitor_new(void); +Visitor *qapi_clone_visitor_new_all(void); Visitor *qapi_clone_members_visitor_new(void); =20 /* diff --git a/migration/migration.c b/migration/migration.c index fcfb82ad57..f92d13234f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4076,7 +4076,7 @@ static void migration_instance_init(Object *obj) qemu_event_init(&ms->pause_event, false); qemu_mutex_init(&ms->error_mutex); =20 - migrate_params_init(&ms->parameters); + migrate_params_init(ms); =20 qemu_sem_init(&ms->postcopy_pause_sem, 0); qemu_sem_init(&ms->rp_state.rp_sem, 0); diff --git a/migration/options.c b/migration/options.c index 02b9c64ae6..8d869209ee 100644 --- a/migration/options.c +++ b/migration/options.c @@ -233,6 +233,31 @@ const Property migration_properties[] =3D { }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 +/* + * After qdev sets the defaults for the migration parameters using the + * migration_properties above, s->parameters is left inconsistent from + * QAPI point of view because the parameters' present flag is not + * set. Use the custom-built qapi_clone_visitor_all() to copy + * s->parameters back to itself while setting all present flags. The + * resulting object is fit to be used with QAPI and the visitor + * infrastructure. + * + * WARNING: missing entries in the migration_properties array in + * respect to MigrationParameters will still have their corresponding + * struct member marked as present. + */ +void migrate_params_init(MigrationState *s) +{ + Visitor *v =3D qapi_clone_visitor_new_all(); + g_autoptr(MigrationParameters) p =3D &s->parameters; + + visit_type_MigrationParameters(v, NULL, &p, &error_abort); + visit_free(v); + migrate_params_free(&s->parameters, &error_abort); + QAPI_CLONE_MEMBERS(MigrationParameters, &s->parameters, p); +} + + static void get_StrOrNull(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -1121,53 +1146,6 @@ static MigrationParameters *migrate_params_from_dict= (QDict *d, Error **errp) return tmp; } =20 -/* - * query-migrate-parameters expects all members of MigrationParameters - * to be present, but we cannot mark them non-optional in QAPI because - * the structure is also used for migrate-set-parameters, which needs - * the optionality. Force all parameters to be seen as present - * now. Note that this depends on some form of default being set for - * every member of MigrationParameters, currently done during qdev - * init using migration_properties defined in this file. The TLS - * options are a special case because they don't have a default and - * need to be normalized before use. - */ -static void migrate_mark_all_params_present(MigrationParameters *p) -{ - int len, n_str_args =3D 3; /* tls-creds, tls-hostname, tls-authz */ - bool *has_fields[] =3D { - &p->has_throttle_trigger_threshold, &p->has_cpu_throttle_initial, - &p->has_cpu_throttle_increment, &p->has_cpu_throttle_tailslow, - &p->has_max_bandwidth, &p->has_avail_switchover_bandwidth, - &p->has_downtime_limit, &p->has_x_checkpoint_delay, - &p->has_multifd_channels, &p->has_multifd_compression, - &p->has_multifd_zlib_level, &p->has_multifd_qatzip_level, - &p->has_multifd_zstd_level, &p->has_xbzrle_cache_size, - &p->has_max_postcopy_bandwidth, &p->has_max_cpu_throttle, - &p->has_announce_initial, &p->has_announce_max, &p->has_announce_r= ounds, - &p->has_announce_step, &p->has_block_bitmap_mapping, - &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, - &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, - &p->has_x_rdma_chunk_size, &p->has_cpr_exec_command, &p->has_local, - &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, - }; - - len =3D ARRAY_SIZE(has_fields); - assert(len + n_str_args =3D=3D MIGRATION_PARAMETER__MAX); - - for (int i =3D 0; i < len; i++) { - *has_fields[i] =3D true; - } -} - MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationState *s =3D migrate_get_current(); @@ -1188,11 +1166,6 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) return params; } =20 -void migrate_params_init(MigrationParameters *params) -{ - migrate_mark_all_params_present(params); -} - static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 28cf762ace..7abd527610 100644 --- a/migration/options.h +++ b/migration/options.h @@ -78,7 +78,7 @@ ZeroPageDetection migrate_zero_page_detection(void); uint64_t migrate_rdma_chunk_size(void); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); -void migrate_params_init(MigrationParameters *params); +void migrate_params_init(MigrationState *s); bool migrate_params_free(MigrationParameters *params, Error **errp); QDict *migrate_params_to_dict(MigrationParameters *p, Error **errp); bool migrate_capability_get_compat(MigrationParameters *params, int i); diff --git a/qapi/qapi-clone-visitor.c b/qapi/qapi-clone-visitor.c index 30997638de..8e2135b78e 100644 --- a/qapi/qapi-clone-visitor.c +++ b/qapi/qapi-clone-visitor.c @@ -174,6 +174,19 @@ Visitor *qapi_clone_visitor_new(void) return &v->visitor; } =20 +static void qapi_clone_optional_all(Visitor *v, const char *name, bool *pr= esent) +{ + *present =3D true; +} + +Visitor *qapi_clone_visitor_new_all(void) +{ + Visitor *v =3D qapi_clone_visitor_new(); + + v->optional =3D qapi_clone_optional_all; + return v; +} + Visitor *qapi_clone_members_visitor_new(void) { Visitor *v =3D qapi_clone_visitor_new(); --=20 2.53.0 From nobody Sat Sep 26 20:51:03 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=1789430677; cv=none; d=zohomail.com; s=zohoarc; b=CLlWSkJS+En2EEcviV1OTL57ViZ86yh42hOW7rO4rqURbE5UpW9Gtp3T1piOIxiBL3CtE06EiSNqkAoCvS3FwFyG730t/jmfCf3ZsCaYSTz0yTOBhv3O49z2CcJ5v9KS4F16+2Li6g5AqNlIAdLd7GtiQlY70suywvyfMqU5nSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789430677; 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=RWLyAQI8rH4KCZ+XK+8nFWATteNCHFMVIwTcysQXND0=; b=T3fWRoL0QaeE+ThdFqRC/UrDr2BFMD6RgZHuuXQwF4CgxCzAWlP6cKbyneniwOMV/u0N6Rp+eAgY9/w4SR9Ao97Cp9snbQijVipTR7oalB7SNAYKq+3Ki55P6FLBpwxJY9ndmwI7YzRiN8kUAZPYuGlASyid4OILqBfrDN1BvbA= 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 1789430677778685.7604667263213; Mon, 14 Sep 2026 17:04:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Gdf-0004Oi-AP; Mon, 14 Sep 2026 20:03:07 -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 1x6Gda-00047U-Dq for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:03:02 -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 1x6GdY-0004qk-NH for qemu-devel@nongnu.org; Mon, 14 Sep 2026 20:03:02 -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 51DE61FF46; Tue, 15 Sep 2026 00:02:51 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DF15213710; Tue, 15 Sep 2026 00:02:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Gk6xFQeLqGqIFAAAD6G6ig:T21 (envelope-from ); Tue, 15 Sep 2026 00:02:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430575; 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=RWLyAQI8rH4KCZ+XK+8nFWATteNCHFMVIwTcysQXND0=; b=gKICXjpRM5aUgubv1hymlVXBGrfVAt7NXCKsJSMO2FdyB+VGlE3nuUdbQHIYIZA8daXYkL inHhsDq4IpxJtmaxiUvFWVZFOYLAB22vgGYpMe7yWh3n+rOTz3LYUXiS2hHoZbdBVwiAeS eRR89rjkVEwMoxFx4PwKqsPpKBd0yI4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430575; 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=RWLyAQI8rH4KCZ+XK+8nFWATteNCHFMVIwTcysQXND0=; b=Rc3jjmsun/09i2nO489KWer6ezkPNZdeFkkKrtBDS8+RCvwbGe9CVOYXFlF3Is4AGcs1ng QagXl8OTpBapv2Bg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GxUzBIKm; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ASPjE1Qf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789430571; 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=RWLyAQI8rH4KCZ+XK+8nFWATteNCHFMVIwTcysQXND0=; b=GxUzBIKmeJYjkIWy2GHz8znT13OKUW5Ny81C2qLsvn8NpU+lQb7x1h+hHKzXlDrYSv7FrY 5DNRzMfRf83LMv8mOO+D/DJtKTJ8wlsdBHfWz2aiB66Y5bEytXsrv5GVaaoBIYb3FkcZey zW+rd/EnOpt1xZsEsMs1tSVxj5GXsRU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789430571; 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=RWLyAQI8rH4KCZ+XK+8nFWATteNCHFMVIwTcysQXND0=; b=ASPjE1QfO3i5Ks+wHAl7K/eyqJHnt/T/TPbgfjyQfJn9WSXgOfYO6QzzoAHCzsa/1FLh9U VFBR/WGftNTdq7Bw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Eric Blake Subject: [PATCH v3 20/20] qapi: Remove MigrationParameter Date: Mon, 14 Sep 2026 21:02:08 -0300 Message-ID: <20260915000209.3692668-21-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260915000209.3692668-1-farosas@suse.de> References: <20260915000209.3692668-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: 51DE61FF46 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)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; 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:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org: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=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: 1789430679793158500 Content-Type: text/plain; charset="utf-8" The MigrationParameter enum is now unused, remove it. Signed-off-by: Fabiano Rosas Reviewed-by: Markus Armbruster --- qapi/migration.json | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index b303e91456..9f3b9b718d 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -808,49 +808,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', - 'local', 'xbzrle', 'rdma-pin-all', 'auto-converge', 'events', - 'postcopy-ram', 'x-colo', 'release-ram', 'return-path', - 'pause-before-switchover', 'multifd', 'dirty-bitmaps', - 'postcopy-blocktime', 'late-block-activate', 'x-ignore-shared', - 'validate-uuid', 'background-snapshot', 'zero-copy-send', - 'postcopy-preempt', 'switchover-ack', 'dirty-limit', - 'mapped-ram'] } - ## # @migrate-set-parameters: # --=20 2.53.0