From nobody Sat Sep 26 20:50:53 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=1788990379; cv=none; d=zohomail.com; s=zohoarc; b=KhTxGvCyUFIyblEQA50UHrIFRfuy5me5nsMw3eoKB00zAlv9FxU1ZuuVkizX/mTzluTmAhxuLGZt2eRJngDWeoxu8g8R5fK/mdzsJWjXZHrZpHhJz8MZAeE1MHASQ7CfQdu4cMZZIR/OgZTCpI9F6c87jicFM7IkZKQH829YygU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990379; 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=i0xypdlguFgZqf9pf4kZeAPVThtLBKBKIFhZdXB6v4k=; b=AO+t7bYKNhNgsvYDWGmAib0Rjx2N/RSFDRolSe5ntBc4RvDqSfAwNbl1b16PVZFyGrX2cA8zY3eTskOsZD8JcYaytOXyTMY8PaNYYNm+zzilSVX+fdn0hGnKexMvtzkEodAVHeljxkUwsQneuLJtWHtNSHrHkOgsDM4B3ykhkVg= 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 1788990379364269.4348238003282; Wed, 9 Sep 2026 14:46:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q6r-0000Um-9S; Wed, 09 Sep 2026 17:45:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4Q6p-0000Tj-2K for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:35 -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 1x4Q6m-0005L0-6T for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:34 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 443FB21C86; Wed, 9 Sep 2026 21:45:19 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8C716136ED; Wed, 9 Sep 2026 21:45: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 YK9xFW3ToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990323; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i0xypdlguFgZqf9pf4kZeAPVThtLBKBKIFhZdXB6v4k=; b=vSBZbAaFCReVaeIFizOmSzqALwt5qazQZCtF+1CX/Ol9eHiJJA3GIldgxQXvDQLa7K7CSe aVe1NqdgKZlTtVOz8F0Kg+4LA0pRsZpYIcW8LcfNmNKrt8yR+7rkLVY/Oq3AITQQjE6FMH csT/cgpEG5jCfrJ/9R7I7DlO5kZ3Bjs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990323; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i0xypdlguFgZqf9pf4kZeAPVThtLBKBKIFhZdXB6v4k=; b=ldBq1TNCB6r1uAcKqloH1nKzuExFoZR9YH8LgJH4KVlbFY6FXXAT6UAucyq0BDtxusbz91 Spa3vAK7sWlOvuAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xlpZm5VJ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=sKJb0szh DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990319; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i0xypdlguFgZqf9pf4kZeAPVThtLBKBKIFhZdXB6v4k=; b=xlpZm5VJDsfSGPUg9M5gamPysFLeVUhIb25cz2cnR4KODpemGa39jJkY17pbRqMt1p1XAi i2yg3UHAjdbWmCfintzTSb2ajFMTd/h02iBBcwiubnUZZ8erOBLSpWiqzRJtEPEqXa8XWi Z7zlLBZxeWPCp4UvRYRKlm8w82/w6AE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990319; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i0xypdlguFgZqf9pf4kZeAPVThtLBKBKIFhZdXB6v4k=; b=sKJb0szhtOBveQ8A5CK3gbOQQqZK6RQxZ3ctkQ+tRgCdIqwmobn+ObkNkCcmigxz8qqzdQ ED7FCBOiFjRZxjAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Chao Liu Subject: [PATCH v2 01/18] checkpatch: Fix checking of newlines in error messages Date: Wed, 9 Sep 2026 18:44:51 -0300 Message-ID: <20260909214509.237309-2-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 443FB21C86 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)[]; 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:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[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=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: 1788990384470158500 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 03f35e7501..8fd38868c5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3303,13 +3303,20 @@ sub process { info_vreport| error_report| warn_report| - info_report| - g_test_message}x; + info_report}x; =20 if ($rawline =3D~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) { ERROR("Error messages should not contain newlines\n" . $herecurr); } =20 + # No newlines at the end + my $trail_newline_error_funcs =3D qr{g_test_message}x; + + if ($rawline =3D~ /\b(?:$trail_newline_error_funcs)\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:50:53 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=1788990444; cv=none; d=zohomail.com; s=zohoarc; b=QZnzpwmza7mNeHchkyISG3m1E1OAjuRusTboQlCV5EY502FemomyO09vx4ataDeKV0DqAuCppug1ztX2iEoUMbItVIi9Vcvg2j4HHiSg7CJeLuf/PWaJbNs84k+gesrkjSwzZyaL9jaRkuYBw8fDmok/B7xF4oYFluWng6a97Cg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990444; 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=X8uosMPIIMsZC1d5uoElxJndzDZLRCqxGsoW5xvZy8A=; b=cyFTrDXP4o6up7f1rP4fAitGU9fGuq9NjZ4dmgguLBuya6K+tGNYJGraAPP0m2fEUPlTUqW/R6xn1V7I+a1nqDMEJIKdKhlTdIgEJwwCZHFBdKTwMCuwClb0BkZxI4XQFqvd7K0vGdPpt4DBiT75H00BlujNkxc3RgX5OWl503E= 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 1788990444535800.9033702903185; Wed, 9 Sep 2026 14:47:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q6q-0000Tz-0W; Wed, 09 Sep 2026 17:45:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4Q6n-0000TT-Nj for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:34 -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 1x4Q6m-0005Ls-6Q for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:33 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E50A521C91; Wed, 9 Sep 2026 21:45: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 725D31376E; Wed, 9 Sep 2026 21:45:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iKgZEG/ToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990325; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X8uosMPIIMsZC1d5uoElxJndzDZLRCqxGsoW5xvZy8A=; b=D81WBFpDF0dI/pgYwh/Ld4DeOZPEWRYqriITzfnpdPvSW1ZKsBhsg6UouzOXqRco6qxYSs lf2D7hQx+mVfRq7jlYQjnof3tfSuUk6VWLWluDGdC3EkorEo6XvypQb0yspUqlpmUBebab dNhvdFPEvFk3sQwSJWpOs9pLFBNh/Vg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990325; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X8uosMPIIMsZC1d5uoElxJndzDZLRCqxGsoW5xvZy8A=; b=Wr7BXMC1mbgbJ96eqPPNtNmAtN4mjlSkp3bm8ngMU1evoB6aS6Rm0rkbeWWhhCJgFb7Yly A95PmP1ilHY3ToBQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=QI5OjfOS; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="zb/A0Szv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990320; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X8uosMPIIMsZC1d5uoElxJndzDZLRCqxGsoW5xvZy8A=; b=QI5OjfOS3PgMzdjLdSIX63rJsdIGc9iCWJfqwUuLXfQa6ZofBXlFrJJjoLbxPs16ShCphP yhm9Qmh92VMo3D1X/En4O4jCZ/zNYE5lPTBG9jDODl5L/6b6tDvvOUGV0SyeX2ItNSkoDh hU1rcUHgaGDJuLv0KTGjBT11i/+ZSeg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990320; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X8uosMPIIMsZC1d5uoElxJndzDZLRCqxGsoW5xvZy8A=; b=zb/A0SzvmCCMFleawo5r7S8P4JPBh+WUUKZgWORQ3RHZhlwIMM7VaBSjNPG/Zq58X6Gmcj 3T8gXR0W9NiUH1DQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v2 02/18] migration/options.c: Don't export migrate_tls_opts_free Date: Wed, 9 Sep 2026 18:44:52 -0300 Message-ID: <20260909214509.237309-3-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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: E50A521C91 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.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: 1788990446490158500 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 d2575edb6c..79a61ac60d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1055,7 +1055,7 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 -void migrate_tls_opts_free(MigrationParameters *params) +static void migrate_tls_opts_free(MigrationParameters *params) { qapi_free_StrOrNull(params->tls_creds); qapi_free_StrOrNull(params->tls_hostname); diff --git a/migration/options.h b/migration/options.h index 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:50:53 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=1788990451; cv=none; d=zohomail.com; s=zohoarc; b=ha54GJk3cgFoj8jyPF7zysoSEwzAkPG9d9UzCUZDpd1AFTNSSXzpkUetsAgfds+Bi+mSElgmE45k3Q8tT5kgRsEt0N4nC3rz2lA7y4yjUVQF5CRYTIlaTrujjoza2w27FQ0YTpMC25snBZwgMF0BPSrxfKaFwiJttlkmYInFHqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990451; 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=LA4d2PH/+ZbaHu3lLJaInz+wriMUq0GqaD1JIT9q5iE=; b=PwIvW7kFaFUuuD0Ne+04XZ3fSZLMyEN9MCWUVSSzy3pdh5nVtPpTmWyBI9+esZQ8jOmgzb/61qFrwgntmUUV3WoGjDDiCBIJAnWINI9leeDSviSuLRVRXbiHXLsr3O7FAo0sneBvoEahKiVBHegM6a3gii6QWRLsK+5Z7D8QsEo= 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 1788990451850171.11423063336144; Wed, 9 Sep 2026 14:47:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q6q-0000U0-4Y; Wed, 09 Sep 2026 17:45:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4Q6p-0000Tk-4J for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:35 -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 1x4Q6m-0005M5-6X for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:34 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A48BE1FCCD; Wed, 9 Sep 2026 21:45:22 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1F2B513770; Wed, 9 Sep 2026 21:45: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 QMeUNnDToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990326; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LA4d2PH/+ZbaHu3lLJaInz+wriMUq0GqaD1JIT9q5iE=; b=r4FLgjj3iYZYfSHwhZsaBym7X+t9EXY4GOxpGMmVx5M8CJfI6p1v//J7LrSGF7BMc6ekrF U/bWKBukt9PR0dgEIOKEPRaPvzZj6RJr3399RTpeMgZ0+nXHLxWpmH3NeNjerrQrip0EQB MPuO6KDmcOKtt0HyYqBo46X4cuDXJKk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990326; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LA4d2PH/+ZbaHu3lLJaInz+wriMUq0GqaD1JIT9q5iE=; b=5skhILZZa3q9gJrlWoWUn56PLgqanBxu7z0K6U0hqGr1wMgFLeKe6rG+qRPC0EOutiHSW4 xsw8wcqpFPtJN3Bw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Fm9mBbOX; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=k3KQWrPo DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990322; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LA4d2PH/+ZbaHu3lLJaInz+wriMUq0GqaD1JIT9q5iE=; b=Fm9mBbOXaxMYK+XhLw5E3LR4OvzKWzPAAgiWY5mAGPgAFFLJ2MENQHkbgGE9tm4R9/SDPk KIUclWlYur9RiMTcRAV5nJF47mHGowAGxm17OHBzzfGvsBxCEooE4Xyj9b9tFpBXZv6kHN X0fwrjZxTSm2STvo0wdMWS7BrQcRn3g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990322; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LA4d2PH/+ZbaHu3lLJaInz+wriMUq0GqaD1JIT9q5iE=; b=k3KQWrPoRAVd9pHeXEsLPd7PlCgPeiMZb+y08JQtC9pkuSKXlxNXpyyfsJaqkMMfVn+NkU mTK+d5I1PlZspjCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v2 03/18] migration: Rename variables in qmp_migrate_set_parameters Date: Wed, 9 Sep 2026 18:44:53 -0300 Message-ID: <20260909214509.237309-4-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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: A48BE1FCCD 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,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de: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: 1788990454572158500 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 79a61ac60d..388cb07dd0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1583,9 +1583,9 @@ static void migrate_params_apply(MigrationParameters = *params) } } =20 -void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +void qmp_migrate_set_parameters(MigrationParameters *input, Error **errp) { - MigrationParameters tmp; + MigrationParameters new; =20 /* * Convert QTYPE_QNULL and NULL to the empty string (""). Even @@ -1595,18 +1595,18 @@ void qmp_migrate_set_parameters(MigrationParameters= *params, Error **errp) * the options to the rest of the migration code already use * return NULL when the empty string is found. */ - tls_opt_to_str(params->tls_creds); - tls_opt_to_str(params->tls_hostname); - tls_opt_to_str(params->tls_authz); + tls_opt_to_str(input->tls_creds); + tls_opt_to_str(input->tls_hostname); + tls_opt_to_str(input->tls_authz); =20 - migrate_params_test_apply(params, &tmp); + migrate_params_test_apply(input, &new); =20 - if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(params); - migrate_post_update_params(params, errp); + if (migrate_params_check(&new, errp)) { + migrate_params_apply(input); + migrate_post_update_params(input, errp); } =20 - migrate_tls_opts_free(&tmp); - qapi_free_BitmapMigrationNodeAliasList(tmp.block_bitmap_mapping); - qapi_free_strList(tmp.cpr_exec_command); + migrate_tls_opts_free(&new); + qapi_free_BitmapMigrationNodeAliasList(new.block_bitmap_mapping); + qapi_free_strList(new.cpr_exec_command); } --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990458; cv=none; d=zohomail.com; s=zohoarc; b=Hf77By0aAk0YecTZty/wiQzO+0rJyunJt4BPD9nwKgmnnNkT1y9D6Sn8Z57M6Z3VSkXVmbHiU9/YZ+QsZbZ+kMyZXkDPJdF8bkLj5gU12dCgSHMR7FMxYz309LcQyTA6N8Y/QAEnh91XXruiPWpPyvRF+NRYMEGRAue1myI+kFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990458; 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=E8a0+shQA1bFqU78Yrn8Y5Tr2oA4RSJ+TnbONJHpClc=; b=R1MRfayFtguDIfm+a8bua3/8my+QweuwH/FD2ze8FMA+RzUOab8fKSTDs6A7bv9jDNBOMu1WMi2XHAvQCiCokGHxRvCswbb8o2OUuBGXxEeCBo8AquGGMWYadqZ3/J1mJxbioPxgHEVvhFcv4FJjVrwLPZH1Gl+E7kcEXqTnL4o= 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 1788990458523422.6845387893359; Wed, 9 Sep 2026 14:47:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q6r-0000Uo-SL; Wed, 09 Sep 2026 17:45:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4Q6q-0000U1-54 for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:36 -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 1x4Q6o-0005MM-67 for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:35 -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 9B1D621C7A; Wed, 9 Sep 2026 21:45:24 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DA103137EC; Wed, 9 Sep 2026 21:45:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aNhuKHLToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990328; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8a0+shQA1bFqU78Yrn8Y5Tr2oA4RSJ+TnbONJHpClc=; b=b8KvhAjA3/EwvgUKUqTW3lRVeXsgeLDir/nlyowqtHYHo/HT6TzL57PAhERlzLNn1Zc22w GYBn8J4NDUTA9OGITlUyioqE1z7lcohlyqxzx5fqy88iMhvAr8R8kj7JA1zpP76yoSpVti ByRxu4tIDEmMp1AQiW1++f9NvNHKlHs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990328; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8a0+shQA1bFqU78Yrn8Y5Tr2oA4RSJ+TnbONJHpClc=; b=nEan61cluKezh39dPz1cSDP46M593jJjoVnemYt4I7OjpH39FBaeBYtT1WjOXtLVird0sl 52EmVKF0/0uU+ACg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990324; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8a0+shQA1bFqU78Yrn8Y5Tr2oA4RSJ+TnbONJHpClc=; b=SsirIcJiNXmPCnbMOjXwpRk/LTQmTyBldD9lAQ6qUl4i4OyQimikPMYudHg19FvO2HwpFa HPxB6BLv2Fl5y+iMSPinuLxPF4kOZ/AgGAS21xyV3QWG3rL+KVxm6oE1NmiYnpqMv9uifG nKQI9tkxa2eAORVvv0j5ORxJUPX4lxA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990324; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8a0+shQA1bFqU78Yrn8Y5Tr2oA4RSJ+TnbONJHpClc=; b=AAzFb49wFiIgaam6j8oJRypsju5IMK8kIesZwVij4sAFK8rwdtSJdfc3ia60/Buuj1mnx3 v0VMyWMO3RcoSnBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Prasad Pandit Subject: [PATCH v2 04/18] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Date: Wed, 9 Sep 2026 18:44:54 -0300 Message-ID: <20260909214509.237309-5-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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)[fedoraproject.org:email,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=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: 1788990460730158500 Content-Type: text/plain; charset="utf-8" Instead of setting parameters one by one, use the temporary object, which already contains the current migration parameters plus the new ones and was just validated by migration_params_check(). Use cloning to overwrite it. This avoids the need to alter this function every time a new parameter is added. Since parameters are not individually checked anymore, the setting of s->has_block_bitmap_mapping moves into migrate_post_update_params(). Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Signed-off-by: Fabiano Rosas --- migration/options.c | 141 +++++--------------------------------------- 1 file changed, 14 insertions(+), 127 deletions(-) diff --git a/migration/options.c b/migration/options.c index 388cb07dd0..6b78795080 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1160,6 +1160,10 @@ static void migrate_post_update_params(MigrationPara= meters *new, Error **errp) migration_rate_set(new->max_postcopy_bandwidth); } } + + if (new->has_block_bitmap_mapping) { + s->has_block_bitmap_mapping =3D true; + } } =20 /* @@ -1451,136 +1455,19 @@ static void migrate_params_test_apply(MigrationPar= ameters *params, } } =20 +/* + * Caller must ensure the has_* fields of @params are true so they all + * get copied and the pointer members don't dangle. + */ static void migrate_params_apply(MigrationParameters *params) { MigrationState *s =3D migrate_get_current(); + MigrationParameters *cur =3D &s->parameters; =20 - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - - if (params->has_throttle_trigger_threshold) { - s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; - } - - if (params->has_cpu_throttle_initial) { - s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; - } - - if (params->has_cpu_throttle_increment) { - s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; - } - - if (params->has_cpu_throttle_tailslow) { - s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; - } - - if (params->tls_creds) { - qapi_free_StrOrNull(s->parameters.tls_creds); - s->parameters.tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_cred= s); - } - - if (params->tls_hostname) { - qapi_free_StrOrNull(s->parameters.tls_hostname); - s->parameters.tls_hostname =3D QAPI_CLONE(StrOrNull, - params->tls_hostname); - } - - if (params->tls_authz) { - qapi_free_StrOrNull(s->parameters.tls_authz); - s->parameters.tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_auth= z); - } - - if (params->has_max_bandwidth) { - s->parameters.max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_avail_switchover_bandwidth) { - s->parameters.avail_switchover_bandwidth =3D params->avail_switcho= ver_bandwidth; - } - - if (params->has_downtime_limit) { - s->parameters.downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_multifd_channels) { - s->parameters.multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - s->parameters.multifd_compression =3D params->multifd_compression; - } - if (params->has_multifd_qatzip_level) { - s->parameters.multifd_qatzip_level =3D params->multifd_qatzip_leve= l; - } - if (params->has_multifd_zlib_level) { - s->parameters.multifd_zlib_level =3D params->multifd_zlib_level; - } - if (params->has_multifd_zstd_level) { - s->parameters.multifd_zstd_level =3D params->multifd_zstd_level; - } - if (params->has_xbzrle_cache_size) { - s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - } - if (params->has_max_postcopy_bandwidth) { - s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - } - if (params->has_max_cpu_throttle) { - s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - s->parameters.announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - s->parameters.announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - s->parameters.announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - s->parameters.announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - qapi_free_BitmapMigrationNodeAliasList( - s->parameters.block_bitmap_mapping); - - s->has_block_bitmap_mapping =3D true; - s->parameters.block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - params->block_bitmap_mapping); - } - - if (params->has_x_vcpu_dirty_limit_period) { - s->parameters.x_vcpu_dirty_limit_period =3D - params->x_vcpu_dirty_limit_period; - } - if (params->has_vcpu_dirty_limit) { - s->parameters.vcpu_dirty_limit =3D params->vcpu_dirty_limit; - } - - if (params->has_mode) { - s->parameters.mode =3D params->mode; - } - - if (params->has_zero_page_detection) { - s->parameters.zero_page_detection =3D params->zero_page_detection; - } - - if (params->has_direct_io) { - s->parameters.direct_io =3D params->direct_io; - } - - if (params->has_x_rdma_chunk_size) { - s->parameters.x_rdma_chunk_size =3D params->x_rdma_chunk_size; - } - - if (params->has_cpr_exec_command) { - qapi_free_strList(s->parameters.cpr_exec_command); - s->parameters.cpr_exec_command =3D - QAPI_CLONE(strList, params->cpr_exec_command); - } + migrate_tls_opts_free(cur); + qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); + qapi_free_strList(cur->cpr_exec_command); + QAPI_CLONE_MEMBERS(MigrationParameters, cur, params); } =20 void qmp_migrate_set_parameters(MigrationParameters *input, Error **errp) @@ -1602,7 +1489,7 @@ void qmp_migrate_set_parameters(MigrationParameters *= input, Error **errp) migrate_params_test_apply(input, &new); =20 if (migrate_params_check(&new, errp)) { - migrate_params_apply(input); + migrate_params_apply(&new); migrate_post_update_params(input, errp); } =20 --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990391; cv=none; d=zohomail.com; s=zohoarc; b=Jg2FLZTRP7kOnFj97iQQ4YUx+GLBwFdA9bHljmfBxk+8B3lqhjjW99YXiu07FM1ExAqAtlNH1gxD/w/ZsoKWR+Bbe/fFGhyU4E2XOA4VW+9CV8xW3KX5/K/ioQPo9MGqPzX5hMv2VZ7IeAKeIqHsJZvBYI7/RmIAn9tXmlytZHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990391; 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=GEZ5bJ6VJJgSBn5kMvZxtzAZaU0wA14TgEPwSA+r/ow=; b=XlgI8flsNwBP24hO0/Q5wIY6XeiK6YtI4tXs2eZ4TzyNKHiu8bXt5Soiqg20V7OH/QgbCnQusJ7NSnUJG+Q8czQ2V6XZ4xehuVh9GFF8AOWRbKxiSpLNC5ZfbhW5BVj2E59J5pptfWwqXaQdrgx+QKchZTTym0jquiy3LBlvinE= 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 1788990391563559.6390781311443; Wed, 9 Sep 2026 14:46:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q6t-0000Vo-UU; Wed, 09 Sep 2026 17:45:39 -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 1x4Q6s-0000Up-9b for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:38 -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 1x4Q6q-0005Mw-5i for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:38 -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 3387B21C92; Wed, 9 Sep 2026 21:45: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 CD3B113892; Wed, 9 Sep 2026 21:45: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 wG6rJXTToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990330; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GEZ5bJ6VJJgSBn5kMvZxtzAZaU0wA14TgEPwSA+r/ow=; b=EcEo47EM5AnpkvAvHAeny0Jh2q6ALJm5AOGw8+22pYiP3S4U3r39CXt8U38A3wZxTIODvq zYEkdeiA03mFzpWiveY5OXZvVkX8zQmnjAu8sJ8gHrzgjFpm7wbFFSCEAfyWMQ5ma1DECy WCiERF/hCQxlZiCmCZOqLDvGnM2BmYM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990330; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GEZ5bJ6VJJgSBn5kMvZxtzAZaU0wA14TgEPwSA+r/ow=; b=oxKImSX6tjMQpFw/U24DCXDGcmX3NMoO5CRg1vSXRCMpjcQoNucVxnDPzyUVvjRieisVQD xdCbmLwE8H8ELrDQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=w5Ns9Hgu; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=roOOB2zp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990326; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GEZ5bJ6VJJgSBn5kMvZxtzAZaU0wA14TgEPwSA+r/ow=; b=w5Ns9HguR8ts3cTlcBqIs5qpm0GPyIwAiIoqFOp/W1bVdpvitWFoAtTi11tVuMP+mkJG4x ysIep0CKzM3aBaECWpydXwpeWXS6Z2YUgHlcRiiSB2p308Rn3ddt42gl9l1ZUg7FHjdg4r qyloWzbq1dUJ4LOhXROG2WTKN+894Dk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990326; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GEZ5bJ6VJJgSBn5kMvZxtzAZaU0wA14TgEPwSA+r/ow=; b=roOOB2zpH5yao78DBuh2N0hUaxlzDSqYjxWR+J93IhOYSz0g8xEdRTOKkER/XZm4qfHLwl QQt3193Q2CaI0BDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v2 05/18] migration: Merge parameter structs instead of assigning one by one Date: Wed, 9 Sep 2026 18:44:55 -0300 Message-ID: <20260909214509.237309-6-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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: 3387B21C92 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,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.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: 1788990392371158500 Content-Type: text/plain; charset="utf-8" Convert the code in migrate_params_test_apply() from an open-coded copy of every migration parameter to a merge operation using QAPI visitors and QDict. The purpose of that routine is to update a temporary structure (pre-populated with the current migration parameters), with the values received from the user via QAPI. As a result, the temporary structure will then contain the "to be applied" parameters and it's validated before being used to overwrite the parameters currently in use. The update is currently done as follows: where 'params' is the user input from QAPI, for each parameter: a) check if the option is present params->has_ =3D=3D true params-> !=3D NULL // for strings b) if the parameter is a pointer, free the to-be-assigned member and allocate memory for the copy from params c) assign the user provided value to the temporary structure. Step (a) is the same in principle as what the QAPI visitors do at visit_type_MigrationParameters_members(). Steps (b) and (c) are roughly the same as what the QDict implementation does when qdict_del() and qdict_put_obj() are combined. Therefore, replace the open-coded function with migrate_params_merge(), which achieves the same goal, but uses visitors and QDict. This hides the details of QAPI (has_*) from the migration code and avoids the need to update migrate_params_test_apply() every time a new migration parameter is added. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/options.c | 200 ++++++++++++++------------------------------ 1 file changed, 65 insertions(+), 135 deletions(-) diff --git a/migration/options.c b/migration/options.c index 6b78795080..143710815a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -20,6 +20,9 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qerror.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/qobject-output-visitor.h" +#include "qobject/qdict.h" #include "qobject/qnull.h" #include "system/runstate.h" #include "migration/colo.h" @@ -1074,6 +1077,28 @@ static void tls_opt_to_str(StrOrNull *opt) opt->u.s =3D g_strdup(""); } =20 +static QDict *migrate_params_to_dict(MigrationParameters *p, Error **errp) +{ + QObject *obj =3D NULL; + Visitor *v =3D qobject_output_visitor_new(&obj); + + if (visit_type_MigrationParameters(v, NULL, &p, errp)) { + visit_complete(v, &obj); + } + visit_free(v); + return qobject_to(QDict, obj); +} + +static MigrationParameters *migrate_params_from_dict(QDict *d, Error **err= p) +{ + Visitor *v =3D qobject_input_visitor_new(QOBJECT(d)); + MigrationParameters *tmp =3D NULL; + + visit_type_MigrationParameters(v, NULL, &tmp, errp); + visit_free(v); + return tmp; +} + /* * query-migrate-parameters expects all members of MigrationParameters * to be present, but we cannot mark them non-optional in QAPI because @@ -1166,6 +1191,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. @@ -1328,133 +1385,6 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) return true; } =20 -static void migrate_params_test_apply(MigrationParameters *params, - MigrationParameters *dest) -{ - MigrationState *s =3D migrate_get_current(); - - QAPI_CLONE_MEMBERS(MigrationParameters, dest, &s->parameters); - - if (params->has_throttle_trigger_threshold) { - dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; - } - - if (params->has_cpu_throttle_initial) { - dest->cpu_throttle_initial =3D params->cpu_throttle_initial; - } - - if (params->has_cpu_throttle_increment) { - dest->cpu_throttle_increment =3D params->cpu_throttle_increment; - } - - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; - } - - if (params->tls_creds) { - qapi_free_StrOrNull(dest->tls_creds); - dest->tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_creds); - } - - if (params->tls_hostname) { - qapi_free_StrOrNull(dest->tls_hostname); - dest->tls_hostname =3D QAPI_CLONE(StrOrNull, params->tls_hostname); - } - - if (params->tls_authz) { - qapi_free_StrOrNull(dest->tls_authz); - dest->tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_authz); - } - - if (params->has_max_bandwidth) { - dest->max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_avail_switchover_bandwidth) { - dest->avail_switchover_bandwidth =3D params->avail_switchover_band= width; - } - - if (params->has_downtime_limit) { - dest->downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - dest->x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_multifd_channels) { - dest->multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - dest->multifd_compression =3D params->multifd_compression; - } - if (params->has_multifd_qatzip_level) { - dest->multifd_qatzip_level =3D params->multifd_qatzip_level; - } - if (params->has_multifd_zlib_level) { - dest->multifd_zlib_level =3D params->multifd_zlib_level; - } - if (params->has_multifd_zstd_level) { - dest->multifd_zstd_level =3D params->multifd_zstd_level; - } - if (params->has_xbzrle_cache_size) { - dest->xbzrle_cache_size =3D params->xbzrle_cache_size; - } - if (params->has_max_postcopy_bandwidth) { - dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; - } - if (params->has_max_cpu_throttle) { - dest->max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - dest->announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - dest->announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - dest->announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - dest->announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - qapi_free_BitmapMigrationNodeAliasList(dest->block_bitmap_mapping); - dest->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAlias= List, - params->block_bitmap_mappi= ng); - } - - if (params->has_x_vcpu_dirty_limit_period) { - dest->x_vcpu_dirty_limit_period =3D - params->x_vcpu_dirty_limit_period; - } - if (params->has_vcpu_dirty_limit) { - dest->vcpu_dirty_limit =3D params->vcpu_dirty_limit; - } - - if (params->has_mode) { - dest->mode =3D params->mode; - } - - if (params->has_zero_page_detection) { - dest->zero_page_detection =3D params->zero_page_detection; - } - - if (params->has_direct_io) { - dest->direct_io =3D params->direct_io; - } - - if (params->has_x_rdma_chunk_size) { - dest->x_rdma_chunk_size =3D params->x_rdma_chunk_size; - } - - if (params->has_cpr_exec_command) { - qapi_free_strList(dest->cpr_exec_command); - dest->cpr_exec_command =3D QAPI_CLONE(strList, params->cpr_exec_co= mmand); - } -} - /* * Caller must ensure the has_* fields of @params are true so they all * get copied and the pointer members don't dangle. @@ -1472,7 +1402,8 @@ static void migrate_params_apply(MigrationParameters = *params) =20 void qmp_migrate_set_parameters(MigrationParameters *input, Error **errp) { - MigrationParameters new; + MigrationParameters *cur =3D &migrate_get_current()->parameters; + g_autoptr(MigrationParameters) new =3D NULL; =20 /* * Convert QTYPE_QNULL and NULL to the empty string (""). Even @@ -1486,14 +1417,13 @@ void qmp_migrate_set_parameters(MigrationParameters= *input, Error **errp) tls_opt_to_str(input->tls_hostname); tls_opt_to_str(input->tls_authz); =20 - migrate_params_test_apply(input, &new); + /* merge input on top of current */ + if (!migrate_params_merge(cur, input, &new, errp)) { + return; + } =20 - if (migrate_params_check(&new, errp)) { - migrate_params_apply(&new); + if (migrate_params_check(new, errp)) { + migrate_params_apply(new); migrate_post_update_params(input, errp); } - - migrate_tls_opts_free(&new); - qapi_free_BitmapMigrationNodeAliasList(new.block_bitmap_mapping); - qapi_free_strList(new.cpr_exec_command); } --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990393; cv=none; d=zohomail.com; s=zohoarc; b=GqDcp6t2CVk4zfDlQZSe68lAQOabhnaM4PctIlfv03vCqAbX5RZykhsSJw7sWO6YzXTj70/F4h4mQTKGZSi87CczleCmM2+KSuC1k8n7auFOYsTw2l2PtOA+IzLrir/yJG/exAlSde++y5OjJ84d3hFcLgZppihXIFs/HSbE4ok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990393; 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=dY5+HgwRq14PZGFtzaraOrbMTxf8qkyzrJDWfhP64Sk=; b=PVggOYumUaW5f7UGRnql+1ULHHF3gQOWEwvbQCoYc5kYHJlJxXJ6/EUK7VOXlQFKGsFcfzRDL4f3iTRjifv7WYVqidSMpH9nZaoNNNggg0s8f/NmjC9yCwkRvg4yAEMHKvTkY5wgvHmMui+5d49QsTEQUx0GMsplZwnwyPdDfic= 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 1788990393727125.73371583032463; Wed, 9 Sep 2026 14:46:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q6u-0000WH-FV; Wed, 09 Sep 2026 17:45: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 1x4Q6t-0000Vf-1A for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:39 -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 1x4Q6r-0005No-Gk for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:38 -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 28CDF1FCC7; Wed, 9 Sep 2026 21:45: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 87A3E13223; Wed, 9 Sep 2026 21:45: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 gBtzFHbToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990332; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dY5+HgwRq14PZGFtzaraOrbMTxf8qkyzrJDWfhP64Sk=; b=cTmG88ggsNUXYCtSzrhZw30+T/1zuILhzMW7c7bHcTZwNPrLt83KxwcMUvCuiCR7eMT8Ad dlHZzyv0K1nFCAsJGQOtmV5bf0g8VTVfL/j2tuc14x5hQJIqunqPtbsqkfKivrtfhskjZP 7zWRcYR9Q3T+wN1pr4ZYrCQZ3/5KynE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990332; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dY5+HgwRq14PZGFtzaraOrbMTxf8qkyzrJDWfhP64Sk=; b=7Ddh9qXd1Ixsc+h6C7JYyb6apwubQ6Rx8RPWYc0nURJn2QkQ7JQIoeEv5Dy0WUhVJglQ8/ iwWPr1Agm9R57NAg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ohLDTqGA; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=TkwpsOOF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990328; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dY5+HgwRq14PZGFtzaraOrbMTxf8qkyzrJDWfhP64Sk=; b=ohLDTqGAICiJhJOp5NFwz7e8PGB6da9LII5a7QTemN6aUzaau5SfbH7jVDp2359AXREIhL zvo/+ucBCxaLD7KpwEw8M9vWG+Ns0WObjE40kioZEv927xKA4Wh4freDSZJAiZ7RGi1irv 57I0FYFJCGgHy7hwcA2C1Z8XlGKtlq4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990328; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dY5+HgwRq14PZGFtzaraOrbMTxf8qkyzrJDWfhP64Sk=; b=TkwpsOOF7CVGubgOlstL/zoH2uVrGTnJV6AosZskvCcD3orm2i9iPgNFbaH5QsLuHpHYoH f4ZR0fxKWin2MhDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Prasad Pandit Subject: [PATCH v2 06/18] migration: Open code migrate_params_apply Date: Wed, 9 Sep 2026 18:44:56 -0300 Message-ID: <20260909214509.237309-7-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 28CDF1FCC7 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,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org: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: 1788990396357158500 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 143710815a..24799eba96 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1385,21 +1385,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; @@ -1422,8 +1407,15 @@ void qmp_migrate_set_parameters(MigrationParameters = *input, Error **errp) return; } =20 - if (migrate_params_check(new, errp)) { - migrate_params_apply(new); - migrate_post_update_params(input, errp); + if (!migrate_params_check(new, errp)) { + return; } + + migrate_tls_opts_free(cur); + qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); + qapi_free_strList(cur->cpr_exec_command); + + QAPI_CLONE_MEMBERS(MigrationParameters, cur, new); + + migrate_post_update_params(input, errp); } --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990379; cv=none; d=zohomail.com; s=zohoarc; b=PPKxVLeWcm8vsdxe3iCueeQ3dQlwqZhEC2YKrH0J9axBtGkc/KStzW/KfBg0YV1GOobze6G2/5JCXyANbECYYGwCuoPIpXuI1FagN5AMKiur5VObZAlFreSB7+2yeCi8BzuNdR4b3I5Wz7klqdP0/u4RSXTTcFtFEW/+nfrGuKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990379; 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=FU1jhkEgMVS2sNbypPm5zXMDEp/wDQLX/KNQGfBpgBc=; b=myKqy8dluhhkh95picVRIPHLwdBmR9GTPT9VUmMCupnfaHCS7aTLrOq8Mjfo4liyKKKtawD9oMcqulKLHjiRRBj9LuGKGJQSnyy2ib4xdXAb63l7vZD1/p6gy+w/2AJjsIRgCwWvYKSZfR73MM3hIZ9ToC5MMed/T+S4LqfMZww= 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 1788990379373946.9495294662778; Wed, 9 Sep 2026 14:46:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q6w-0000Ws-U7; Wed, 09 Sep 2026 17:45: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 1x4Q6u-0000WK-TK for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:40 -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 1x4Q6t-0005O5-AG for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:40 -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 DB83821C87; Wed, 9 Sep 2026 21:45: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 7E42B136ED; Wed, 9 Sep 2026 21:45: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 uEpFEnjToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990334; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FU1jhkEgMVS2sNbypPm5zXMDEp/wDQLX/KNQGfBpgBc=; b=GatcDFdjB53CkmD24HikZpA4IUeatfU66CBGRh+lQ6tuEeZ0+IwcVzAKLGGzPZ+IUAexYl LfGaqbKSKLcocOofyal8ixATf6c4LLWqCiLQLRQ3Ncnt8WmOMcttFAshmBQWDafIHgY9u/ hnVmJx5mG0xtaojOAZtcbtLNJg3ObgY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990334; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FU1jhkEgMVS2sNbypPm5zXMDEp/wDQLX/KNQGfBpgBc=; b=JpOnkOQDnzYWk1G1AYr5LXBOTV9pnhzMB0hmBWmV7PPiW/8ulzCvQcNUkO7FCAD+x7b0qe SRD2S1OyTzFetKDQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=tg5zsd2n; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=jE5aepu8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990329; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FU1jhkEgMVS2sNbypPm5zXMDEp/wDQLX/KNQGfBpgBc=; b=tg5zsd2nlrM2AfSs2edkaW3bkADnkMTK+8WX4etyxsRhOe+mJi9PEgwGRQYXzqYP2xcadJ aRsyYysEr95we06gHXBy5R3gWEuwuh8FlVqSg0coatA36f/nmEAewMsyx20zJBTwyInM6E qHxk4fXQDDnz7Q79UTqG0N9O9UeRCJY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990329; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FU1jhkEgMVS2sNbypPm5zXMDEp/wDQLX/KNQGfBpgBc=; b=jE5aepu89MKB6P/3H7W7wXm3KgMceCccpUjVh+ewPVcryDsuYz7oUmXUxRU6nAN/5b0KjT /r2SAXFdfNJu1BBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v2 07/18] migration: Stop freeing s->parameters members individually Date: Wed, 9 Sep 2026 18:44:57 -0300 Message-ID: <20260909214509.237309-8-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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: DB83821C87 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[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.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: 1788990382842158500 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 24799eba96..f0774fc50b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -16,6 +16,7 @@ #include "qemu/units.h" #include "exec/target_page.h" #include "qapi/clone-visitor.h" +#include "qapi/dealloc-visitor.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" @@ -1058,11 +1059,21 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 -static void migrate_tls_opts_free(MigrationParameters *params) +static bool migrate_params_free(MigrationParameters *params, Error **errp) { - qapi_free_StrOrNull(params->tls_creds); - qapi_free_StrOrNull(params->tls_hostname); - qapi_free_StrOrNull(params->tls_authz); + Visitor *v =3D qapi_dealloc_visitor_new(); + bool ret; + + /* + * qapi_free_MigrationParameters can't be used here because + * MigrationParameters is embedded in MigrationState due to qdev + * needing to access the offset of the migration properties inside + * the migration object. + */ + ret =3D visit_type_MigrationParameters_members(v, params, errp); + visit_free(v); + + return ret; } =20 /* normalize QTYPE_QNULL to QTYPE_QSTRING "" */ @@ -1411,9 +1422,9 @@ void qmp_migrate_set_parameters(MigrationParameters *= input, Error **errp) return; } =20 - migrate_tls_opts_free(cur); - qapi_free_BitmapMigrationNodeAliasList(cur->block_bitmap_mapping); - qapi_free_strList(cur->cpr_exec_command); + if (!migrate_params_free(cur, errp)) { + return; + } =20 QAPI_CLONE_MEMBERS(MigrationParameters, cur, new); =20 --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990430; cv=none; d=zohomail.com; s=zohoarc; b=Ogn2bFCKM6kMyUdVv4SekQCVaXAknFD5ZwcER4RybhA8Tq4J/H+C173rAyaD7mXC9KiXdtYnRQZHNEuSyBQC05yFk9Y86BCphwYWIcSvhwOh0p5G7aeF2x95VCUvpc6yc+t+uhpIHudYr2psXOeXJymrpoCuFlVdwdyFAYLG+tk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990430; 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=iGLcOKZE5wRlQQ/6HuuL7e18y/nZOv74SaavIEtGgiI=; b=O9dQfA6j/vpaCIPgyU3H1GfOGj4dAiKXNgoQSudvQYkw4aWyEAvfBlmPb2NUHQi19H0PybJwAjVZKK0qeKmHgabRRjiUjxRUUX6mKKritwAACXlpd8k4iij5iXo5aDgpe0wuReWbQIZ8rRc3N+gM0KUQ9CZ6finG8oD3vwxM+Yk= 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 1788990430736973.7090044682803; Wed, 9 Sep 2026 14:47:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q6x-0000X0-JX; Wed, 09 Sep 2026 17:45: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 1x4Q6w-0000Wd-IX for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45: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 1x4Q6v-0005OP-2y for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45: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 996E11FCD5; Wed, 9 Sep 2026 21:45: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 3E8DD1376E; Wed, 9 Sep 2026 21:45:30 +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 iIgZA3rToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990335; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iGLcOKZE5wRlQQ/6HuuL7e18y/nZOv74SaavIEtGgiI=; b=a2wblv6fMmK1cGBKEZjwIHtNhymg6MoJF5QUgAA5aErCNPINiqRqYmu8uPLrLLW973uQ8h oHc/8UpiEIMlw/pJgNd5IGX4qv4kYLVJSf/p5f5AHmNO+OGN1d4GwLZrLNETGYtStPxcaf UDoLyFN4rY817ZNvBHB7vca0fwDcHlQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990335; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iGLcOKZE5wRlQQ/6HuuL7e18y/nZOv74SaavIEtGgiI=; b=3wrMKpKqJ2jpT6y2i1uWUhDSUzJSiR+4HBSUMnllw66lnmCXkVF7BRTYgljkiuw8gLPgAW MKVy8eSF025ssyAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990331; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iGLcOKZE5wRlQQ/6HuuL7e18y/nZOv74SaavIEtGgiI=; b=0zutnGni65AqwN1d36i4IIxmnEqy9EhwBAmUpr1IaRUsRVrLOjTvFlBPBzra8pK3q+76Xv +uejuVbkFGDTANDDWQBweOrHuxOLQ5kkVFpbr1YuHjZGnJGJuDZXP2V9oF5HPGnFKvCD6w 00nvJ9T/8Pk6gCeFnoZkdLBMFk3i3A8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990331; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iGLcOKZE5wRlQQ/6HuuL7e18y/nZOv74SaavIEtGgiI=; b=OvyCL4Z2uxOFImjXzKDGglaatGAsjDUCb+CFMBB7oAM8dG4qO5qNTH9BA07GR5dMBue0Lk 8xKVDq/e0vxE36Bg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v2 08/18] migration: Use migrate_params_free during finalize Date: Wed, 9 Sep 2026 18:44:58 -0300 Message-ID: <20260909214509.237309-9-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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: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: 1788990432478158500 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 b413d28622..dab282dd2f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4039,8 +4039,7 @@ static void migration_instance_finalize(Object *obj) { MigrationState *ms =3D MIGRATION(obj); =20 - qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); - qapi_free_strList(ms->parameters.cpr_exec_command); + migrate_params_free(&ms->parameters, NULL); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); diff --git a/migration/options.c b/migration/options.c index f0774fc50b..990fcd6867 100644 --- a/migration/options.c +++ b/migration/options.c @@ -271,8 +271,9 @@ static void set_StrOrNull(Object *obj, Visitor *v, cons= t char *name, =20 static void release_StrOrNull(Object *obj, const char *name, void *opaque) { - const Property *prop =3D opaque; - qapi_free_StrOrNull(*(StrOrNull **)object_field_prop_ptr(obj, prop)); + StrOrNull **ptr =3D object_field_prop_ptr(obj, opaque); + + g_clear_pointer(ptr, qapi_free_StrOrNull); } =20 static void set_default_value_tls_opt(ObjectProperty *op, const Property *= prop) @@ -1059,7 +1060,7 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 -static bool migrate_params_free(MigrationParameters *params, Error **errp) +bool migrate_params_free(MigrationParameters *params, Error **errp) { Visitor *v =3D qapi_dealloc_visitor_new(); bool ret; diff --git a/migration/options.h b/migration/options.h index 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:50:53 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=1788990435; cv=none; d=zohomail.com; s=zohoarc; b=DNBMGRLMrfuqSYmFQc0hfQL0e+7S7WMNEI/lxvNVcY0gB1NdOTAnqOeptzCaRE/snluMZBu8I6pCrNMOtAaYaukP5CCJic0PEJ1uKkwH2nRhCqoW3ffnDr60XOLQZUbYKmVadtA3QcJkFDFoY3pBWrY9AztRy7TmGBBUD2RlvM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990435; 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=kZuzUP2AZtq+mwNfvS27ay2KDJ0kOoN1RI8BzZOMkr4=; b=XryshiHuKV8/wvpubRcih2TNKpybd3FP2BsE9VnuwBQRVhu4p75zbMfc5V1Hcn9jLblAdO1W2qDG26Ud0GiMZdHtWSvl5skGNJ2Q6vyIpAluaHUxKJPYhlgOgrpjmmRRI5jQGIW6yvtKSW4AW4UGQ5Cu60kwp2wkSYnYWTlm4OY= 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 1788990435658822.8321754788217; Wed, 9 Sep 2026 14:47:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q71-0000Xn-Df; Wed, 09 Sep 2026 17:45:47 -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 1x4Q6z-0000XJ-4U for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:45 -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 1x4Q6x-0005P0-4E for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:44 -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 BDBCB1FCDA; Wed, 9 Sep 2026 21:45: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 F3D9F13770; Wed, 9 Sep 2026 21:45: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 wBDYLnvToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990337; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kZuzUP2AZtq+mwNfvS27ay2KDJ0kOoN1RI8BzZOMkr4=; b=oTEul7iAgZPHq58c0yMqJunQ2gTtN4g2LC7SrgQQq5DDYt7SLfuckl3PrABDH6GcEbXtsd Bg8tZIvJDEPzCUkFIn53zPSWYpyLaS+XnPHUHOBaIhjSwzF7mCYBnGcRNz+MSLBY0Cyg/H 2SOC0SdRhiQs5cNcNSRmTusMJiMCC5Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990337; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kZuzUP2AZtq+mwNfvS27ay2KDJ0kOoN1RI8BzZOMkr4=; b=vlxfcwsEP6bYZJ+4SkMNAlxEIohRfViYDEYMHOMhZ0iTYSybPnlabJ5v8Z5oLMxoMSmSM8 bZGgY5Nv3Wh7NsCg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990333; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kZuzUP2AZtq+mwNfvS27ay2KDJ0kOoN1RI8BzZOMkr4=; b=OO1S1WDb9uC7f7RowTLygUydrvtpYQv6fUkNOiRKAbYxzvS6gQ5uWU6uZhhCS2mnJcG9rl 33l2hd0XVo6kS81HuPxzZ3iRiiSnNYlGulDJD9ZlhIBf7w9636FSBEYye1WNlz0+naMecB iG9v79aIw/IUfjY6Ic/IuaUYhEtBHSk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990333; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kZuzUP2AZtq+mwNfvS27ay2KDJ0kOoN1RI8BzZOMkr4=; b=2FdwKGbePHqdrujhGtaiiPROoZp1wFfIDf50Aw67SljXC4A+Dbf4O83eyFFiZg9QE8KZDu FWKz6Pln+YWuMNBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 09/18] tests/qtest/migration: Add a test for HMP Date: Wed, 9 Sep 2026 18:44:59 -0300 Message-ID: <20260909214509.237309-10-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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,suse.de:mid,suse.de:email]; 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: 1788990436555158500 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 Signed-off-by: Fabiano Rosas Acked-by: Dr. David Alan Gilbert Acked-by: Peter Xu --- tests/qtest/migration/misc-tests.c | 201 +++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 4e0deb7f18..533cf3d55d 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -22,6 +22,203 @@ =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, } +#define BG_SNAP_MSG ("Error: Background-snapshot is not compatible with " \ + "currently set capabilities") + +typedef struct HMPTestData { + const char *input1; + const char *input2; + const char *output1; + bool skip; + int line; +} HMPTestData; + +/* + * .input1: string to be used as parameter name + * .input2: string to be used as parameter value + * .output1: expected output of migrate_set_parameters + * E.g: + * (qemu) migrate_set_parameters .input1 .input2 + * .output1 + */ +HMPTestData test_cases[] =3D { + TEST("", "", "migrate_set_parameter: string expected"), + TEST("foo", "", "migrate_set_parameter: string expected"), + TEST("foo", "on", "Error: invalid parameter value: foo"), + + /* bool */ + TEST("cpu-throttle-tailslow", "on", "on"), + TEST("direct-io", "on", "on"), + + /* uint64_t */ + TEST("announce-initial", "60", "60 ms"), + TEST("announce-max", "600", "600 ms"), + TEST("announce-rounds", "6", "6"), + TEST("announce-step", "15", "15 ms"), + TEST("downtime-limit", "400", "400 ms"), + TEST("avail-switchover-bandwidth", "2097152", "2199023255552 bytes/sec= ond"), + TEST("max-bandwidth", "9876543", "10356305952768 bytes/second"), + TEST("max-postcopy-bandwidth", "1048576", "1048576 bytes/second"), + TEST("vcpu-dirty-limit", "20", "20 MB/s"), + TEST("x-rdma-chunk-size", "1048576", "1048576 bytes"), + TEST("x-vcpu-dirty-limit-period", "750", "750 ms"), + TEST("xbzrle-cache-size", "67108864", "67108864 bytes"), + + /* uint32_t */ + TEST("x-checkpoint-delay", "5000", "5000 ms"), + + /* uint8_t */ + TEST("cpu-throttle-increment", "15", "15"), + TEST("cpu-throttle-initial", "25", "25"), + TEST("max-cpu-throttle", "85", "85"), + TEST("multifd-channels", "8", "8"), + TEST("throttle-trigger-threshold", "65", "65"), + + /* complex types */ + TEST("mode", "cpr-exec", "cpr-exec"), + TEST("multifd-compression", "zlib", "zlib"), + TEST("zero-page-detection", "none", "none"), + TEST("tls-authz", "my_authz", "'my_authz'"), + TEST("tls-creds", "null", "'null'"), + TEST("tls-hostname", "localhost", "'localhost'"), + TEST("cpr-exec-command", "/bin/true foobar", "/bin/true foobar"), + + /* can be set but are currently missing in the query output */ + SKIP("multifd-qatzip-level", "5", "5"), + SKIP("multifd-zlib-level", "4", "4"), + SKIP("multifd-zstd-level", "6", "6"), + + /* cannot be set */ + TEST("block-bitmap-mapping", "[]", + "Error: The block-bitmap-mapping parameter " + "can only be set through QMP"), +}; + +/* + * 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 -1; + + /* + * 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 >=3D 0) { + 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; + + /* 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 +457,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:50:53 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=1788990418; cv=none; d=zohomail.com; s=zohoarc; b=OT6yv87pHN7WcCZOWMAwTfAFgL5HFGVCHe5H4k8i1rLVApXJ94bGLqwD88vydVz9/fX7oPeQKffhSsWtmwlA4GKjN78scj5t8zr7o57u1Z29v/YjZxJXLiGqiQfTlZzsjRhbJ4vCPhxjBh0C+Omypd25LhNSjoOTWVTZUw5Wi7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990418; 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=NrRt2zkbA6j0V7SUX18LjSlV5FjxLmUozt4V6iG7yGY=; b=n8aPaJsfdgRhZ3Qp3+8vLHvbN1igA39ZS5G7dvLF01MehtAcPwD7IAEuzwlKYtAguLm9/TruWAZbpDp61xQZLtRAK9WqPWP4MgcVWpqoViLHq8sVZgLEKbAlJbzCtkCGwATZRhZV4MxUqQzacAREnr4sTXfNpAsYhepd7T4pIsY= 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 17889904187271012.6010193540806; Wed, 9 Sep 2026 14:46:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q73-0000YO-Du; Wed, 09 Sep 2026 17:45: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 1x4Q71-0000Xl-7N for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:47 -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 1x4Q6z-0005PL-9F for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45: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 EE3551FCCD; Wed, 9 Sep 2026 21:45: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 20F5D137EC; Wed, 9 Sep 2026 21:45: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 EDsAN33ToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrRt2zkbA6j0V7SUX18LjSlV5FjxLmUozt4V6iG7yGY=; b=Wk2Lte0eccnb4rfaAaws93FcZkqS9G09wFUon7pQ+Ve2FrtX2waRLjBH/75Ip+GmQeqTIo /8HlX4ROQqEvyVXb8nieT2Tdfo9ZmLk413ABk993Rjna0HH41otA1ZZqJ5VAmaHKh9BZjn U0m2wPJSFL0bMfshx/9KgIGUU31La2M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrRt2zkbA6j0V7SUX18LjSlV5FjxLmUozt4V6iG7yGY=; b=FHf2SErsb1LlMpFvZCuZSKqrfyFNHjJCVGzqth2MBZPhH6QDMji3EXeQs0wWwu57tsauVg p5SBmhbrFX7Ca6Dw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Gwez1hke; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=+zj8UL4l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990335; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrRt2zkbA6j0V7SUX18LjSlV5FjxLmUozt4V6iG7yGY=; b=Gwez1hke80SntOkVq9YMYm5GjLR3A/fErkzz4nuzWBIZ4m8pmfpMvkI7oaJP9/5ERMuvLy zXwVt0Z71rZiXv8OcW83h+5O+Y3ZCBKDWHcB4vyFSIdsEZsf+L7lhdQZxJNN4a3n+WN+dk hF04u1r+ZToMkxKe9ZGGGe6l58AqM34= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990335; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrRt2zkbA6j0V7SUX18LjSlV5FjxLmUozt4V6iG7yGY=; b=+zj8UL4lwe35zpNY8kAJTbtk8uzo6GEdwyDLlvA+83t6PUb/U+eGRjbquLXo2KfvbCoWPm KwafSgN1E6PobkBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 10/18] tests/qtest/migration: Add a test for HMP completion Date: Wed, 9 Sep 2026 18:45:00 -0300 Message-ID: <20260909214509.237309-11-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: EE3551FCCD 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,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; 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: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: 1788990420465158500 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 Signed-off-by: Fabiano Rosas Acked-by: Peter Xu --- tests/qtest/migration/misc-tests.c | 192 +++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 533cf3d55d..04f46d5e81 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -11,6 +11,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/sockets.h" #include "qapi/error.h" #include "qobject/qjson.h" #include "libqtest.h" @@ -99,6 +100,46 @@ HMPTestData test_cases[] =3D { "can only be set through QMP"), }; =20 +/* + * .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 ", "@params@"), + TEST("migrate_set_capability \t", "migrate_set_capability ", "@caps@"), +}; + /* * Find a contiguous run of tokens in @larger that match the sequence * of tokens in @smaller, ignoring mismatches due to sequences of @@ -141,6 +182,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); @@ -217,6 +274,139 @@ 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; + + prompt =3D strstr(buf, "(qemu) "); + if (prompt) { + *prompt =3D '\0'; + break; + } + } +} + +static int comp(const void *a, const void *b) +{ + return strcmp(*(const char **) a, *(const char **) b); +} + +static void get_migration_opts_sorted(GString *exp, const char * const *lo= okup, int n) +{ + g_autofree char **opts_array =3D g_new0(char *, n); + uint8_t i; + + for (i =3D 0; i < n; i++) { + opts_array[i] =3D g_strdup(lookup[i]); + } + + qsort(opts_array, n, sizeof(char *), comp); + + for (i =3D 0; i < n; i++) { + g_string_append(exp, opts_array[i]); + if (i + 1 !=3D n) { + g_string_append(exp, " "); + } + } + + for (i =3D 0; i < n; i++) { + g_free(opts_array[i]); + } +} + +static void hmp_completion_single(int fd, const struct HMPTestData *t) +{ + g_autoptr(GString) exp =3D g_string_new(""); + char buf[8192]; + char *output; + + test_case_line =3D t->line; + + if (g_str_equal(t->output1, "@caps@")) { + g_string_append(exp, "migrate_set_capability "); + get_migration_opts_sorted(exp, MigrationCapability_lookup.array, + MIGRATION_CAPABILITY__MAX); + } else if (g_str_equal(t->output1, "@params@")) { + g_string_append(exp, "migrate_set_parameter "); + get_migration_opts_sorted(exp, MigrationParameter_lookup.array, + MIGRATION_PARAMETER__MAX); + } else { + g_string_append(exp, 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->str, 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]; + + 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(sockfds[0], &completion_cases[i]); + } + + close(sockfds[0]); + qtest_quit(qts); +} #endif /* CONFIG_HMP */ =20 static void test_baddest(char *name, MigrateCommon *args) @@ -460,5 +650,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:50:53 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=1788990405; cv=none; d=zohomail.com; s=zohoarc; b=bTR6uJ9r3ojCCiq0UAvZQHUeKLR85Z2JiKThk1XJ/7fRtUjK9UiA7HMA4enHGHW3ko5rnGNRc/aOLpVjCF1/tErXRKJebQK1ww02mULrCCK9eWgeC+AfwDM42upjlqP5G/CixXX6CpWCaFo37PAwVhTs2GkKY/ceVu3GIq1s6oo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990405; 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=0WOVg26KjwVAPMq7gjuOAAv5JAbHedaWGx0+jCvu/40=; b=SfB1Y4SzJhlNZvmb/883JKRGwBwX+AtiQHsXy0JiiMmLnGSoxVz2R9UVPy1wc2hku419RwsqCE2SNO42pY8WiuzKXi/MejvTd9bto6GRx3W9xCd7Rm25rX09KhSMGEIC0UX62N6MxJ7/AXFHv9Z+j3Vtyu9pjys68IdWf+XYS5M= 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 1788990405661598.343442797373; Wed, 9 Sep 2026 14:46:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q75-0000ZS-7O; Wed, 09 Sep 2026 17:45:51 -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 1x4Q73-0000YA-2y for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:49 -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 1x4Q71-0005Pq-Fk for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:48 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 24F431FCD0; Wed, 9 Sep 2026 21:45:38 +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 534F213892; Wed, 9 Sep 2026 21:45:36 +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 WMWKB4DToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990342; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0WOVg26KjwVAPMq7gjuOAAv5JAbHedaWGx0+jCvu/40=; b=0SkXRJo/bmzoYW0aiYfQN7wvBeTRLfO7M0CksCOh8Z2hL8zWd8wnEoHAp1va5OGpDyOpLw Z9NU6h/oTbe7cDYXfQnlWKhLhCwEvUMcrsG1Fk/q0ix7V6dyf5hgjssEF0tyvUl4vwb3OH oYFjOhfdOIG3thGG0FvmY9/4prUbHRc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990342; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0WOVg26KjwVAPMq7gjuOAAv5JAbHedaWGx0+jCvu/40=; b=gGQzIvshuDLQAwkG6h+dJd7EbDJKxKUg+1xrLZ6BVVe1vCvziXLOWcHxLAeDoQwFruS2oc zZX6He6d8yyHP5Bg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=wGYc6KJ9; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=lUtdpjRT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990338; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0WOVg26KjwVAPMq7gjuOAAv5JAbHedaWGx0+jCvu/40=; b=wGYc6KJ9QtUPk3RGuXtdMwEqluepwsUp4LIcV9BqP3srK8LlbBbfGSFBqDs0PR8Hjl2pQu 4grs+TdBGivt+6s8jIZI2s3dFWR56+H41MpOZhOEd80EncVJjUzBUEaybasE3RilCfEsHb CSxpfdsVrrTPwnVoAIPNfuN/fODPQaw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990338; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0WOVg26KjwVAPMq7gjuOAAv5JAbHedaWGx0+jCvu/40=; b=lUtdpjRTyQwF5eOAGaBUKT0x1TUdC6TMXAI9icdUYu79j99w6SX8E+grU9RStkU1s5ws6H WvV51o0E5dAj7pCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 11/18] migration: HMP: Fix bandwidth parameters Date: Wed, 9 Sep 2026 18:45:01 -0300 Message-ID: <20260909214509.237309-12-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 24F431FCD0 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,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; 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: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: 1788990406400158500 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 where they're expected to be provided as mebibytes. Fix the HMP code to parse the values as bytes. Signed-off-by: Fabiano Rosas Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- migration/migration-hmp-cmds.c | 23 +++-------------------- tests/qtest/migration/misc-tests.c | 4 ++-- 2 files changed, 5 insertions(+), 22 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 04f46d5e81..447fa5e232 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -62,8 +62,8 @@ HMPTestData test_cases[] =3D { TEST("announce-rounds", "6", "6"), TEST("announce-step", "15", "15 ms"), TEST("downtime-limit", "400", "400 ms"), - TEST("avail-switchover-bandwidth", "2097152", "2199023255552 bytes/sec= ond"), - TEST("max-bandwidth", "9876543", "10356305952768 bytes/second"), + TEST("avail-switchover-bandwidth", "2097152", "2097152 bytes/second"), + 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:50:53 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=1788990381; cv=none; d=zohomail.com; s=zohoarc; b=Ns1mHx9bGH23E11ZXou4ztRoIY/jP0R9tefXT5Gf4qydUhUk3q8l5n5MCCTa4ihvrrz55l7WXWTMXwoico2OsrB3RCwvkVUgY78z1V9/kW5JCbd1lw/C/iWsx+FrJyBfGcp55OfjYEpa9RxiB3HNwYkSZGyFhVtHOrHp+PgTmtc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990381; 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=NSkm03n75y1Ikd84YKm6XqZj14t3CHH23cUSJcsAlwI=; b=Wkgrhx1pAb6omV/19+K+j4ShQpPLieYWOVjl+jlIAbl8HwHem0sM48vOx0zCxSUmHCwB1E0DP4ieNk4KK5+L1GbTMs3mDhzHyuYOzEfg9wuDbyVJ0VPv2OWpYm5YG9ZUSzCMkoyUVYv/sKxKBENNfE+AhTYzC4rYghwtBWTIcCs= 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 1788990381608412.4194632574074; Wed, 9 Sep 2026 14:46:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q79-0000ap-5F; Wed, 09 Sep 2026 17:45: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 1x4Q76-0000Zz-Ml for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:52 -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 1x4Q74-0005QJ-8q for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45: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-out2.suse.de (Postfix) with ESMTPS id C16B31FCD3; Wed, 9 Sep 2026 21:45: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 8202F13223; Wed, 9 Sep 2026 21:45:38 +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 2FzMEoLToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990344; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NSkm03n75y1Ikd84YKm6XqZj14t3CHH23cUSJcsAlwI=; b=ylDnlKiI3kH75s2g0HhKMyudXKVHcybnr71+2DAWoRJbp6ipTekZmOagTWY1+MTdHaBpC1 dVWdaWuYZ3iI4ophvTwPjas9V3gqcU+x5orgGRBG/qqmg7g3z+T7Z2uE70H8OYsvuNZSd9 u6cWgEGcqSaTbFxW7TP+v4cOaQvR8JY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990344; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NSkm03n75y1Ikd84YKm6XqZj14t3CHH23cUSJcsAlwI=; b=ISIOU14dG4RApUehf3vBGwTeKBpV5nhqJlTP/DY2v/0tDK2xCcpNnDgIHz+6tCVT/pPju0 PhSMzhBI0l5MU+Bw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NSkm03n75y1Ikd84YKm6XqZj14t3CHH23cUSJcsAlwI=; b=hKt2Q10jNzmRBwURe9fPM9V2dDHMT9vkiMa1IGWi0iODRATGQz9OrM4h7FWo5tTeyRtVyI mbw1bwpoXQs716CVo61sx8SbeTGZ7RqaapkWbLVHk6YTnLsbG+DSBuMbv4RW1KbbG++KPs pELFGRk9Msn7tDA8H5dlJj6UITduzfE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NSkm03n75y1Ikd84YKm6XqZj14t3CHH23cUSJcsAlwI=; b=EEZcCkTMztmuxTObulaBbL2r1tlaqX9y8dMvXz/rR9IPl9Op5x1VXi3EKnK8A+fxRKEL53 hak8BNpkeSxTqCDg== 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 v2 12/18] migration: Change HMP 'info migrate_parameters' output Date: Wed, 9 Sep 2026 18:45:02 -0300 Message-ID: <20260909214509.237309-13-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1788990382974158500 Content-Type: text/plain; charset="utf-8" The output of 'info migrate_parameters' includes units of measurement for a few parameters. This is convenient for a user. It also requires every parameter to be individually listed in the hmp_migrate_set_parameter() function, which in turn requires the MigrationParameter (singular) enum to exist. While the latter is not bothersome at all, the former is. From a development and maintenance perspective, having a list of parameters explicitly written in several parts of the code brings several annoyances: conflicts during rebase, multiple extra hits when grepping, requires contributors to search for every location a change needs to be mirrored to, etc. Remove the units from the output so we can write this code in a more convenient way. The HMP output is not part of any ABI. Also remove quotes from around the TLS options strings as this is inconsistent with all the other strings. Change block-bitmap-mapping format to a single line. This requires updating one of the iotests to match. 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: bitmaps:= name: bmap0 alias: bmap0 node-name: node-src alias: node-dst 'node-src' -> 'node-dst' 'bmap0' -> 'bmap0' Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 80 +++++++++++++++++------------- tests/qemu-iotests/300 | 20 +++++--- tests/qtest/migration/misc-tests.c | 30 +++++------ 3 files changed, 74 insertions(+), 56 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 67ea2eea15..5d754414c4 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,51 @@ 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)); + monitor_hmp_printf(hmp, "%s:", + MigrationParameter_str( + MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); =20 - for (bmnal =3D params->block_bitmap_mapping; - bmnal; - bmnal =3D bmnal->next) + for (nal =3D params->block_bitmap_mapping; nal; nal =3D nal->n= ext) { - const BitmapMigrationNodeAlias *bmna =3D bmnal->value; - const BitmapMigrationBitmapAliasList *bmbal; + na =3D nal->value; + monitor_hmp_printf(hmp, " bitmaps:"); + 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) { + if (bat->persistent) { + monitor_hmp_printf(hmp, " persistent: on"); + } else { + monitor_hmp_printf(hmp, " persistent: off"); + } + } + monitor_hmp_printf(hmp, " alias: %s", ba->alias); } + monitor_hmp_printf(hmp, " node-name: %s alias: %s", + 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 +471,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..7a5006b3bc 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -147,8 +147,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): =20 result =3D vm.qmp('human-monitor-command', command_line=3D'info migrate_parameters') - - m =3D re.search(r'^block-bitmap-mapping:\r?(\n .*)*\n', + m =3D re.search(r'^block-bitmap-mapping:(.*)\r\n', result['return'], flags=3Dre.MULTILINE) hmp_mapping =3D m.group(0).replace('\r', '') if m else None =20 @@ -158,15 +157,24 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): =20 @staticmethod def to_hmp_mapping(mapping: BlockBitmapMapping) -> str: - result =3D 'block-bitmap-mapping:\n' + result =3D 'block-bitmap-mapping:' =20 for node in mapping: - result +=3D f" '{node['node-name']}' -> '{node['alias']}'\n" - assert isinstance(node['bitmaps'], list) + result +=3D ' bitmaps:' for bitmap in node['bitmaps']: - result +=3D f" '{bitmap['name']}' -> '{bitmap['alias']}= '\n" + result +=3D f" name: {bitmap['name']}" + if 'transform' in bitmap: + if 'persistent' in bitmap['transform']: + if bitmap['transform']['persistent']: + result +=3D " persistent: on" + else: + result +=3D " persistent: off" + result +=3D f" alias: {bitmap['alias']}" =20 + result +=3D f" node-name: {node['node-name']} alias: {node['al= ias']}" + + result +=3D '\n' return result =20 =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 447fa5e232..2261ae7c89 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -57,21 +57,21 @@ HMPTestData test_cases[] =3D { TEST("direct-io", "on", "on"), =20 /* uint64_t */ - TEST("announce-initial", "60", "60 ms"), - TEST("announce-max", "600", "600 ms"), + TEST("announce-initial", "60", "60"), + TEST("announce-max", "600", "600"), TEST("announce-rounds", "6", "6"), - TEST("announce-step", "15", "15 ms"), - TEST("downtime-limit", "400", "400 ms"), - TEST("avail-switchover-bandwidth", "2097152", "2097152 bytes/second"), - 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"), @@ -84,9 +84,9 @@ HMPTestData test_cases[] =3D { TEST("mode", "cpr-exec", "cpr-exec"), TEST("multifd-compression", "zlib", "zlib"), TEST("zero-page-detection", "none", "none"), - TEST("tls-authz", "my_authz", "'my_authz'"), - TEST("tls-creds", "null", "'null'"), - TEST("tls-hostname", "localhost", "'localhost'"), + TEST("tls-authz", "my_authz", "my_authz"), + TEST("tls-creds", "null", "null"), + TEST("tls-hostname", "localhost", "localhost"), TEST("cpr-exec-command", "/bin/true foobar", "/bin/true foobar"), =20 /* can be set but are currently missing in the query output */ --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990442; cv=none; d=zohomail.com; s=zohoarc; b=ZC8nqJ7U6motjJxbHJj/kcu/cThWaQdlLV/Nnu99OGfZeQxU0wWsEiuXAKQGnsAVuK/QnCVaEZ2owIM2u69q18n6UsmwnnGn5QqJ5gYKdH0H5DMOxFhCI1+OZaJmi5COh+NjkY9JDA907fqiqWqB8VW/kmo49C/tBG2WVFPWskk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990442; 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=V4FkSfvj750+ka7PWjTMb74hKbmp7/ZPYJHMlThBHC8=; b=c5edlJYDu1JtFydjWZw99EgbSgQ2KDHsAPmcdwcPFvSaAz3t7ny6p5zNAxJy3VkCsHJrKWpqIMjj8tC2D/tag31PvhEX5SVKI1KIofukIEpw0vPbzkyHydKQ54jelMZ3tGzHGOBxHfzWbnYaLfFM9bq3477R1iqXM1zVwkXuVB8= 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 1788990442561405.87213797705135; Wed, 9 Sep 2026 14:47:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q7A-0000b4-D2; Wed, 09 Sep 2026 17:45:56 -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 1x4Q78-0000aR-KN for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:54 -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 1x4Q76-0005Qi-9w for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:54 -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 F0F1A1FCD5; Wed, 9 Sep 2026 21:45: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 262C2136ED; Wed, 9 Sep 2026 21:45: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 EHUaOITToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990347; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V4FkSfvj750+ka7PWjTMb74hKbmp7/ZPYJHMlThBHC8=; b=g4JA5Zwv8VMEdS3vbA0VTWGeZxRi1hIKUePV3/xDfcgui6ZSg2dADfn4Xaqi89+aVuSxPC Mzp/5DNQ2+eKpx8ASlGwgRpGw/LH7zsMaQ5L8a3CXKP5mYKPehoYAJpkNVa+ZgEuI1GCkP TzwDD5mgfhp66ZiCUQPPUFnNZuOkfmY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990347; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V4FkSfvj750+ka7PWjTMb74hKbmp7/ZPYJHMlThBHC8=; b=YyLJLJmQMatMq2h+LFjqm3OaKEci9Kvc8iSqpuZcNUrLeBxsoUxA6VH4dGf/MVj4LwOpho neNygwoqNEK4ugAQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990342; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V4FkSfvj750+ka7PWjTMb74hKbmp7/ZPYJHMlThBHC8=; b=EidwLtanTvSO/RbSUJAc7q1o6aakR6S25Yfl37CeyprYgtF5n0PsNISCbjVYLGmpGfSpr3 PRiDMi3KNgKl/iwTmwOTYnyBqbIEynRA9ACIXBke12vl2VWAqArOtTf8xNCRSyputojQ9M 4S1YA89M3IKlR868BCuqowfWFO11LlU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990342; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V4FkSfvj750+ka7PWjTMb74hKbmp7/ZPYJHMlThBHC8=; b=dO6asD7ggsR99rzbtndt67srFHs1uPiewncRgLdAWXOrVDUv7RUnE2Gb09XPnpbHUfcVJT befZAZ8dpQQJj5AQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 13/18] migration: Use keyval input visitor in HMP set command Date: Wed, 9 Sep 2026 18:45:03 -0300 Message-ID: <20260909214509.237309-14-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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,suse.de:mid,suse.de:email]; 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: 1788990444628158500 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. One parameter, "cpr-exec-command", takes the strList type which needs to be built manually. This moves to a "legacy" suffixed function. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 195 +++++++---------------------- tests/qtest/migration/misc-tests.c | 2 +- 2 files changed, 49 insertions(+), 148 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 5d754414c4..0d93d38b05 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -25,7 +25,9 @@ #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" +#include "qapi/qobject-input-visitor.h" #include "qobject/qdict.h" +#include "qobject/qstring.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" #include "qemu/cutils.h" @@ -600,154 +602,14 @@ end: hmp_handle_error(hmp, err); } =20 -void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict) +static void hmp_migrate_set_parameter_legacy(MonitorHMP *hmp, const 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; 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: { + if (g_str_equal(param, "cpr-exec-command")) { /* * NOTE: g_autofree will only auto g_free() the strv array when * needed, it will not free the strings within the array. It's @@ -760,15 +622,14 @@ void hmp_migrate_set_parameter(MonitorHMP *hmp, const= QDict *qdict) =20 if (!g_shell_parse_argv(valuestr, NULL, &strv, &gerr)) { error_setg(&err, "%s", gerr->message); - break; + goto cleanup; } for (int i =3D 0; strv[i]; i++) { QAPI_LIST_APPEND(tail, strv[i]); } p->has_cpr_exec_command =3D true; - break; - } - default: + + } else { g_assert_not_reached(); } =20 @@ -778,12 +639,52 @@ void hmp_migrate_set_parameter(MonitorHMP *hmp, const= QDict *qdict) =20 qmp_migrate_set_parameters(p, &err); =20 - cleanup: +cleanup: qapi_free_MigrationParameters(p); + hmp_handle_error(hmp, err); +} + +static void hmp_migrate_set_parameter_qapi(MonitorHMP *hmp, const QDict *q= dict) +{ + const char *param =3D qdict_get_str(qdict, "parameter"); + const char *valuestr =3D qdict_get_str(qdict, "value"); + g_autoptr(QDict) input =3D qdict_new(); + g_autoptr(MigrationParameters) p =3D NULL; + Visitor *v; + Error *err =3D NULL; + + /* the same as keyval_parse(), but here there's no need to parse */ + qdict_put_obj(input, param, QOBJECT(qstring_from_str(valuestr))); + + v =3D qobject_input_visitor_new_keyval(QOBJECT(input)); + if (visit_type_MigrationParameters(v, NULL, &p, &err)) { + qmp_migrate_set_parameters(p, &err); + } + visit_free(v); hmp_handle_error(hmp, err); } =20 +void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict) +{ + const char *param =3D qdict_get_str(qdict, "parameter"); + + if (g_str_equal(param, "block-bitmap-mapping")) { + Error *err =3D NULL; + + error_setg(&err, "The %s parameter can only be set through QMP", p= aram); + hmp_handle_error(hmp, err); + return; + } + + /* this has a non-standard setter */ + if (g_str_equal(param, "cpr-exec-command")) { + return hmp_migrate_set_parameter_legacy(hmp, qdict); + } + + hmp_migrate_set_parameter_qapi(hmp, qdict); +} + void hmp_migrate_start_postcopy(MonitorHMP *hmp, const QDict *qdict) { Error *err =3D NULL; diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 2261ae7c89..4ac2f42a5a 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -50,7 +50,7 @@ typedef struct HMPTestData { HMPTestData test_cases[] =3D { TEST("", "", "migrate_set_parameter: string expected"), TEST("foo", "", "migrate_set_parameter: string expected"), - TEST("foo", "on", "Error: invalid parameter value: foo"), + TEST("foo", "on", "Error: Parameter 'foo' is unexpected"), =20 /* bool */ TEST("cpu-throttle-tailslow", "on", "on"), --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990426; cv=none; d=zohomail.com; s=zohoarc; b=ELhNNmgUUyCO8l8XQq2kILnGIIk8ZhDN8uw70gcIQ3nEiXfHOIuKnCxhvmPwgvAZgDp/EI5j1c6zUon7Fv0wrmql5BGjPFy/5XTtH+ca8ZpvZBs8+TA8fq1YvgDv6L90/FSmw8G+ygy4nF8Z6vduMt8SrRa2wJZXtigRBTgCp1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990426; 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=bw+m8KeOaZv93ExV8S82Z3OlqKiAwvoFqTWW5YOszXU=; b=gXXO7nzKIbIUa1Ochrk0SeXtbVCojmt7xRB6URMQho/gJij4h0L7Heaz4kCeLvgARmUE0QGgGg4O5mxklT9wfF7MITBUwE4809vaMWwBhQoiED2ja5Br7oMDdrWgT1MyRX2aFiyY7aixkvmbeLaeMLaKM0wgOtT0a8C8xVcD00A= 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 1788990426606463.4087096761166; Wed, 9 Sep 2026 14:47:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q7C-0000cX-Ab; Wed, 09 Sep 2026 17:45: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 1x4Q7A-0000bF-Gk for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:56 -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 1x4Q78-0005RB-4T for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45: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 B12371FCC4; Wed, 9 Sep 2026 21:45:44 +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 581AD1376E; Wed, 9 Sep 2026 21:45:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yOTWCIfToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990348; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bw+m8KeOaZv93ExV8S82Z3OlqKiAwvoFqTWW5YOszXU=; b=2FwqGAzdR0cs0Mb4nX57vnY5BJeZECnM/2onwQ+v/DRRwRbKAcTe7uoZSJ99TrTZYhOKqE kE/1lT6KJn52OqtNhAVY6GeKmaOxft9JHaP1NzmBf0Wah9g5xh9SPsU3FjkOsz8s6Aoy5U g+op/3uju2NU4rDax948H51qcFzR5RY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990348; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bw+m8KeOaZv93ExV8S82Z3OlqKiAwvoFqTWW5YOszXU=; b=iMKPif7H23ou4c3H/tc9mT1YAhiJNwVjMcDSZdq7DMIB0lB9/zXiFSXQ0VgQwL3pJl6vpC uXQ1kxv9HFvQaODQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990344; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bw+m8KeOaZv93ExV8S82Z3OlqKiAwvoFqTWW5YOszXU=; b=kS6YwW73xnBn84aSAjx3tGpr+DspmfimnQX5NmEzIFh0ERMWYSZzUCif2b4Ez8iq493jwY IuI9dKr6dfIywZIhKafxIFZSeGzl3Xni7U43oXeZLGXPCPDIjzUKsX+imWwSf+wQr7L0Sa vxfP62vDF7zxXq7LnUXMFH4GyOR8NSU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990344; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bw+m8KeOaZv93ExV8S82Z3OlqKiAwvoFqTWW5YOszXU=; b=fTMZZq5eSQUd+qWYAmS+pul22isTWHZx78uOs9+YFshagK7IkceaQA0rLsqTMQx/Yo6eMY mk1JT9KkDkXq2YAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v2 14/18] migration: Use output visitor in info command Date: Wed, 9 Sep 2026 18:45:04 -0300 Message-ID: <20260909214509.237309-15-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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: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: 1788990428599158500 Content-Type: text/plain; charset="utf-8" The hmp_info_migrate_parameters function currently open-codes the mon_printf calls for each migration parameter. As with the set command in the last patch, this should not be necessary as the QAPI infrastructure already has generated code that takes type and struct member names into account, including converting _ from C into the '-' character as part of parameter names strings. The current code is also quite painful to rebase if a series has been carried for a long time while parameters have been added in master. Replace all of this with a conversion from MigrationParameters to QDict using an output visitor and a loop over the QDict that prints per-QAPI-type formatted strings. Modelled after block/qapi.c:dump_qobject, but with some changes to keep the migration command output formatting. Note that this was not a for-free improvement, the HMP command format output was changed incompatibly in a previous patch. It doesn't output units anymore. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 238 ++++++++++++--------------------- migration/options.c | 2 +- migration/options.h | 1 + 3 files changed, 86 insertions(+), 155 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 0d93d38b05..5dfbb69390 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -26,7 +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" @@ -317,170 +322,95 @@ 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; + + 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", label); + + for (e =3D qlist_first(qobject_to(QList, obj)); e; e =3D qlist_nex= t(e)) { + /* + * In the first iteration, this is the space after the + * colon, otherwise it's the space between list + * elements. + */ + monitor_hmp_printf(hmp, " "); + hmp_migrate_print_qobject(hmp, "", e->value); + } + + 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:", - 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:"); - 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) { - if (bat->persistent) { - monitor_hmp_printf(hmp, " persistent: on"); - } else { - monitor_hmp_printf(hmp, " persistent: off"); - } - } - monitor_hmp_printf(hmp, " alias: %s", ba->alias); - } - monitor_hmp_printf(hmp, " node-name: %s alias: %s", - 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 990fcd6867..188c4ad20b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1089,7 +1089,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:50:53 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=1788990418; cv=none; d=zohomail.com; s=zohoarc; b=jyAH1znU9obE2MVJ9sFNH/F/J25GOleBPZaVFBRGVdKbDe3qcsK6weAKVpYB1ilRVWvk4OQDt8HSMBf9o/fK5fNDH4KAUw1lItcalLpX1m74WLu3wGio3Xgn/qzX3Bu2ZUlNlt5HDytkA0wXh2H4iZ37TIMSWpU5gt7dNLTIDUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990418; 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=eaRzMp7umhOhqpj5IY2MK30mm3oEcApxL1Io5d+plmY=; b=IMkDcoUylo3oAO5LOZzy1GkvW4HdWuGXrlAaSC208kw+8gBMaTVnCdF5p9w4jP/+XvCy/AR/nvjPUe3/dBIIhG5CEyQ1+xE4tjJYQTW42t+6iQHwIf99Aj1zZoV8lgKkB3ny59pQZOQ31tCtEED2zbZsm3V9MYeFvj4wRhvKML0= 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 1788990418059757.661381096936; Wed, 9 Sep 2026 14:46:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q7D-0000co-3o; Wed, 09 Sep 2026 17:45:59 -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 1x4Q7B-0000cH-AI for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:57 -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 1x4Q79-0005RS-PH for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:45:57 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 743FF1FCC6; Wed, 9 Sep 2026 21:45: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 12CA413770; Wed, 9 Sep 2026 21:45: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 0PpbM4jToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990350; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eaRzMp7umhOhqpj5IY2MK30mm3oEcApxL1Io5d+plmY=; b=j2TXwUK81VuJlrc0qmrHcbnuxUfWo6B8WURiwcTJIn1gHj43T2T0uI82wjZ5QPONbUqIGx dhozczCx97ka53osANiTJi7/HkTsz9EVCVxOHS3c2KG7f5OvpXohfo0yo2q13aG5UOQlYt T3lfp+jJjttkp+CoEtNV+4BKNzX1smQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990350; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eaRzMp7umhOhqpj5IY2MK30mm3oEcApxL1Io5d+plmY=; b=9y9VpERuCo0bIWyNUeq5hGP50IC3s20LuL9Z8ex9cNIWFdCP3WIKUkc+7R/Qri+71YSQp7 EsQw3WeRLfG2GICQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990346; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eaRzMp7umhOhqpj5IY2MK30mm3oEcApxL1Io5d+plmY=; b=Dzyr9PGdsT9N2kWAR26jAMwjU/XUBLW7eY/4d48fQUy9eSu70kFb13iWwjfWL7tMtua0BH aJTIiUKVi+wHJwNVfohHnR0cKlg+DHCHxDXWQHKeJ8Y7ADs+7uZBAhJ3OuTsrO8bhMCkow fY3FUHXJCbBoIuPbDileSTBAV1hAinc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990346; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eaRzMp7umhOhqpj5IY2MK30mm3oEcApxL1Io5d+plmY=; b=qzQCFLS1aN74HI6ot8AU4g8FWJzLvmz07XnGAhepCr6Znf7XztFbD1qr+2/nwJnHLXSOZc I+RA2//MlWXVVqCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" Subject: [PATCH v2 15/18] migration: Rewrite migrate_set_parameter_completion using QDict Date: Wed, 9 Sep 2026 18:45:05 -0300 Message-ID: <20260909214509.237309-16-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.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_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=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: 1788990418548158500 Content-Type: text/plain; charset="utf-8" The migrate_set_parameter_completion function is the last user of the MigrationParameter enum. Write the code using an output visitor and QDict instead so we can remove the enum in a future patch. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 5dfbb69390..720913255f 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -736,14 +736,19 @@ void migrate_set_capability_completion(ReadLineState = *rs, int nb_args, void migrate_set_parameter_completion(ReadLineState *rs, int nb_args, const char *str) { + g_autoptr(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:50:53 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=1788990388; cv=none; d=zohomail.com; s=zohoarc; b=Rr3SjVddAC8nKpSBTqW1RHLEn+f4ZkTseDotTh0Xe2jpixrnmWdzKelVcD7TmEyiVF8jtDlFInpvferv5MnBXhEBArHnmNPQhyFa+9UhbwhpV8+nS/79/SObTOSnPLJlU+upUWnyJufEtNA70FE+rLkzT+9ZSoX5JEF28DFMLlc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990388; 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=QK20x9B437qCcKHi6lpSXqmLY3Zjg1kMeWo5wS+ZW0o=; b=LERDnJtx9tTH/lCYx0yOzMxBAQcoGI9vHJEcwlWdl/R04HmVD2mkiMyUiNAdWSyHMaThbWGCFTnLlqICN/wq5DkDBaHqUERN8Izce84CANwBt4/QUoX80AxbQTXzK9jHuJgEZMNBgrW4zEGHj0+4pUkIhT/EsZBspQSxb9SaWi4= 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 1788990388590378.99830107709636; Wed, 9 Sep 2026 14:46:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q7G-0000e3-6N; Wed, 09 Sep 2026 17:46: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 1x4Q7E-0000d3-Cx for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:46:00 -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 1x4Q7B-0005Rl-SQ for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:46:00 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 798C31FCD6; Wed, 9 Sep 2026 21:45:48 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D2953137EC; Wed, 9 Sep 2026 21:45: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 OH3JJorToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990352; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QK20x9B437qCcKHi6lpSXqmLY3Zjg1kMeWo5wS+ZW0o=; b=CiBoSBrLezG/HXgCo7x1uXN5Y5vpqdVGyymprNaK3j14tnDoguEsJYxgfDenyaFLHmJVFq Z5fVXvBljOkpnYl8EogfId0Rlf0o8afRFmVtyOFPGVNLocbm8WewjUuo+4A3kL1p8AP2bL BLstmSnefPSbj5xIHh2cuGsZApL0JiM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990352; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QK20x9B437qCcKHi6lpSXqmLY3Zjg1kMeWo5wS+ZW0o=; b=y5BVNqihaFOgFEFs4qMILW/Nvd3sEDuRy+BvrqZ1lPy4WG2yNncKPF+yerw1dUuRJeqglb 6EkFqwl31e5CyQCg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990348; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QK20x9B437qCcKHi6lpSXqmLY3Zjg1kMeWo5wS+ZW0o=; b=Yysl0I7AsIcbshJ76Osn5GNcNpX4EAKF5fqZjHfvfTDqK3mCuvz9w515e+l85X67MTGCOz 76z7IOY5LLmCTr3/eiu816rmhVmWEFdHG8NDcluy8yRfxxbqukn833mIe0AWi7a1ccgveS Rw9CtGKeikb3F9tCx9bHP0I0InfnuaY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990348; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QK20x9B437qCcKHi6lpSXqmLY3Zjg1kMeWo5wS+ZW0o=; b=fXE4Ti8uHgGHlZs8FWzHUnwh1gQTz933ADkqT4VmG9tYvVXa9GnbEhD2BSgZiy4VkQ8qCI 0OTf8YuPSOSjUcAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Eric Blake Subject: [PATCH v2 16/18] migration: Add capabilities into MigrationParameters Date: Wed, 9 Sep 2026 18:45:06 -0300 Message-ID: <20260909214509.237309-17-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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)[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: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: 1788990390848158500 Content-Type: text/plain; charset="utf-8" Add capabilities to MigrationParameters. This structure will hold all migration options. Capabilities will go away in the next patch. From this point on, both QMP and HMP versions of migrate-set-parameters and query-migrate-parameters gain the ability to work with capabilities. With MigrationParameters now having members for each capability, the migration capabilities commands (query-migrate-capabilities, migrate-set-capabilities) will soon be deprecated. Add a set of helpers to convert between the old MigrationCapability representation and the new representation as members of MigrationParameters. Acked-by: Peter Xu Signed-off-by: Fabiano Rosas Acked-by: Markus Armbruster --- migration/migration.c | 8 +++ migration/options.c | 71 ++++++++++++++++++++++++ migration/options.h | 5 ++ qapi/migration.json | 124 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 204 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index dab282dd2f..c8e7e86ea0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4086,6 +4086,14 @@ static bool migration_object_check(MigrationState *m= s, Error **errp) return false; } =20 + /* + * FIXME: Temporarily while -global capabilties are still using + * s->capabilities. Will be gone by the end of the series. + */ + for (int i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { + migrate_capability_set_compat(&ms->parameters, i, ms->capabilities= [i]); + } + return migrate_caps_check(old_caps, ms->capabilities, errp); } =20 diff --git a/migration/options.c b/migration/options.c index 188c4ad20b..aff5d8f550 100644 --- a/migration/options.c +++ b/migration/options.c @@ -775,6 +775,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; @@ -816,6 +862,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 */ @@ -1139,6 +1187,15 @@ static void migrate_mark_all_params_present(Migratio= nParameters *p) &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, &p->has_x_rdma_chunk_size, &p->has_cpr_exec_command, + &p->has_xbzrle, &p->has_rdma_pin_all, + &p->has_auto_converge, &p->has_events, + &p->has_postcopy_ram, &p->has_x_colo, &p->has_release_ram, + &p->has_return_path, &p->has_pause_before_switchover, &p->has_mult= ifd, + &p->has_dirty_bitmaps, &p->has_postcopy_blocktime, + &p->has_late_block_activate, &p->has_x_ignore_shared, + &p->has_validate_uuid, &p->has_background_snapshot, + &p->has_zero_copy_send, &p->has_postcopy_preempt, + &p->has_switchover_ack, &p->has_dirty_limit, &p->has_mapped_ram, }; =20 len =3D ARRAY_SIZE(has_fields); @@ -1414,6 +1471,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 b1eaf7b054..5f4ad965d6 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -830,7 +830,14 @@ 'zero-page-detection', 'direct-io', { 'name': 'x-rdma-chunk-size', 'features': [ 'unstable' ] }, - 'cpr-exec-command'] } + 'cpr-exec-command', + '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: @@ -1012,10 +1019,98 @@ # Must be set to the same value on both source and destination # before migration starts. (Since 11.1) # +# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length +# Encoding). This feature allows us to minimize migration traffic +# for certain work loads, by sending compressed difference of the +# pages +# +# @rdma-pin-all: Controls whether or not the entire VM memory +# footprint is mlock()'d on demand or all at once. Refer to +# docs/rdma.txt for usage. Disabled by default. (since 2.0) +# +# @events: generate events for each migration state change (since 2.4) +# +# @auto-converge: If enabled, QEMU will automatically throttle down +# the guest to speed up convergence of RAM migration. (since 1.6) +# +# @postcopy-ram: Start executing on the migration target before all of +# RAM has been migrated, pulling the remaining pages along as +# needed. The capacity must have the same setting on both source +# and target or migration will not even start. **Note:** if the +# migration fails during postcopy the VM will fail. (since 2.6) +# +# @x-colo: If enabled, migration will never end, and the state of the +# VM on the primary side will be migrated continuously to the VM +# on secondary side, this process is called COarse-Grain LOck +# Stepping (COLO) for Non-stop Service. (since 2.8) +# +# @release-ram: if enabled, QEMU will free the migrated ram pages on +# the source during postcopy-ram migration. (since 2.9) +# +# @return-path: If enabled, migration will use the return path even +# for precopy. (since 2.10) +# +# @pause-before-switchover: Pause outgoing migration before +# serialising device state and before disabling block IO +# (since 2.11) +# +# @multifd: Use more than one fd for migration (since 4.0) +# +# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps. +# (since 2.12) +# +# @postcopy-blocktime: Calculate downtime for postcopy live migration +# (since 3.0) +# +# @late-block-activate: If enabled, the destination will not activate +# block devices (and thus take locks) immediately at the end of +# migration. (since 3.0) +# +# @x-ignore-shared: If enabled, QEMU will not migrate shared memory +# that is accessible on the destination machine. (since 4.0) +# +# @validate-uuid: Send the UUID of the source to allow the destination +# to ensure it is the same. (since 4.2) +# +# @background-snapshot: If enabled, the migration stream will be a +# snapshot of the VM exactly at the point when the migration +# procedure starts. The VM RAM is saved with running VM. +# (since 6.0) +# +# @zero-copy-send: Controls behavior on sending memory pages on +# migration. When true, enables a zero-copy mechanism for sending +# memory pages, if host supports it. Requires that QEMU be +# permitted to use locked memory for guest RAM pages. (since 7.1) +# +# @postcopy-preempt: If enabled, the migration process will allow +# postcopy requests to preempt precopy stream, so postcopy +# requests will be handled faster. This is a performance feature +# and should not affect the correctness of postcopy migration. +# (since 7.1) +# +# @switchover-ack: If enabled, migration will not stop the source VM +# and complete the migration until 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 @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 ## @@ -1053,7 +1148,28 @@ '*direct-io': 'bool', '*x-rdma-chunk-size': { 'type': 'uint64', 'features': [ 'unstable' ] }, - '*cpr-exec-command': [ 'str' ]} } + '*cpr-exec-command': [ 'str' ], + '*xbzrle': 'bool', + '*rdma-pin-all': 'bool', + '*auto-converge': 'bool', + '*events': 'bool', + '*postcopy-ram': 'bool', + '*x-colo': { 'type': 'bool', 'features': [ 'unstable' ] }, + '*release-ram': 'bool', + '*return-path': 'bool', + '*pause-before-switchover': 'bool', + '*multifd': 'bool', + '*dirty-bitmaps': 'bool', + '*postcopy-blocktime': 'bool', + '*late-block-activate': 'bool', + '*x-ignore-shared': { 'type': 'bool', 'features': [ 'unstable'= ] }, + '*validate-uuid': 'bool', + '*background-snapshot': 'bool', + '*zero-copy-send': 'bool', + '*postcopy-preempt': 'bool', + '*switchover-ack': 'bool', + '*dirty-limit': 'bool', + '*mapped-ram': 'bool' } } =20 ## # @query-migrate-parameters: --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990423; cv=none; d=zohomail.com; s=zohoarc; b=VMYTtIQwj+A6SeS3K9PEwc4VqvJ23yjWkQUeK07BsNS4HBI5/UT3ldZLSk+yHu+009d19IS29ch16hp8XxNgvfyOemNWFGWqfEoyZq4E6ZT5rKsRS8jttDyGzYdQMVhh0ustfJxGAVxyQpueDwrt3Iyz86hHsFtKYA6BUKbRtlk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990423; 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=gKT19oFwAqR9DWXfIhOmbtwsuGfUWlxtbfLD9UiOf6s=; b=bX2b78g7RlUzGROLjxE0FQFAC4ul4GO+LWE4sNA/s9Fjs8fa1SWDJunpdRwD1pDppL2gxt0GGXNKvFHHnbtiB46RhGyhofUEaUfnVMerXSGV2HcIASf7OXwjjA8PPi/ZajtCbNwYAZHt7Us6Y9viMxQcX5w0B12LY4AQUS4U3E8= 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 1788990423353333.2873860128616; Wed, 9 Sep 2026 14:47:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q7Q-0000f4-BT; Wed, 09 Sep 2026 17:46:12 -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 1x4Q7I-0000eK-54 for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:46:04 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x4Q7E-0005Ru-GV for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:46:03 -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 D87DF1FCD0; Wed, 9 Sep 2026 21:45:50 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DA13F13892; Wed, 9 Sep 2026 21:45: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 mNbqKIzToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990355; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gKT19oFwAqR9DWXfIhOmbtwsuGfUWlxtbfLD9UiOf6s=; b=ZNiAnWPz+FDQ0rApFBln1GJwtmJ1oV71PJTFlp7iHXyfFES8pg3GDNtFqFWZSvoq5t8P/a AaK2aB5YWtDOsjGEeBEywfLnqB/rr1BO/7J6+rOwpOuCcOo4Ju7aU07YW9NW2G18G/B0E+ Bh/LxZ34wU8NbgVKux96LJw27oEZzrw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990355; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gKT19oFwAqR9DWXfIhOmbtwsuGfUWlxtbfLD9UiOf6s=; b=Gc+DI9cC2NaePMWBBP8M1W6b9MLBiATEoCDPyNB68U9tvJbatBK5jGVONblkmQxPgBZ4WW F9Cz8lmiwVjygOAQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990350; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gKT19oFwAqR9DWXfIhOmbtwsuGfUWlxtbfLD9UiOf6s=; b=IR36g8QyltDcebD66GR+ts+L8caiiL9Hf1WH+d8yuf7FJi2f9LOT7ZDT6ExIQwvxNWJKSm 7gpGMuasgyZ21QBo4eoudwXD4gJvx/RVrz38ex5mYL8am5B3VFxhNSDn/xI8aZOuJkEcJd E0wWY+YhgSIhBSHRCSAyikQcPBAK+rw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990350; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gKT19oFwAqR9DWXfIhOmbtwsuGfUWlxtbfLD9UiOf6s=; b=S9DWq4mM2G3PWaEMwn+JuTXtHMvlncRJyBY6XpJ8T8fBwn4FglSXEOY5E0liGZ0kvDUkNi uG6uH1YncyBxGeDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 17/18] migration: Remove s->capabilities Date: Wed, 9 Sep 2026 18:45:07 -0300 Message-ID: <20260909214509.237309-18-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-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,suse.de:mid,suse.de:email]; 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: 1788990424604158500 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 | 141 +++++++++++++ 6 files changed, 285 insertions(+), 225 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c8e7e86ea0..69dd4f3d05 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -255,9 +255,10 @@ static bool migration_capabilities_and_transport_compatible(MigrationAddress *addr, Error **errp) { + MigrationState *s =3D migrate_get_current(); + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - return migrate_rdma_caps_check(migrate_get_current()->capabilities, - errp); + return migrate_rdma_caps_check(&s->parameters, errp); } =20 return true; @@ -4079,22 +4080,7 @@ static void migration_instance_init(Object *obj) */ static bool migration_object_check(MigrationState *ms, Error **errp) { - /* Assuming all off */ - bool old_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; - - if (!migrate_params_check(&ms->parameters, errp)) { - return false; - } - - /* - * FIXME: Temporarily while -global capabilties are still using - * s->capabilities. Will be gone by the end of the series. - */ - for (int i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - migrate_capability_set_compat(&ms->parameters, i, ms->capabilities= [i]); - } - - return migrate_caps_check(old_caps, ms->capabilities, errp); + return migrate_params_check(&ms->parameters, errp); } =20 static const TypeInfo migration_type =3D { diff --git a/migration/migration.h b/migration/migration.h index e47ff4e3d1..e1204b7f0d 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 aff5d8f550..a25c9c2523 100644 --- a/migration/options.c +++ b/migration/options.c @@ -85,9 +85,6 @@ #define DEFAULT_MIGRATE_ANNOUNCE_ROUNDS 5 #define DEFAULT_MIGRATE_ANNOUNCE_STEP 100 =20 -#define DEFINE_PROP_MIG_CAP(name, x) \ - DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) - const PropertyInfo qdev_prop_StrOrNull; #define DEFINE_PROP_STR_OR_NULL(_name, _state, _field) \ DEFINE_PROP(_name, _state, _field, qdev_prop_StrOrNull, StrOrNull *, \ @@ -195,32 +192,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 @@ -303,7 +310,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) @@ -317,144 +324,142 @@ bool migrate_background_snapshot(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; + return s->parameters.background_snapshot; } =20 bool migrate_colo(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; + return s->parameters.x_colo; } =20 bool migrate_dirty_bitmaps(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; + return s->parameters.dirty_bitmaps; } =20 bool migrate_dirty_limit(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_DIRTY_LIMIT]; + return s->parameters.dirty_limit; } =20 bool migrate_events(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; + return s->parameters.events; } =20 bool migrate_mapped_ram(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM]; + return s->parameters.mapped_ram; } =20 bool migrate_ignore_shared(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; + return s->parameters.x_ignore_shared; } =20 bool migrate_late_block_activate(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; + return s->parameters.late_block_activate; } =20 bool migrate_multifd(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; + return s->parameters.multifd; } =20 bool migrate_pause_before_switchover(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; + return s->parameters.pause_before_switchover; } =20 bool migrate_postcopy_blocktime(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; + return s->parameters.postcopy_blocktime; } =20 bool migrate_postcopy_preempt(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; + return s->parameters.postcopy_preempt; } =20 bool migrate_postcopy_ram(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; + return s->parameters.postcopy_ram; } =20 bool migrate_rdma_pin_all(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL]; + return s->parameters.rdma_pin_all; } =20 bool migrate_release_ram(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; + return s->parameters.release_ram; } =20 bool migrate_return_path(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; + return s->parameters.return_path; } =20 bool migrate_switchover_ack(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_SWITCHOVER_ACK]; + return s->parameters.switchover_ack; } =20 bool migrate_validate_uuid(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; + return s->parameters.validate_uuid; } =20 bool migrate_xbzrle(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; + return s->parameters.xbzrle; } =20 bool migrate_zero_copy_send(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; + return s->parameters.zero_copy_send; } =20 -/* pseudo capabilities */ - bool migrate_multifd_flush_after_each_section(void) { MigrationState *s =3D migrate_get_current(); @@ -506,44 +511,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; @@ -552,34 +519,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; } @@ -587,30 +548,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"= ); @@ -618,27 +572,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. @@ -654,41 +608,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; } @@ -700,22 +658,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; @@ -728,30 +686,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"= ); @@ -769,7 +726,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; @@ -831,39 +788,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 */ @@ -924,9 +879,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) @@ -1451,6 +1405,10 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (!migrate_caps_check(params, errp)) { + return false; + } + return true; } =20 @@ -1471,20 +1429,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 5b0e89ca7c..c284b76f60 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -291,7 +291,8 @@ static uint32_t get_validatable_capabilities_count(void) uint32_t result =3D 0; int i; for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->capabilities[i]) { + if (should_validate_capability(i) && + migrate_capability_get_compat(&s->parameters, i)) { result++; } } @@ -313,7 +314,8 @@ static bool configuration_pre_save(void *opaque, Error = **errp) state->capabilities =3D g_renew(MigrationCapability, state->capabiliti= es, state->caps_count); for (i =3D j =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->capabilities[i]) { + if (should_validate_capability(i) && + migrate_capability_get_compat(&s->parameters, i)) { state->capabilities[j++] =3D i; } } @@ -362,7 +364,7 @@ static bool configuration_validate_capabilities(SaveSta= te *state) continue; } source_state =3D test_bit(i, source_caps_bm); - target_state =3D s->capabilities[i]; + target_state =3D migrate_capability_get_compat(&s->parameters, i); if (source_state !=3D target_state) { error_report("Capability %s is %s, but received capability is = %s", MigrationCapability_str(i), diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 4ac2f42a5a..b1179d3af7 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -55,6 +55,147 @@ HMPTestData test_cases[] =3D { /* bool */ TEST("cpu-throttle-tailslow", "on", "on"), TEST("direct-io", "on", "on"), + TEST("events", "on", "on"), + + /* bool, with dependencies */ + + /* + * background-snapshot: + * rejects dirty-bitmaps + * rejects postcopy-blocktime + * rejects late-block-activate + * rejects multifd + * rejects pause-before-switchover + * rejects auto-converge + * rejects release-ram + * rejects rdma-pin-all + * rejects validate-uuid + * rejects zero-copy-send + * rejects postcopy-ram + */ + TEST("background-snapshot", "on", "on"), + TEST("dirty-bitmaps", "on", BG_SNAP_MSG), + TEST("postcopy-blocktime", "on", BG_SNAP_MSG), + TEST("late-block-activate", "on", BG_SNAP_MSG), + TEST("multifd", "on", BG_SNAP_MSG), + TEST("pause-before-switchover", "on", BG_SNAP_MSG), + TEST("auto-converge", "on", BG_SNAP_MSG), + TEST("release-ram", "on", BG_SNAP_MSG), + TEST("rdma-pin-all", "on", BG_SNAP_MSG), + TEST("validate-uuid", "on", BG_SNAP_MSG), + TEST("zero-copy-send", "on", BG_SNAP_MSG), + TEST("postcopy-ram", "on", BG_SNAP_MSG), + TEST("background-snapshot", "off", "off"), + + TEST("dirty-bitmaps", "on", "on"), + TEST("postcopy-blocktime", "on", "on"), + TEST("late-block-activate", "on", "on"), + TEST("pause-before-switchover", "on", "on"), + TEST("auto-converge", "on", "on"), + TEST("release-ram", "on", "on"), + TEST("rdma-pin-all", "on", "on"), + TEST("validate-uuid", "on", "on"), + + /* + * postcopy-preempt + * requires postcopy-ram: + */ + TEST("postcopy-preempt", "on", + "Error: Postcopy preempt requires postcopy-ram"), + + /* + * postcopy-ram: + * required by postcopy-preempt + * rejected by x-ignore-shared + * rejected by background-snapshot + * rejected by mapped-ram + */ + TEST("postcopy-ram", "on", "on"), + TEST("postcopy-preempt", "on", "on"), + TEST("x-ignore-shared", "on", + "Error: Postcopy is not compatible with ignore-shared"), + TEST("background-snapshot", "on", BG_SNAP_MSG), + TEST("mapped-ram", "on", + "Error: Postcopy Preempt is incompatible with fast snapshot load"= ), + TEST("postcopy-ram", "off", + "Error: Postcopy preempt requires postcopy-ram"), + TEST("postcopy-preempt", "off", "off"), + TEST("postcopy-ram", "off", "off"), + + /* + * x-ignore-shared: + * rejected by postcopy-ram + */ + TEST("x-ignore-shared", "on", "on"), + TEST("postcopy-ram", "on", + "Error: Postcopy is not compatible with ignore-shared"), + TEST("x-ignore-shared", "off", "off"), + + /* + * return-path: + * required by x-colo + * required by switchover-ack + * rejected by background-snapshot + */ + TEST("return-path", "on", "on"), + TEST("x-colo", "on", "on"), + TEST("switchover-ack", "on", "on"), + TEST("background-snapshot", "on", BG_SNAP_MSG), + + TEST("return-path", "off", + "Error: Capability 'x-colo' requires capability 'return-path'"), + TEST("x-colo", "off", "off"), + + TEST("return-path", "off", + "Error: Capability 'switchover-ack' requires capability " + "'return-path'"), + TEST("switchover-ack", "off", "off"), + TEST("return-path", "off", "off"), + + TEST("x-colo", "on", + "Error: Capability 'x-colo' requires capability 'return-path'"), + TEST("switchover-ack", "on", "Error: Capability 'switchover-ack' requi= res " + "capability 'return-path'"), + + /* + * xbzrle: + * rejected by multifd + */ + TEST("xbzrle", "on", "on"), + TEST("multifd", "on", "Error: Multifd is not compatible with xbzrle"), + TEST("xbzrle", "off", "off"), + + /* + * multifd: + * rejected by xbzrle + * required by zero-copy-send + */ + TEST("multifd", "on", "on"), + TEST("xbzrle", "on", "Error: Multifd is not compatible with xbzrle"), + TEST("zero-copy-send", "on", "on"), + TEST("multifd", "off", "Error: Zero copy only available for " + "non-compressed non-TLS multifd migration"), + TEST("zero-copy-send", "off", "off"), + TEST("multifd", "off", "off"), + + /* + * auto-converge: + * rejected by dirty-limit + */ + TEST("auto-converge", "on", "on"), + TEST("dirty-limit", "on", + "Error: dirty-limit conflicts with auto-converge " + "either of then available currently"), + TEST("auto-converge", "off", "off"), + + /* + * dirty-limit: + * rejected by auto-converge + * requires KVM acceleration + */ + TEST("dirty-limit", "on", + "Error: dirty-limit requires KVM with accelerator " + "property 'dirty-ring-size' set"), =20 /* uint64_t */ TEST("announce-initial", "60", "60"), --=20 2.53.0 From nobody Sat Sep 26 20:50:53 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=1788990437; cv=none; d=zohomail.com; s=zohoarc; b=L6xQGgRxSdHkzY1dAn855HzJyZj07b6dgj7Wtr4N89MVoh0NuzgqoISQ5pftsNDwy1Q2sJld1IGnTjsc8SZ7F4VFOpBZjAaakV/dfcKGrQPhmzkyJYcnn4y++QK2N9bn4wikZtOEhFTWKJ8IwwLx10FlWDfms/t1mWyfFz78AWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788990437; 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=aX6IiCTpXzspbXQdYRKpTMJ2dc1utc7YAPLHFbx1dyg=; b=KDMpXzlQikn3gIlOFYuSWVEqlgI5keQTca3+cMJS/b0O6UYdOTfeoPpAUOEQDAkWX3BBpY6JfsdkgIJDV/XYjo2TkkYV4c4ZjDcz+VBlKbsHZRa2W8gQ8pQdgAsiKbj5DAk6siOxZNJiEoaKuD5VhPXArZhAv7rPopVQ8e2/8zg= 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 1788990437959386.68024548932397; Wed, 9 Sep 2026 14:47:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4Q7Q-0000f8-DM; Wed, 09 Sep 2026 17:46:12 -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 1x4Q7I-0000eo-Qz for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:46:06 -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 1x4Q7G-0005S5-EH for qemu-devel@nongnu.org; Wed, 09 Sep 2026 17:46:04 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0A37521C81; Wed, 9 Sep 2026 21:45:53 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3B55813223; Wed, 9 Sep 2026 21:45:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +L4FAo/ToWqzawAAD6G6ig (envelope-from ); Wed, 09 Sep 2026 21:45:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990357; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aX6IiCTpXzspbXQdYRKpTMJ2dc1utc7YAPLHFbx1dyg=; b=LADpU/4ioZuER2LfDfGVU09G5u+z+PvB9hTdIZ41lcP6Un/R+qPKReZqo+6qcLtzyN4FZt Ku9/O53zA48rQKuJjfwlGAm9EusyDIxvPh2BcP8FXMI9+U4Wngx/LPEPNXAl3PNzDGT7FV 1VArYQNxISdGxNymyDZ1dOFdxnjy6mA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990357; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aX6IiCTpXzspbXQdYRKpTMJ2dc1utc7YAPLHFbx1dyg=; b=3SWmfQKhUk2++Iy9LrUjT/Z8DQMgIIAR3sn3/33vsaUnUyRLaf0JxptMnQ/EW9reZN77Ze rAUy6GVdqHzTVuBA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=SeBbmeiU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=FquJINND DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788990353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aX6IiCTpXzspbXQdYRKpTMJ2dc1utc7YAPLHFbx1dyg=; b=SeBbmeiUaa33MwHuytoOoCTqw5anV9Q0AaIXxpUIKRKfvRqJ6su0kP3aR47GOcH+J1Vuvj vpglp9+Fd2n3oqAJVLiyE9JtYLW4bYt+bdJH50W2sHfAwJUE34jayghGWvrafAZ7rkpBo+ J3AS7gjSjnWIiNK0Nn4yAIoDXJkKDlw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788990353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aX6IiCTpXzspbXQdYRKpTMJ2dc1utc7YAPLHFbx1dyg=; b=FquJINNDWu7utaTiFaO2fsLaRnmj+/yTU0FlgZIYAxtloJ4QWJU2H4Bp2ROLNNxAqnKg+2 5kIryfFjeP5UMmBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , "Dr . David Alan Gilbert" , Pierrick Bouvier , Eric Blake Subject: [PATCH v2 18/18] qapi/migration: Deprecate capabilities commands Date: Wed, 9 Sep 2026 18:45:08 -0300 Message-ID: <20260909214509.237309-19-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909214509.237309-1-farosas@suse.de> References: <20260909214509.237309-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 0A37521C81 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,2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; 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: 1788990438546158500 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 98c32991c9..1de1efcd9f 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -498,3 +498,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 720913255f..bd3713dc7a 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) { @@ -516,6 +519,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 5f4ad965d6..d622b47244 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