From nobody Mon Feb 9 04:32:46 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=1765836284; cv=none; d=zohomail.com; s=zohoarc; b=TyhLVHZ2/zyc6E8+nnEJBUNScPS5ZWM8sXc773ZBxG2+KXinHsNxVaEiG7G0OJ8iEC8+yE7cCz2oQ7mIDzT7n7svQWk9HNz4rIzq5GqHkIYWY9K92JsSHwKnPdyHLGORxMBkqr9mQ34YoTRzdNRHh7i45AczeX6sUGAMr1O/EJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836284; 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=sPKiPV4qnfJrVuIbKDvHrM0FXaudH6da2INI56Itx+o=; b=TGQNLNOzLmUUPpMreYrHouHQ+iLwI63+itqInaqcQMUU7u3/WZ3MTyMMcASsboktGaRcbL0YrZMndaY/yZVrkxRfYp6eqPvdJP8Lh9pNymDBb+ksBmWoxeztbYrC71B1TcmcdF45/AWe+HiD+QeLEJdKX0LD+HCt+LCDjFKqVbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17658362844101010.1663443970605; Mon, 15 Dec 2025 14:04:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGco-0002Wi-Bh; Mon, 15 Dec 2025 17:01:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGcn-0002Vu-85 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:01 -0500 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 1vVGcl-0002Sp-O9 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:01 -0500 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 BBD685BDDC; Mon, 15 Dec 2025 22:00:56 +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 328133EA65; Mon, 15 Dec 2025 22:00:54 +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 kBxCORaFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:00:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836058; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sPKiPV4qnfJrVuIbKDvHrM0FXaudH6da2INI56Itx+o=; b=qX1iQngPGE5ZhuvLJb9ypqKAQPkwEOfZLnuXE07tltUJbHMOD8C6RUTF6mJkX0RhaJpaHr dWqrM3Fz8nvLkECD+mAiVuewc8IzJwY0Wxtjjo4atKD5R06088tkzlxiNHBFKaRrFk8Pdo Hx9Ch0UsFRo5/M3tKQBObMVPKEMGgiM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836058; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sPKiPV4qnfJrVuIbKDvHrM0FXaudH6da2INI56Itx+o=; b=VBj0iKqHk8pjCyeWRzdNOYMHx1deUja0Nwgb5E589fYg72im9WkKQVcr848Pac/Z0kEvLs oeTfldFTHDi+LMCw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=pzd7MRgE; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="Y/iVI+yk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836056; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sPKiPV4qnfJrVuIbKDvHrM0FXaudH6da2INI56Itx+o=; b=pzd7MRgEKwnpCthY14t9OoLus+/Ll+TfXgYvfDTH6jonAl5SmAIJeSwMbAssiAZGnJe+/V O5gKN8HImBeYptcQfRyuMCzG13CLn1LtwkFTkdEfHM5XH9Nwe5qStWTyd8R519dpDLddxl zQzQWFy/b9aZOvEaDruS0UcRK9w2T8A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836056; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sPKiPV4qnfJrVuIbKDvHrM0FXaudH6da2INI56Itx+o=; b=Y/iVI+ykSf9MhyvXDm6rEkPYGwzb8hHVZ7NE6PgKfCNWzeab0Lcb58JYn2gn+WLkggYhuL koRmoaEf5rGLDLBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 01/51] migration: Fix leak of block_bitmap_mapping Date: Mon, 15 Dec 2025 18:59:47 -0300 Message-ID: <20251215220041.12657-2-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: BBD685BDDC X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1765836286611158500 Content-Type: text/plain; charset="utf-8" Caught by inspection, but ASAN also reports: Direct leak of 16 byte(s) in 1 object(s) allocated from: #0 in malloc #1 in g_malloc #2 in g_memdup #3 in qapi_clone_start_struct ../qapi/qapi-clone-visitor.c:40:12 #4 in qapi_clone_start_list ../qapi/qapi-clone-visitor.c:59:12 #5 in visit_start_list ../qapi/qapi-visit-core.c:80:10 #6 in visit_type_BitmapMigrationNodeAliasList qapi/qapi-visit-migration.c:= 639:10 #7 in migrate_params_apply ../migration/options.c:1407:13 #8 in qmp_migrate_set_parameters ../migration/options.c:1463:5 #9 in qmp_marshal_migrate_set_parameters qapi/qapi-commands-migration.c:21= 4:5 #10 in do_qmp_dispatch_bh ../qapi/qmp-dispatch.c:128:5 Note that this is entirely harmless because the migration object which contains the MigrationParameters structure is kept until the QEMU process exits. Reviewed-by: Markus Armbruster Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/migration.c b/migration/migration.c index b316ee01ab..c2e1dedf93 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4147,6 +4147,7 @@ static void migration_instance_finalize(Object *obj) { MigrationState *ms =3D MIGRATION_OBJ(obj); =20 + qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836168; cv=none; d=zohomail.com; s=zohoarc; b=X7VG959bpQpWk8SM8m9JDjAZghG4TzZp4yI3++npgbPL5fSpqlI2YTqxuQLhNUZpaXXzY4fvZVnG/AgY3bhmp3l3Hf+Z8R2tTjfJzk2abw9G9+ysO7bXrQuF1eEXaBgB+X2ECyiqAVJMHZ2rtLm2x+RkDc/FD0qv7u19RSJf5O0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836168; 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=aqSKHKXB35q61IRFyw+5V3cDKa/OP0Of9fa6aeAlz2A=; b=XdpiWTpVWK9r5BvQuZCfxsonaoVfIjcvh1+0AbjbuX3bKDrBDYGCubp2m2j+Y3T359QXpp/hlElgphj8RLO+WogzjKfywYnO1xGKBkaTaR2udICPZtDN+xoJ8imIfF/WAYfNu8CpdAozcvV6DZ9dfn3R9/EUnHQASCQQBCXEnxk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836168607348.51696507592203; Mon, 15 Dec 2025 14:02:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGcs-0002Yu-Gs; Mon, 15 Dec 2025 17:01:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGcr-0002Yj-Oe for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:05 -0500 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 1vVGcq-0002Xa-5E for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:05 -0500 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 CB06B337EB; Mon, 15 Dec 2025 22:00:58 +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 3DD343EA63; Mon, 15 Dec 2025 22:00:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aJdaABmFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:00:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836058; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aqSKHKXB35q61IRFyw+5V3cDKa/OP0Of9fa6aeAlz2A=; b=DeLBIqFNiTl5WZPt6zS1R0D1iJuQTqYNfLKO9ge63Tf4/LuRRQUVcluyw4NsdgMy40iqbJ Mr3GeWeOnzwv0mTv+kZR9ctXLleciAVhnzcDeP12aoa9LFrbFTUfczcHi0W24o+E3iEhXb E6yTvd6dsJXM/j/8m8/d366gk/zbMSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836058; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aqSKHKXB35q61IRFyw+5V3cDKa/OP0Of9fa6aeAlz2A=; b=bWT4pb9iQDaI07HzxA2ladNeJI9mIPqTodelPw1Gc/ABJrBg2etXykkvf8UkiDMF8dch9U wu3RNLkJUnNtqMAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=DeLBIqFN; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=bWT4pb9i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836058; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aqSKHKXB35q61IRFyw+5V3cDKa/OP0Of9fa6aeAlz2A=; b=DeLBIqFNiTl5WZPt6zS1R0D1iJuQTqYNfLKO9ge63Tf4/LuRRQUVcluyw4NsdgMy40iqbJ Mr3GeWeOnzwv0mTv+kZR9ctXLleciAVhnzcDeP12aoa9LFrbFTUfczcHi0W24o+E3iEhXb E6yTvd6dsJXM/j/8m8/d366gk/zbMSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836058; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aqSKHKXB35q61IRFyw+5V3cDKa/OP0Of9fa6aeAlz2A=; b=bWT4pb9iQDaI07HzxA2ladNeJI9mIPqTodelPw1Gc/ABJrBg2etXykkvf8UkiDMF8dch9U wu3RNLkJUnNtqMAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 02/51] migration: Fix leak of cpr_exec_command Date: Mon, 15 Dec 2025 18:59:48 -0300 Message-ID: <20251215220041.12657-3-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: CB06B337EB X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836170970154100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/migration.c b/migration/migration.c index c2e1dedf93..92c84c3177 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4148,6 +4148,7 @@ static void migration_instance_finalize(Object *obj) MigrationState *ms =3D MIGRATION_OBJ(obj); =20 qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); + qapi_free_strList(ms->parameters.cpr_exec_command); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836204; cv=none; d=zohomail.com; s=zohoarc; b=JAEkZ5JR6EZlMCCOL14Ea5q5UtNdv6RTKDStSXpCGsuD+tMtMZi1fLiSXyhDLuavoPz4lBGbalO1SvkUC78b6xQfxfYK5VVsKY/Swh3pBsRiiFWnmiZPFWNELVDsu8340nVkDQOkX1+CF88jkJKREj6ys0qK5tyfjQRaEEex57Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836204; 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=LHyH1wi1BDyLIvGvjJgSYDkoyZ9MRoI9THVPAKUCfYE=; b=Bra4oicuIJQRHmKSrGhe/gVk4MC9kiF/7x1WFoBFYIXj+dL0/Lz8W1vcVm/XSIXzzSBmCCv9og3kbUdJ2Ax6LoX0QPHkFPdHDCYcSJIVGneYuQ7OYpHzqMYReeTGinxN5MJ9dnfHC5yG5ltv/4NNEIKwft71yTRtEIQg0QDlD6Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836204579559.0652573073922; Mon, 15 Dec 2025 14:03:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGcy-0002Zx-Tv; Mon, 15 Dec 2025 17:01:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGcy-0002Zn-6N for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:12 -0500 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 1vVGcw-0002bT-Jl for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:11 -0500 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 DE8CE3378B; Mon, 15 Dec 2025 22:01:00 +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 5B7023EA63; Mon, 15 Dec 2025 22:00:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2FCTBxuFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:00:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LHyH1wi1BDyLIvGvjJgSYDkoyZ9MRoI9THVPAKUCfYE=; b=FJ5E9FSRJk8BkeezYpia4TkQQgvd2rETsLyJHpO8pVQ5z6AwGCPs2W6XjL+saeDBEQ8mSq cEfdjPjYXKoC+uakyrmIbz0lihlSRMlSsY8LsEQq7CkyUqt9+I3XhUrumFSUpWIgfb6jZO ovnHSpx6L5z+uYjJ/Yew9arcJf7KTUo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LHyH1wi1BDyLIvGvjJgSYDkoyZ9MRoI9THVPAKUCfYE=; b=OBP+Hg/ONQr28qpNkI5pGxCBMkBF0OoEJcJ9moee/ZhYxXCOIMiJpryjunjbmBXfXGOgEj uNBzsPi5BMBxSOAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836060; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LHyH1wi1BDyLIvGvjJgSYDkoyZ9MRoI9THVPAKUCfYE=; b=mALyZqfATZsDI/IndyPAJsLB3CrQOha9KoFXY8Csb1iZjHZica7GJY1rBSzc0aG8khBqLn ElhmpHg9rJn6jxKnfbxkCnV5OeglpyMltSGyumfApps7juJU5tDpdWUVZfL3ATwviYSvUC pL9MJZy/toFXjNkr0SLUDmML56XJ2nQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836060; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LHyH1wi1BDyLIvGvjJgSYDkoyZ9MRoI9THVPAKUCfYE=; b=vqvkh9ZjtXYooMj7h4XI+mY9aSC+KHLeA+Bvl84vJBhnVZ6DV53YY4CoA+auPOcMtdUduU pqXPQTJMOIeJSdCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 03/51] migration: Add a qdev property for StrOrNull Date: Mon, 15 Dec 2025 18:59:49 -0300 Message-ID: <20251215220041.12657-4-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.988]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1765836206045154100 Content-Type: text/plain; charset="utf-8" The MigrationState is a QOM object with TYPE_DEVICE as a parent. This was done about eight years ago so the migration code could make use of qdev properties to define the defaults for the migration parameters and to be able to expose migration knobs for debugging via the '-global migration' command line option. Due to unrelated historical reasons, three of the migration parameters (TLS options) received different types when used via the query-migrate-parameters QMP command than with the migrate-set-parameters command. This has created a lot of duplication in the migration code and in the QAPI documentation because the whole of MigrationParameters had to be duplicated as well. The migration code is now being fixed to remove the duplication and for that to happen the offending fields need to be reconciled into a single type. The StrOrNull type is going to be used. To keep the command line compatibility, the parameters need to continue being exposed via qdev properties accessible from the command line. Introduce a qdev property StrOrNull just for that. Note that this code is being kept in migration/options.c as this version of StrOrNull doesn't need to handle QNULL because it was never a valid option in the previous command line, which took a string. Signed-off-by: Fabiano Rosas Acked-by: Peter Xu --- migration/options.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/migration/options.c b/migration/options.c index e78324b80c..5f387437d1 100644 --- a/migration/options.c +++ b/migration/options.c @@ -83,6 +83,11 @@ #define DEFINE_PROP_MIG_CAP(name, x) \ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 +const PropertyInfo qdev_prop_StrOrNull; +#define DEFINE_PROP_STR_OR_NULL(_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_StrOrNull, StrOrNull *, \ + .set_default =3D true) + #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */ =20 @@ -206,6 +211,68 @@ const Property migration_properties[] =3D { }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 +static void get_StrOrNull(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + const Property *prop =3D opaque; + StrOrNull **ptr =3D object_field_prop_ptr(obj, prop); + StrOrNull *str_or_null =3D *ptr; + + if (!str_or_null) { + str_or_null =3D g_new0(StrOrNull, 1); + str_or_null->type =3D QTYPE_QSTRING; + str_or_null->u.s =3D g_strdup(""); + } else { + /* the setter doesn't allow QNULL */ + assert(str_or_null->type !=3D QTYPE_QNULL); + } + visit_type_str(v, name, &str_or_null->u.s, errp); +} + +static void set_StrOrNull(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + const Property *prop =3D opaque; + StrOrNull **ptr =3D object_field_prop_ptr(obj, prop); + StrOrNull *str_or_null =3D g_new0(StrOrNull, 1); + + /* + * Only str to keep compatibility, QNULL was never used via + * command line. + */ + str_or_null->type =3D QTYPE_QSTRING; + if (!visit_type_str(v, name, &str_or_null->u.s, errp)) { + return; + } + + qapi_free_StrOrNull(*ptr); + *ptr =3D str_or_null; +} + +static void release_StrOrNull(Object *obj, const char *name, void *opaque) +{ + const Property *prop =3D opaque; + qapi_free_StrOrNull(*(StrOrNull **)object_field_prop_ptr(obj, prop)); +} + +static void set_default_value_tls_opt(ObjectProperty *op, const Property *= prop) +{ + object_property_set_default_str(op, ""); +} + +/* + * String property like qdev_prop_string, except it's backed by a + * StrOrNull instead of a char *. This is intended for + * TYPE_MIGRATION's TLS options. + */ +const PropertyInfo qdev_prop_StrOrNull =3D { + .type =3D "StrOrNull", + .get =3D get_StrOrNull, + .set =3D set_StrOrNull, + .release =3D release_StrOrNull, + .set_default_value =3D set_default_value_tls_opt, +}; + bool migrate_auto_converge(void) { MigrationState *s =3D migrate_get_current(); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836217; cv=none; d=zohomail.com; s=zohoarc; b=jJQd4XSCyILRT5r3Qq+lpiESUABSSdjIaP50E/ShdvbhnYXlbUOthvkS9ZC6SZlnQ7tFwLUO7YwFwhtgW8V5SEoYj0omrVe1dE6+Rj8gK8ucMk4C6lZR8mJamYPMDqJrEUiFxaegszHZGK+PGa/nWMe2bg5fykg9J2s0gH6+734= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836217; 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=0K1fu1mNGa4DgwXAabBAcn15v7sFjUTK81CTwi/5MFM=; b=LEjhtaJTy1usoB4id/Za86afb6jiVZSVCbqdMHldk7+qf9J9/ZHZ/6zsbq37uyhOSOqsdh2vYvsLL4pv884T9Swpi8H1uIq3VKoFBWJHkY02g67FdyB5LaxMiPEqbjEtYBfFnJ0viMlA8dZXb2knNDURHb7NgW78Zebdu8CkVNw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836217310169.55372109361758; Mon, 15 Dec 2025 14:03:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGcu-0002ZO-Pe; Mon, 15 Dec 2025 17:01:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGct-0002ZB-95 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:07 -0500 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 1vVGcr-0002YG-Ib for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:07 -0500 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 7B0645BDDC; Mon, 15 Dec 2025 22:01:03 +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 72FB03EA63; Mon, 15 Dec 2025 22:01:01 +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 6M03DR2FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836063; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0K1fu1mNGa4DgwXAabBAcn15v7sFjUTK81CTwi/5MFM=; b=CmMl06/mx2qQu12NvGWwH+dx/uzXP5fNeoLvulmV2xZbdqURL05EPeLkr1R25qfQj7Kaq4 r2XJJiOROh075kdzGWpretV5Q9sbdJkZcH84qZWVnIjtmQLI9sW+ak02DdN4leXEexhpul bH99sJULauGh3z7hS6pIx1iYtKdttu8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836063; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0K1fu1mNGa4DgwXAabBAcn15v7sFjUTK81CTwi/5MFM=; b=H8G5BWlyo1ub0KJ5hdTteF5ZDMxWfXWbjGdb9S1mPN4ie6Y/+YCgD5lri+VlI3b4OpVnKi 6Z+AIkQX3BKxKfBg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836063; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0K1fu1mNGa4DgwXAabBAcn15v7sFjUTK81CTwi/5MFM=; b=CmMl06/mx2qQu12NvGWwH+dx/uzXP5fNeoLvulmV2xZbdqURL05EPeLkr1R25qfQj7Kaq4 r2XJJiOROh075kdzGWpretV5Q9sbdJkZcH84qZWVnIjtmQLI9sW+ak02DdN4leXEexhpul bH99sJULauGh3z7hS6pIx1iYtKdttu8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836063; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0K1fu1mNGa4DgwXAabBAcn15v7sFjUTK81CTwi/5MFM=; b=H8G5BWlyo1ub0KJ5hdTteF5ZDMxWfXWbjGdb9S1mPN4ie6Y/+YCgD5lri+VlI3b4OpVnKi 6Z+AIkQX3BKxKfBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 04/51] tests/qtest/migration: Add a NULL parameters test for TLS Date: Mon, 15 Dec 2025 18:59:50 -0300 Message-ID: <20251215220041.12657-5-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.990]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836219639154100 Content-Type: text/plain; charset="utf-8" Make sure the TLS options handling is working correctly with a NULL parameter. This is relevant due to the usage of StrOrNull for the tls-creds, tls-authz and tls-hostname options. With this, all manners of passing TLS options are somehow covered by the tests, we should not need to do manual testing when touching TLS options code. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/migration-qmp.c | 9 +++++ tests/qtest/migration/migration-qmp.h | 1 + tests/qtest/migration/tls-tests.c | 56 +++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/= migration-qmp.c index c803fcee9d..5c46ceb3e6 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -458,6 +458,15 @@ void migrate_set_parameter_strv(QTestState *who, const= char *parameter, qtest_qmp_assert_success(who, command, parameter); } =20 +void migrate_set_parameter_null(QTestState *who, const char *parameter) +{ + qtest_qmp_assert_success(who, + "{ 'execute': 'migrate-set-parameters'," + "'arguments': { %s: null } }", + parameter); + migrate_check_parameter_str(who, parameter, ""); +} + static long long migrate_get_parameter_bool(QTestState *who, const char *parameter) { diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/= migration-qmp.h index 44482d250f..940ffd5950 100644 --- a/tests/qtest/migration/migration-qmp.h +++ b/tests/qtest/migration/migration-qmp.h @@ -36,6 +36,7 @@ void migrate_set_parameter_str(QTestState *who, const cha= r *parameter, const char *value); void migrate_set_parameter_strv(QTestState *who, const char *parameter, char **strv); +void migrate_set_parameter_null(QTestState *who, const char *parameter); void migrate_set_parameter_bool(QTestState *who, const char *parameter, int value); void migrate_ensure_non_converge(QTestState *who); diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 21e9fec87d..e0e8a7335c 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -507,6 +507,57 @@ static void test_precopy_tcp_tls_psk_mismatch(void) test_precopy_common(&args); } =20 +static void *migrate_hook_start_no_tls(QTestState *from, QTestState *to) +{ + struct TestMigrateTLSPSKData *data =3D + g_new0(struct TestMigrateTLSPSKData, 1); + + migrate_set_parameter_null(from, "tls-creds"); + migrate_set_parameter_null(to, "tls-creds"); + + return data; +} + +static void test_precopy_tcp_no_tls(void) +{ + MigrateCommon args =3D { + .listen_uri =3D "tcp:127.0.0.1:0", + .start_hook =3D migrate_hook_start_no_tls, + .end_hook =3D migrate_hook_end_tls_psk, + }; + + test_precopy_common(&args); +} + +static void * +migrate_hook_start_tls_x509_no_host(QTestState *from, QTestState *to) +{ + TestMigrateTLSX509 args =3D { + .verifyclient =3D true, + .clientcert =3D true, + .authzclient =3D true, + }; + TestMigrateTLSX509Data *data =3D migrate_hook_start_tls_x509_common(fr= om, to, + &arg= s); + migrate_set_parameter_null(from, "tls-hostname"); + migrate_set_parameter_null(to, "tls-hostname"); + + return data; +} + +static void test_precopy_tcp_tls_no_hostname(void) +{ + MigrateCommon args =3D { + .listen_uri =3D "tcp:127.0.0.1:0", + .start_hook =3D migrate_hook_start_tls_x509_no_host, + .end_hook =3D migrate_hook_end_tls_x509, + .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, + .start.hide_stderr =3D true, + }; + + test_precopy_common(&args); +} + #ifdef CONFIG_TASN1 static void test_precopy_tcp_tls_x509_default_host(void) { @@ -799,6 +850,11 @@ void migration_test_add_tls(MigrationTestEnv *env) return; } =20 + migration_test_add("/migration/precopy/tcp/no-tls", + test_precopy_tcp_no_tls); + migration_test_add("/migration/precopy/tcp/tls/no-hostname", + test_precopy_tcp_tls_no_hostname); + migration_test_add("/migration/precopy/unix/tls/psk", test_precopy_unix_tls_psk); =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836273; cv=none; d=zohomail.com; s=zohoarc; b=j8/iZQJ/yy4NuL8i89KZJ1Jvfbf4uQDD/MoXFDJ7B+5C1dJ49muIB+HL+RXXJPg8XTPKClt3epYMVCCHc4e35+NN5p5Ennbss/80LFwV9OV1P3IImu0gLEYicjRq3T3y7GJdcnB6ti71HHHRL7b5ulPKjipvdiS1HI23+7SMBcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836273; 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=gLRcEZW6pX/P6pjWpPctISzotCOPXAqNg/NKTHGEWiA=; b=CW7CgdF+HZBcjGzXykvDUoCB9gbljFfxPjVHuGPBQx4VGHgl9iATYqwHgIDRcQ2PmFpyIed/9jv4XG1VaEhhA0SI6rG4uTiFkAm94KywnP3K6sMKhEJsXZ5EALBC5jNdGcIE4E7n79Kg9Tk4JvZGx+IAL5Ags+YmxPMQT//ZQnQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836273416940.4366704440133; Mon, 15 Dec 2025 14:04:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGd1-0002ac-6u; Mon, 15 Dec 2025 17:01:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGcz-0002aE-FS for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:13 -0500 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 1vVGcx-0002bn-7T for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:13 -0500 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 DE2B35BDE8; Mon, 15 Dec 2025 22:01:05 +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 16B283EA63; Mon, 15 Dec 2025 22:01:03 +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 GIEgMh+FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836067; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gLRcEZW6pX/P6pjWpPctISzotCOPXAqNg/NKTHGEWiA=; b=VWaXC6OvWsw3hcu47cFN68eXjpEo5RxFsfnwHe4c55C+ST90WyJEJDmzXQzhxBF6rjOiT7 ytufc8Kzr65J7VkzwoeueisUGylEV8VGm7oYkU5zzRW/b+CS2m/GdcLAHVxWIYfLn10GyF xbcngs+ssP6T2vhvOD9oVx3g57SDFMM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836067; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gLRcEZW6pX/P6pjWpPctISzotCOPXAqNg/NKTHGEWiA=; b=vuBIZ8rMMWYCotQ8yWL5ldPGyQlcg0qxuo7u91IljHPR9VlFZcAR6v5DYjsWUr5gsqVvOl VqBjULcTaaxnyqBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=j+t2isGf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=4PovBd0Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836065; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gLRcEZW6pX/P6pjWpPctISzotCOPXAqNg/NKTHGEWiA=; b=j+t2isGfg/R8IxyrUlEf2gbpN43wGKLzg8wd+zLsrSc81fOldqqDfrMkXvta6RGhN7ADa8 KtwSHWTMuK9K5ekOTeQWaiAXL1ycDoA6gYyLb0yu521cQ5ZfA+6jzIeQ725ItKm8LZ8Lpg lZURqcLz2OCd7Ch3IpRy4o+9y9IKfDs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836065; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gLRcEZW6pX/P6pjWpPctISzotCOPXAqNg/NKTHGEWiA=; b=4PovBd0ZMrXDhsoWsEVfSZYhiDphyQENNQGEicDeUCGCfuORHvJGOhfPeelanpSoMjNc1X et2eTO1qYBKfmCBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake Subject: [PATCH v3 05/51] migration: Normalize tls arguments Date: Mon, 15 Dec 2025 18:59:51 -0300 Message-ID: <20251215220041.12657-6-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: DE2B35BDE8 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1765836276574154100 Content-Type: text/plain; charset="utf-8" The migration parameters tls_creds, tls_authz and tls_hostname currently have a non-uniform handling. When used as arguments to migrate-set-parameters, their type is StrOrNull and when used as return value from query-migrate-parameters their type is a plain string. Not only having to convert between the types is cumbersome, but it also creates the issue of requiring two different QAPI types to be used, one for each command. MigrateSetParameters is used for migrate-set-parameters with the TLS arguments as StrOrNull while MigrationParameters is used for query-migrate-parameters with the TLS arguments as str. Since StrOrNull could be considered a superset of str, change the type of the TLS arguments in MigrationParameters to StrOrNull. Also ensure that QTYPE_QNULL is never used. 1) migrate-set-parameters will always write QTYPE_QSTRING to s->parameters, either an empty or non-empty string. 2) query-migrate-parameters will always return a QTYPE_QSTRING, either empty or non-empty. 3) the migrate_tls_* helpers will always return a non-empty string or NULL, for the internal migration code's consumption. Points (1) and (2) above help simplify the parameters validation and the query command handling because s->parameters is already kept in the format that query-migrate-parameters (and info migrate_paramters) expect. Point (3) is so people don't need to care about StrOrNull in migration code. This will allow the type duplication to be removed in the next patches. Note that the type of @tls_creds, @tls-hostname, @tls-authz changes from str to StrOrNull in introspection of the query-migrate-parameters command. We accept this imprecision to enable de-duplication. There's no need to free the TLS options in migration_instance_finalize() because they're freed by the qdev properties .release method. Temporary in this patch: migrate_params_test_apply() copies s->parameters into a temporary structure, so it's necessary to drop the references to the TLS options if they were not set by the user to avoid double-free. This is fixed in the next patches. Acked-by: Markus Armbruster Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration-hmp-cmds.c | 9 ++- migration/options.c | 144 +++++++++++++++++++-------------- migration/options.h | 1 + migration/tls.c | 2 +- qapi/migration.json | 6 +- 5 files changed, 96 insertions(+), 66 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 79426bf5d7..dbab5028c2 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -360,15 +360,15 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) assert(params->tls_creds); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), - params->tls_creds); + params->tls_creds->u.s); assert(params->tls_hostname); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), - params->tls_hostname); + params->tls_hostname->u.s); assert(params->tls_authz); monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz); + params->tls_authz->u.s); assert(params->has_max_bandwidth); monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), @@ -403,6 +403,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) monitor_printf(mon, "%s: %" PRIu64 " bytes\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); + monitor_printf(mon, "%s: %" PRIu64 "\n", + MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), + params->max_postcopy_bandwidth); =20 if (params->has_block_bitmap_mapping) { const BitmapMigrationNodeAliasList *bmnal; diff --git a/migration/options.c b/migration/options.c index 5f387437d1..4ca6ff0fe9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -167,9 +167,10 @@ const Property migration_properties[] =3D { DEFINE_PROP_SIZE("announce-step", MigrationState, parameters.announce_step, DEFAULT_MIGRATE_ANNOUNCE_STEP), - DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), - DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), - DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), + DEFINE_PROP_STR_OR_NULL("tls-creds", MigrationState, parameters.tls_cr= eds), + DEFINE_PROP_STR_OR_NULL("tls-hostname", MigrationState, + parameters.tls_hostname), + DEFINE_PROP_STR_OR_NULL("tls-authz", MigrationState, parameters.tls_au= thz), DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, parameters.x_vcpu_dirty_limit_period, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), @@ -257,6 +258,11 @@ static void release_StrOrNull(Object *obj, const char = *name, void *opaque) =20 static void set_default_value_tls_opt(ObjectProperty *op, const Property *= prop) { + /* + * Initialization to the empty string here is important so + * query-migrate-parameters doesn't need to deal with a NULL value + * when it's called before any TLS option has been set. + */ object_property_set_default_str(op, ""); } =20 @@ -448,13 +454,6 @@ bool migrate_rdma(void) return s->rdma_migration; } =20 -bool migrate_tls(void) -{ - MigrationState *s =3D migrate_get_current(); - - return s->parameters.tls_creds && *s->parameters.tls_creds; -} - typedef enum WriteTrackingSupport { WT_SUPPORT_UNKNOWN =3D 0, WT_SUPPORT_ABSENT, @@ -929,21 +928,38 @@ const char *migrate_tls_authz(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_authz; + if (*s->parameters.tls_authz->u.s) { + return s->parameters.tls_authz->u.s; + } + + return NULL; } =20 const char *migrate_tls_creds(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_creds; + if (*s->parameters.tls_creds->u.s) { + return s->parameters.tls_creds->u.s; + } + + return NULL; } =20 const char *migrate_tls_hostname(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_hostname; + if (*s->parameters.tls_hostname->u.s) { + return s->parameters.tls_hostname->u.s; + } + + return NULL; +} + +bool migrate_tls(void) +{ + return !!migrate_tls_creds(); } =20 uint64_t migrate_vcpu_dirty_limit_period(void) @@ -983,6 +999,25 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 +void migrate_tls_opts_free(MigrationParameters *params) +{ + qapi_free_StrOrNull(params->tls_creds); + qapi_free_StrOrNull(params->tls_hostname); + qapi_free_StrOrNull(params->tls_authz); +} + +/* normalize QTYPE_QNULL to QTYPE_QSTRING "" */ +static void tls_opt_to_str(StrOrNull *opt) +{ + if (!opt || opt->type =3D=3D QTYPE_QSTRING) { + return; + } + + qobject_unref(opt->u.n); + opt->type =3D QTYPE_QSTRING; + opt->u.s =3D g_strdup(""); +} + MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; @@ -998,10 +1033,9 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; params->has_cpu_throttle_tailslow =3D true; params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; - params->tls_creds =3D g_strdup(s->parameters.tls_creds); - params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); - params->tls_authz =3D g_strdup(s->parameters.tls_authz ? - s->parameters.tls_authz : ""); + params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); + params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); + params->tls_authz =3D QAPI_CLONE(StrOrNull, s->parameters.tls_authz); params->has_max_bandwidth =3D true; params->max_bandwidth =3D s->parameters.max_bandwidth; params->has_avail_switchover_bandwidth =3D true; @@ -1061,9 +1095,6 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 void migrate_params_init(MigrationParameters *params) { - params->tls_hostname =3D g_strdup(""); - params->tls_creds =3D g_strdup(""); - /* Set has_* up only for parameter checks */ params->has_throttle_trigger_threshold =3D true; params->has_cpu_throttle_initial =3D true; @@ -1241,7 +1272,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) #ifdef CONFIG_LINUX if (migrate_zero_copy_send() && ((params->has_multifd_compression && params->multifd_compression) = || - (params->tls_creds && *params->tls_creds))) { + *params->tls_creds->u.s)) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; @@ -1303,18 +1334,24 @@ static void migrate_params_test_apply(MigrateSetPar= ameters *params, } =20 if (params->tls_creds) { - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - dest->tls_creds =3D params->tls_creds->u.s; + dest->tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_creds); + } else { + /* clear the reference, it's owned by s->parameters */ + dest->tls_creds =3D NULL; } =20 if (params->tls_hostname) { - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - dest->tls_hostname =3D params->tls_hostname->u.s; + dest->tls_hostname =3D QAPI_CLONE(StrOrNull, params->tls_hostname); + } else { + /* clear the reference, it's owned by s->parameters */ + dest->tls_hostname =3D NULL; } =20 if (params->tls_authz) { - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - dest->tls_authz =3D params->tls_authz->u.s; + dest->tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_authz); + } else { + /* clear the reference, it's owned by s->parameters */ + dest->tls_authz =3D NULL; } =20 if (params->has_max_bandwidth) { @@ -1423,21 +1460,19 @@ static void migrate_params_apply(MigrateSetParamete= rs *params, Error **errp) } =20 if (params->tls_creds) { - g_free(s->parameters.tls_creds); - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); + qapi_free_StrOrNull(s->parameters.tls_creds); + s->parameters.tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_cred= s); } =20 if (params->tls_hostname) { - g_free(s->parameters.tls_hostname); - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); + qapi_free_StrOrNull(s->parameters.tls_hostname); + s->parameters.tls_hostname =3D QAPI_CLONE(StrOrNull, + params->tls_hostname); } =20 if (params->tls_authz) { - g_free(s->parameters.tls_authz); - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); + qapi_free_StrOrNull(s->parameters.tls_authz); + s->parameters.tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_auth= z); } =20 if (params->has_max_bandwidth) { @@ -1542,32 +1577,23 @@ void qmp_migrate_set_parameters(MigrateSetParameter= s *params, Error **errp) { MigrationParameters tmp; =20 - /* TODO Rewrite "" to null instead for all three tls_* parameters */ - if (params->tls_creds - && params->tls_creds->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_creds->u.n); - params->tls_creds->type =3D QTYPE_QSTRING; - params->tls_creds->u.s =3D strdup(""); - } - if (params->tls_hostname - && params->tls_hostname->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_hostname->u.n); - params->tls_hostname->type =3D QTYPE_QSTRING; - params->tls_hostname->u.s =3D strdup(""); - } - if (params->tls_authz - && params->tls_authz->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_authz->u.n); - params->tls_authz->type =3D QTYPE_QSTRING; - params->tls_authz->u.s =3D strdup(""); - } + /* + * Convert QTYPE_QNULL and NULL to the empty string (""). Even + * though NULL is cleaner to deal with in C code, that would force + * query-migrate-parameters to convert it once more to the empty + * string, so avoid that. The migrate_tls_*() helpers that expose + * the options to the rest of the migration code already use + * return NULL when the empty string is found. + */ + tls_opt_to_str(params->tls_creds); + tls_opt_to_str(params->tls_hostname); + tls_opt_to_str(params->tls_authz); =20 migrate_params_test_apply(params, &tmp); =20 - if (!migrate_params_check(&tmp, errp)) { - /* Invalid parameter */ - return; + if (migrate_params_check(&tmp, errp)) { + migrate_params_apply(params, errp); } =20 - migrate_params_apply(params, errp); + migrate_tls_opts_free(&tmp); } diff --git a/migration/options.h b/migration/options.h index a7b3262d1e..25fb316420 100644 --- a/migration/options.h +++ b/migration/options.h @@ -92,4 +92,5 @@ ZeroPageDetection migrate_zero_page_detection(void); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); +void migrate_tls_opts_free(MigrationParameters *params); #endif diff --git a/migration/tls.c b/migration/tls.c index 284a6194b2..56b5d1cc90 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -130,7 +130,7 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *= ioc, } =20 const char *tls_hostname =3D migrate_tls_hostname(); - if (tls_hostname && *tls_hostname) { + if (tls_hostname) { hostname =3D tls_hostname; } =20 diff --git a/qapi/migration.json b/qapi/migration.json index cf023bd29d..30a0eb2d7e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1382,9 +1382,9 @@ '*cpu-throttle-initial': 'uint8', '*cpu-throttle-increment': 'uint8', '*cpu-throttle-tailslow': 'bool', - '*tls-creds': 'str', - '*tls-hostname': 'str', - '*tls-authz': 'str', + '*tls-creds': 'StrOrNull', + '*tls-hostname': 'StrOrNull', + '*tls-authz': 'StrOrNull', '*max-bandwidth': 'size', '*avail-switchover-bandwidth': 'size', '*downtime-limit': 'uint64', --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836202; cv=none; d=zohomail.com; s=zohoarc; b=Lz8Ltlafk/H6nQERxnelpcYnLfL+Oj3AWr6fX/m9exEOvrkxeraID4cbZCMQKcpblRYqSqZhDUjRO0NUsBxMOb9Qkk6A9m3pWIsHQvoTLw9AdHF7Q1AZcWv7ozPTj1qk6drtPhSq9vPbftNgjOqjdbajibk9aZx09c3o6NsPi5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836202; 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=cTbPRpy2JVAqZ8fpRlb7uel2eaZXhbAohGKBOlbEaOs=; b=JfclNBaUZZaGIKBsed8df9Da3DBpRl4dwI1shy0AXBKAezUnYlJuMqagBDXCTheJ4CnnXVoXdS4yKnseg1nypBcaHota8Ghv/y89z5fesxNgwq41uC3eOJ+wRPCVMb8nksheYyNgMAp3kUQ4QnlXovnSdheexRO1VDPUaW2Uw0k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836202230543.4940609523164; Mon, 15 Dec 2025 14:03:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGd5-0002ht-W5; Mon, 15 Dec 2025 17:01:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGd3-0002cA-EF for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:17 -0500 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 1vVGd0-0002ci-V4 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:17 -0500 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 A7ED3337EB; Mon, 15 Dec 2025 22:01:08 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 731623EA65; Mon, 15 Dec 2025 22:01:06 +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 MIcsDSKFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cTbPRpy2JVAqZ8fpRlb7uel2eaZXhbAohGKBOlbEaOs=; b=egxc5zF0zbIkSdp460VbjYSiHUnwYEkdwCMgx2jwpj6rdq0alInWo5jmvDAGHytVDbsqYg c+A3oEHqAGWfWTLMZ8UuUh+eB2rUNns5y3gVy0MfDxG6TxN7bycRYWmAAVT6WOGod/eEa1 Aycsgm90SaZCY82QbKHSLCouGsBtAZs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cTbPRpy2JVAqZ8fpRlb7uel2eaZXhbAohGKBOlbEaOs=; b=ag/8aLqfQ4dj+HDwTqvwephpw7cWOzEOHXzvWlmdRjRK1lZi+92O62SlFrEb20BV2iAahf eg4ZJTC3A3cWMnCg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cTbPRpy2JVAqZ8fpRlb7uel2eaZXhbAohGKBOlbEaOs=; b=egxc5zF0zbIkSdp460VbjYSiHUnwYEkdwCMgx2jwpj6rdq0alInWo5jmvDAGHytVDbsqYg c+A3oEHqAGWfWTLMZ8UuUh+eB2rUNns5y3gVy0MfDxG6TxN7bycRYWmAAVT6WOGod/eEa1 Aycsgm90SaZCY82QbKHSLCouGsBtAZs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cTbPRpy2JVAqZ8fpRlb7uel2eaZXhbAohGKBOlbEaOs=; b=ag/8aLqfQ4dj+HDwTqvwephpw7cWOzEOHXzvWlmdRjRK1lZi+92O62SlFrEb20BV2iAahf eg4ZJTC3A3cWMnCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake Subject: [PATCH v3 06/51] migration: Remove MigrateSetParameters Date: Mon, 15 Dec 2025 18:59:52 -0300 Message-ID: <20251215220041.12657-7-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.990]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836203455154100 Content-Type: text/plain; charset="utf-8" Now that the TLS options have been made the same between migrate-set-parameters and query-migrate-parameters, a single type can be used. Remove MigrateSetParameters. The TLS options documentation from MigrationParameters were replaced with the ones from MigrateSetParameters which was more complete. Acked-by: Markus Armbruster Acked-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 4 +- migration/options.c | 6 +- qapi/migration.json | 243 ++++----------------------------- 3 files changed, 28 insertions(+), 225 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index dbab5028c2..a83aba9630 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -581,7 +581,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDic= t *qdict) const char *param =3D qdict_get_str(qdict, "parameter"); const char *valuestr =3D qdict_get_str(qdict, "value"); Visitor *v =3D string_input_visitor_new(valuestr); - MigrateSetParameters *p =3D g_new0(MigrateSetParameters, 1); + MigrationParameters *p =3D g_new0(MigrationParameters, 1); uint64_t valuebw =3D 0; uint64_t cache_size; Error *err =3D NULL; @@ -768,7 +768,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDic= t *qdict) qmp_migrate_set_parameters(p, &err); =20 cleanup: - qapi_free_MigrateSetParameters(p); + qapi_free_MigrationParameters(p); visit_free(v); hmp_handle_error(mon, err); } diff --git a/migration/options.c b/migration/options.c index 4ca6ff0fe9..f14baa8561 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1310,7 +1310,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return true; } =20 -static void migrate_params_test_apply(MigrateSetParameters *params, +static void migrate_params_test_apply(MigrationParameters *params, MigrationParameters *dest) { *dest =3D migrate_get_current()->parameters; @@ -1437,7 +1437,7 @@ static void migrate_params_test_apply(MigrateSetParam= eters *params, } } =20 -static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) +static void migrate_params_apply(MigrationParameters *params, Error **errp) { MigrationState *s =3D migrate_get_current(); =20 @@ -1573,7 +1573,7 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) } } =20 -void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) +void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { MigrationParameters tmp; =20 diff --git a/qapi/migration.json b/qapi/migration.json index 30a0eb2d7e..fa4491b9b0 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -992,212 +992,10 @@ 'direct-io', 'cpr-exec-command'] } =20 -## -# @MigrateSetParameters: -# -# @announce-initial: Initial delay (in milliseconds) before sending -# the first announce (Since 4.0) -# -# @announce-max: Maximum delay (in milliseconds) between packets in -# the announcement (Since 4.0) -# -# @announce-rounds: Number of self-announce packets sent after -# migration (Since 4.0) -# -# @announce-step: Increase in delay (in milliseconds) between -# subsequent packets in the announcement (Since 4.0) -# -# @throttle-trigger-threshold: The ratio of bytes_dirty_period and -# bytes_xfer_period to trigger throttling. It is expressed as -# percentage. The default value is 50. (Since 5.0) -# -# @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttled when migration auto-converge is activated. The -# default value is 20. (Since 2.7) -# -# @cpu-throttle-increment: throttle percentage increase each time -# auto-converge detects that migration is not making progress. -# The default value is 10. (Since 2.7) -# -# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage. -# At the tail stage of throttling, the Guest is very sensitive to -# CPU percentage while the @cpu-throttle -increment is excessive -# usually at tail stage. If this parameter is true, we will -# compute the ideal CPU percentage used by the Guest, which may -# exactly make the dirty rate match the dirty rate threshold. -# Then we will choose a smaller throttle increment between the one -# specified by @cpu-throttle-increment and the one generated by -# ideal CPU percentage. Therefore, it is compatible to -# traditional throttling, meanwhile the throttle increment won't -# be excessive at tail stage. The default value is false. -# (Since 5.1) -# -# @tls-creds: ID of the 'tls-creds' object that provides credentials -# for establishing a TLS connection over the migration data -# channel. On the outgoing side of the migration, the credentials -# must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. Setting this to a -# non-empty string enables TLS for all migrations. An empty -# string means that QEMU will use plain text mode for migration, -# rather than TLS. This is the default. (Since 2.7) -# -# @tls-hostname: migration target's hostname for validating the -# server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. A non-empty value is -# required when using x509 based TLS credentials and the migration -# URI does not include a hostname, such as fd: or exec: based -# migration. (Since 2.7) -# -# Note: empty value works only since 2.9. -# -# @tls-authz: ID of the 'authz' object subclass that provides access -# control checking of the TLS x509 certificate distinguished name. -# This object is only resolved at time of use, so can be deleted -# and recreated on the fly while the migration server is active. -# If missing, it will default to denying access (Since 4.0) -# -# @max-bandwidth: maximum speed for migration, in bytes per second. -# (Since 2.8) -# -# @avail-switchover-bandwidth: to set the available bandwidth that -# migration can use during switchover phase. **Note:** this does -# not limit the bandwidth during switchover, but only for -# calculations when making decisions to switchover. By default, -# this value is zero, which means QEMU will estimate the bandwidth -# automatically. This can be set when the estimated value is not -# accurate, while the user is able to guarantee such bandwidth is -# available when switching over. When specified correctly, this -# can make the switchover decision much more accurate. -# (Since 8.2) -# -# @downtime-limit: set maximum tolerated downtime for migration. -# maximum downtime in milliseconds (Since 2.8) -# -# @x-checkpoint-delay: The delay time (in ms) between two COLO -# checkpoints in periodic mode. (Since 2.8) -# -# @multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the number of sockets -# used for migration. The default value is 2 (since 4.0) -# -# @xbzrle-cache-size: cache size to be used by XBZRLE migration. It -# needs to be a multiple of the target page size and a power of 2 -# (Since 2.11) -# -# @max-postcopy-bandwidth: Background transfer bandwidth during -# postcopy. Defaults to 0 (unlimited). In bytes per second. -# (Since 3.0) -# -# @max-cpu-throttle: maximum cpu throttle percentage. Defaults to 99. -# (Since 3.1) -# -# @multifd-compression: Which compression method to use. Defaults to -# none. (Since 5.0) -# -# @multifd-zlib-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 9, -# where 0 means no compression, 1 means the best compression -# speed, and 9 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @multifd-qatzip-level: Set the compression level to be used in live -# migration. The level is an integer between 1 and 9, where 1 -# means the best compression speed, and 9 means the best -# compression ratio which will consume more CPU. Defaults to 1. -# (Since 9.2) -# -# @multifd-zstd-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 20, -# where 0 means no compression, 1 means the best compression -# speed, and 20 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @block-bitmap-mapping: Maps block nodes and bitmaps on them to -# aliases for the purpose of dirty bitmap migration. Such aliases -# may for example be the corresponding names on the opposite site. -# The mapping must be one-to-one, but not necessarily complete: On -# the source, unmapped bitmaps and all bitmaps on unmapped nodes -# will be ignored. On the destination, encountering an unmapped -# alias in the incoming migration stream will result in a report, -# and all further bitmap migration data will then be discarded. -# Note that the destination does not know about bitmaps it does -# not receive, so there is no limitation or requirement regarding -# the number of bitmaps received, or how they are named, or on -# which nodes they are placed. By default (when this parameter -# has never been set), bitmap names are mapped to themselves. -# Nodes are mapped to their block device name if there is one, and -# to their node name otherwise. (Since 5.2) -# -# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty -# limit during live migration. Should be in the range 1 to -# 1000ms. Defaults to 1000ms. (Since 8.1) -# -# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. -# Defaults to 1. (Since 8.1) -# -# @mode: Migration mode. See description in `MigMode`. Default is -# 'normal'. (Since 8.2) -# -# @zero-page-detection: Whether and how to detect zero pages. See -# description in `ZeroPageDetection`. Default is 'multifd'. -# (since 9.0) -# -# @direct-io: Open migration files with O_DIRECT when possible. This -# only has effect if the @mapped-ram capability is enabled. -# (Since 9.1) -# -# @cpr-exec-command: Command to start the new QEMU process when @mode -# is @cpr-exec. The first list element is the program's filename, -# the remainder its arguments. (Since 10.2) -# -# Features: -# -# @unstable: Members @x-checkpoint-delay and -# @x-vcpu-dirty-limit-period are experimental. -# -# TODO: either fuse back into `MigrationParameters`, or make -# `MigrationParameters` members mandatory -# -# Since: 2.4 -## -{ 'struct': 'MigrateSetParameters', - 'data': { '*announce-initial': 'size', - '*announce-max': 'size', - '*announce-rounds': 'size', - '*announce-step': 'size', - '*throttle-trigger-threshold': 'uint8', - '*cpu-throttle-initial': 'uint8', - '*cpu-throttle-increment': 'uint8', - '*cpu-throttle-tailslow': 'bool', - '*tls-creds': 'StrOrNull', - '*tls-hostname': 'StrOrNull', - '*tls-authz': 'StrOrNull', - '*max-bandwidth': 'size', - '*avail-switchover-bandwidth': 'size', - '*downtime-limit': 'uint64', - '*x-checkpoint-delay': { 'type': 'uint32', - 'features': [ 'unstable' ] }, - '*multifd-channels': 'uint8', - '*xbzrle-cache-size': 'size', - '*max-postcopy-bandwidth': 'size', - '*max-cpu-throttle': 'uint8', - '*multifd-compression': 'MultiFDCompression', - '*multifd-zlib-level': 'uint8', - '*multifd-qatzip-level': 'uint8', - '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], - '*x-vcpu-dirty-limit-period': { 'type': 'uint64', - 'features': [ 'unstable' ] }, - '*vcpu-dirty-limit': 'uint64', - '*mode': 'MigMode', - '*zero-page-detection': 'ZeroPageDetection', - '*direct-io': 'bool', - '*cpr-exec-command': [ 'str' ]} } - ## # @migrate-set-parameters: # -# Set various migration parameters. +# Set migration parameters. All arguments are optional. # # Since: 2.4 # @@ -1208,13 +1006,11 @@ # <- { "return": {} } ## { 'command': 'migrate-set-parameters', 'boxed': true, - 'data': 'MigrateSetParameters' } + 'data': 'MigrationParameters' } =20 ## # @MigrationParameters: # -# The optional members aren't actually optional. -# # @announce-initial: Initial delay (in milliseconds) before sending # the first announce (Since 4.0) # @@ -1232,12 +1028,12 @@ # percentage. The default value is 50. (Since 5.0) # # @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttled when migration auto-converge is activated. -# (Since 2.7) +# throttled when migration auto-converge is activated. The +# default value is 20. (Since 2.7) # # @cpu-throttle-increment: throttle percentage increase each time # auto-converge detects that migration is not making progress. -# (Since 2.7) +# The default value is 10. (Since 2.7) # # @cpu-throttle-tailslow: Make CPU throttling slower at tail stage. # At the tail stage of throttling, the Guest is very sensitive to @@ -1256,21 +1052,25 @@ # for establishing a TLS connection over the migration data # channel. On the outgoing side of the migration, the credentials # must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. An empty string -# means that QEMU will use plain text mode for migration, rather -# than TLS. (Since 2.7) -# -# Note: 2.8 omits empty @tls-creds instead. +# credentials must be for a 'server' endpoint. Setting this to a +# non-empty string enables TLS for all migrations. An empty +# string means that QEMU will use plain text mode for migration, +# rather than TLS. This is the default. (Since 2.7) # # @tls-hostname: migration target's hostname for validating the # server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. (Since 2.7) +# hostname from the migration URI, if any. A non-empty value is +# required when using x509 based TLS credentials and the migration +# URI does not include a hostname, such as fd: or exec: based +# migration. (Since 2.7) # -# Note: 2.8 omits empty @tls-hostname instead. +# Note: empty value works only since 2.9. # # @tls-authz: ID of the 'authz' object subclass that provides access # control checking of the TLS x509 certificate distinguished name. -# (Since 4.0) +# This object is only resolved at time of use, so can be deleted +# and recreated on the fly while the migration server is active. +# If missing, it will default to denying access (Since 4.0) # # @max-bandwidth: maximum speed for migration, in bytes per second. # (Since 2.8) @@ -1289,8 +1089,8 @@ # @downtime-limit: set maximum tolerated downtime for migration. # maximum downtime in milliseconds (Since 2.8) # -# @x-checkpoint-delay: the delay time between two COLO checkpoints. -# (Since 2.8) +# @x-checkpoint-delay: The delay time (in ms) between two COLO +# checkpoints in periodic mode. (Since 2.8) # # @multifd-channels: Number of channels used to migrate data in # parallel. This is the same number that the number of sockets @@ -1410,7 +1210,10 @@ ## # @query-migrate-parameters: # -# Return information about the current migration parameters +# Return information about the current migration parameters. Optional +# members of the return value are always present, except +# @block-bitmap-mapping, which is only present if it has been +# previously set. # # Since: 2.4 # --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836206; cv=none; d=zohomail.com; s=zohoarc; b=DRK+LvelsXmUA6wdZr30tstBpz1P+9sg9ExI5jbHa+pYg2cC7tCOrr9J9gduaK+v5sErrN860Z3yFQy/5NiMHEz1TQsneQ/g9Z1eNmJNQ/9rQ4K2h/0TfRGcKQ3BFLD1dQNoO/nU3KoaeQSXlMMPuhYEvHY+L7E13/v8o+ECdKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836206; 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=glWhMQJKcE5JrLU971QcxZ1tZ+l4DFLJcEISppBApwk=; b=VJroHPDUtoSwI3e9DACx6Jei4Dj6OcSgBC4OwHsbTEvxG8d69zmuzb3Pyr/Te9G2Ws/5rSwzUIApp1PKmT3iMfh12gQLcNOqx/G1abFmSOd2QT2OeFVOUYtT8zWeXv1H3sMGW/EBTOVo0NIwygn2wS0qauycn6S752pIA4zDKoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836206191423.6909313230575; Mon, 15 Dec 2025 14:03:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdE-0002k5-B6; Mon, 15 Dec 2025 17:01:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdA-0002jd-W9 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:25 -0500 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 1vVGd7-0002eV-Uk for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:24 -0500 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 4596E337EC; Mon, 15 Dec 2025 22:01:11 +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 4D97D3EA63; Mon, 15 Dec 2025 22:01:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sEsjBCWFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836071; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=glWhMQJKcE5JrLU971QcxZ1tZ+l4DFLJcEISppBApwk=; b=dQYBDk0ZOH+Y3bmg8ra7ddJ3NV7EUQ+E7hI6WjrDlX05ggDxYf/c855rWstPmqMdMvzb7+ 7YuCBTDrsWsEC7DBXLCtVByxcKolvTGqmzJjKFrzuEACOyhPNCM+9+yhoZe2v7fik7eOy8 IPTVR1KyDQIUBLgYNHc8S4Pm1rSuAD4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836071; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=glWhMQJKcE5JrLU971QcxZ1tZ+l4DFLJcEISppBApwk=; b=fbDAkUu2dMShs8x8cu+XWJtTf6PZHIHc+QsalDRfCfRH4ceGD81tiW86aSdCVfxcFiutzY oBg886axdfqOM/BQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836071; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=glWhMQJKcE5JrLU971QcxZ1tZ+l4DFLJcEISppBApwk=; b=dQYBDk0ZOH+Y3bmg8ra7ddJ3NV7EUQ+E7hI6WjrDlX05ggDxYf/c855rWstPmqMdMvzb7+ 7YuCBTDrsWsEC7DBXLCtVByxcKolvTGqmzJjKFrzuEACOyhPNCM+9+yhoZe2v7fik7eOy8 IPTVR1KyDQIUBLgYNHc8S4Pm1rSuAD4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836071; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=glWhMQJKcE5JrLU971QcxZ1tZ+l4DFLJcEISppBApwk=; b=fbDAkUu2dMShs8x8cu+XWJtTf6PZHIHc+QsalDRfCfRH4ceGD81tiW86aSdCVfxcFiutzY oBg886axdfqOM/BQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake Subject: [PATCH v3 07/51] qapi/migration: Don't document MigrationParameter Date: Mon, 15 Dec 2025 18:59:53 -0300 Message-ID: <20251215220041.12657-8-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.990]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836207491154100 Content-Type: text/plain; charset="utf-8" The MigrationParameter (singular) enumeration is not part of the migration QMP API, it's only used for nicely converting HMP strings into MigrationParameters (plural) members and for providing readline completion. Documenting this enum only serves to duplicate documentation between MigrationParameter and MigrationParameters. Add an exception to QAPIs pragma.json and stop documenting it. The generated "QEMU QMP Reference Manual" now lists the enum members as "Not documented." Tolerable. Acked-by: Markus Armbruster Acked-by: Peter Xu Signed-off-by: Fabiano Rosas --- qapi/migration.json | 154 +------------------------------------------- qapi/pragma.json | 1 + 2 files changed, 3 insertions(+), 152 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index fa4491b9b0..201dedd982 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -806,158 +806,8 @@ ## # @MigrationParameter: # -# Migration parameters enumeration -# -# @announce-initial: Initial delay (in milliseconds) before sending -# the first announce (Since 4.0) -# -# @announce-max: Maximum delay (in milliseconds) between packets in -# the announcement (Since 4.0) -# -# @announce-rounds: Number of self-announce packets sent after -# migration (Since 4.0) -# -# @announce-step: Increase in delay (in milliseconds) between -# subsequent packets in the announcement (Since 4.0) -# -# @throttle-trigger-threshold: The ratio of bytes_dirty_period and -# bytes_xfer_period to trigger throttling. It is expressed as -# percentage. The default value is 50. (Since 5.0) -# -# @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttled when migration auto-converge is activated. The -# default value is 20. (Since 2.7) -# -# @cpu-throttle-increment: throttle percentage increase each time -# auto-converge detects that migration is not making progress. -# The default value is 10. (Since 2.7) -# -# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage. -# At the tail stage of throttling, the Guest is very sensitive to -# CPU percentage while the @cpu-throttle -increment is excessive -# usually at tail stage. If this parameter is true, we will -# compute the ideal CPU percentage used by the Guest, which may -# exactly make the dirty rate match the dirty rate threshold. -# Then we will choose a smaller throttle increment between the one -# specified by @cpu-throttle-increment and the one generated by -# ideal CPU percentage. Therefore, it is compatible to -# traditional throttling, meanwhile the throttle increment won't -# be excessive at tail stage. The default value is false. -# (Since 5.1) -# -# @tls-creds: ID of the 'tls-creds' object that provides credentials -# for establishing a TLS connection over the migration data -# channel. On the outgoing side of the migration, the credentials -# must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. Setting this to a -# non-empty string enables TLS for all migrations. An empty -# string means that QEMU will use plain text mode for migration, -# rather than TLS. (Since 2.7) -# -# @tls-hostname: migration target's hostname for validating the -# server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. A non-empty value is -# required when using x509 based TLS credentials and the migration -# URI does not include a hostname, such as fd: or exec: based -# migration. (Since 2.7) -# -# Note: empty value works only since 2.9. -# -# @tls-authz: ID of the 'authz' object subclass that provides access -# control checking of the TLS x509 certificate distinguished name. -# This object is only resolved at time of use, so can be deleted -# and recreated on the fly while the migration server is active. -# If missing, it will default to denying access (Since 4.0) -# -# @max-bandwidth: maximum speed for migration, in bytes per second. -# (Since 2.8) -# -# @avail-switchover-bandwidth: to set the available bandwidth that -# migration can use during switchover phase. **Note:** this does -# not limit the bandwidth during switchover, but only for -# calculations when making decisions to switchover. By default, -# this value is zero, which means QEMU will estimate the bandwidth -# automatically. This can be set when the estimated value is not -# accurate, while the user is able to guarantee such bandwidth is -# available when switching over. When specified correctly, this -# can make the switchover decision much more accurate. -# (Since 8.2) -# -# @downtime-limit: set maximum tolerated downtime for migration. -# maximum downtime in milliseconds (Since 2.8) -# -# @x-checkpoint-delay: The delay time (in ms) between two COLO -# checkpoints in periodic mode. (Since 2.8) -# -# @multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the number of sockets -# used for migration. The default value is 2 (since 4.0) -# -# @xbzrle-cache-size: cache size to be used by XBZRLE migration. It -# needs to be a multiple of the target page size and a power of 2 -# (Since 2.11) -# -# @max-postcopy-bandwidth: Background transfer bandwidth during -# postcopy. Defaults to 0 (unlimited). In bytes per second. -# (Since 3.0) -# -# @max-cpu-throttle: maximum cpu throttle percentage. Defaults to 99. -# (Since 3.1) -# -# @multifd-compression: Which compression method to use. Defaults to -# none. (Since 5.0) -# -# @multifd-zlib-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 9, -# where 0 means no compression, 1 means the best compression -# speed, and 9 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @multifd-qatzip-level: Set the compression level to be used in live -# migration. The level is an integer between 1 and 9, where 1 -# means the best compression speed, and 9 means the best -# compression ratio which will consume more CPU. Defaults to 1. -# (Since 9.2) -# -# @multifd-zstd-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 20, -# where 0 means no compression, 1 means the best compression -# speed, and 20 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @block-bitmap-mapping: Maps block nodes and bitmaps on them to -# aliases for the purpose of dirty bitmap migration. Such aliases -# may for example be the corresponding names on the opposite site. -# The mapping must be one-to-one, but not necessarily complete: On -# the source, unmapped bitmaps and all bitmaps on unmapped nodes -# will be ignored. On the destination, encountering an unmapped -# alias in the incoming migration stream will result in a report, -# and all further bitmap migration data will then be discarded. -# Note that the destination does not know about bitmaps it does -# not receive, so there is no limitation or requirement regarding -# the number of bitmaps received, or how they are named, or on -# which nodes they are placed. By default (when this parameter -# has never been set), bitmap names are mapped to themselves. -# Nodes are mapped to their block device name if there is one, and -# to their node name otherwise. (Since 5.2) -# -# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty -# limit during live migration. Should be in the range 1 to -# 1000ms. Defaults to 1000ms. (Since 8.1) -# -# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. -# Defaults to 1. (Since 8.1) -# -# @mode: Migration mode. See description in `MigMode`. Default is -# 'normal'. (Since 8.2) -# -# @zero-page-detection: Whether and how to detect zero pages. See -# description in `ZeroPageDetection`. Default is 'multifd'. -# (since 9.0) -# -# @direct-io: Open migration files with O_DIRECT when possible. This -# only has effect if the @mapped-ram capability is enabled. -# (Since 9.1) +# Migration parameters enumeration. The enumeration values mirror the +# members of @MigrationParameters. # # @cpr-exec-command: Command to start the new QEMU process when @mode # is @cpr-exec. The first list element is the program's filename, diff --git a/qapi/pragma.json b/qapi/pragma.json index 023a2ef7bc..193bc39059 100644 --- a/qapi/pragma.json +++ b/qapi/pragma.json @@ -59,6 +59,7 @@ 'IscsiTransport', 'KeyValueKind', 'MemoryDeviceInfoKind', + 'MigrationParameter', 'NetClientDriver', 'ObjectType', 'QKeyCode', --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836168; cv=none; d=zohomail.com; s=zohoarc; b=bKELg/drIux3CJdVPgVq0yQu89govZ4DiDVh+40QIokspFzV4Sofuh0XVkhdGGOC2LZGs9OG7wzY5ZkvUJCVwrMkCRYEOzRJBNJQBKQhk6eKFK+v1UdDlzf3/JDLbi/RTPZC+KlU6FI2EkYQZ3L5z5CIMJwUqb5SZJELX1Gq0O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836168; 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=YdG0teGyKOWRVkYelnUqURTgpdlQXF6e71z+BYL+rlE=; b=NcGAeG1Xw/ILow2K6GqTrAVLRCaxg0sY817cHqcAKW8TlimzE5eeQbxFKoV1yESx+mCSVS+3LdPrOEfZFyHjzRkOXxNquo33CZLSMODXseg4wZAC6tX8j2UIk0XSTst4O7VSGVOYoA0YhyNXR1mVtEjVd1exZzh+jFJldq7iQzk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836168397789.6426731520863; Mon, 15 Dec 2025 14:02:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGd6-0002iM-F3; Mon, 15 Dec 2025 17:01:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGd5-0002fu-1V for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:19 -0500 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 1vVGd3-0002cs-F8 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:18 -0500 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 6ADE15BDDC; Mon, 15 Dec 2025 22:01:13 +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 CD0063EA63; Mon, 15 Dec 2025 22:01:11 +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 WGDeIieFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836073; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdG0teGyKOWRVkYelnUqURTgpdlQXF6e71z+BYL+rlE=; b=Wj+F96i4Ivqx5a2WDLfPmpebAHq856NAhal/q5/afHP/53ywjodKui+abSA+4YSocPqCGx n6CeDw0klkkRUAv2ZHv84LQCGFrLqI0VfNgYKsMwNHp4suoSDP7WmNGbBhVkgrjwAKlMxC YljYXxqKQAQnl/ex8rx1aVuMC6rPZAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836073; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdG0teGyKOWRVkYelnUqURTgpdlQXF6e71z+BYL+rlE=; b=/vSnhxp9QXM1HBqwifcDglHQntq3gpnM5dc33Pt2L+kQ5zPtEEflJIsmlh/46exy/gEqEH pZM53VenUrOafuAQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836073; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdG0teGyKOWRVkYelnUqURTgpdlQXF6e71z+BYL+rlE=; b=Wj+F96i4Ivqx5a2WDLfPmpebAHq856NAhal/q5/afHP/53ywjodKui+abSA+4YSocPqCGx n6CeDw0klkkRUAv2ZHv84LQCGFrLqI0VfNgYKsMwNHp4suoSDP7WmNGbBhVkgrjwAKlMxC YljYXxqKQAQnl/ex8rx1aVuMC6rPZAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836073; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdG0teGyKOWRVkYelnUqURTgpdlQXF6e71z+BYL+rlE=; b=/vSnhxp9QXM1HBqwifcDglHQntq3gpnM5dc33Pt2L+kQ5zPtEEflJIsmlh/46exy/gEqEH pZM53VenUrOafuAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 08/51] migration: Run a post update routine after setting parameters Date: Mon, 15 Dec 2025 18:59:54 -0300 Message-ID: <20251215220041.12657-9-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.988]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836170316158500 Content-Type: text/plain; charset="utf-8" Some migration parameters are updated immediately once they are set via migrate-set-parameters. Move that work outside of migrate_params_apply() and leave that function with the single responsibility of setting s->parameters and not doing any side-effects. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/options.c | 38 ++++++++++++++++++++++++++++---------- migration/ram.c | 2 +- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/migration/options.c b/migration/options.c index f14baa8561..e7f4aeaf03 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1123,6 +1123,31 @@ void migrate_params_init(MigrationParameters *params) params->has_cpr_exec_command =3D true; } =20 +static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) +{ + MigrationState *s =3D migrate_get_current(); + + if (new->has_max_bandwidth) { + if (s->to_dst_file && !migration_in_postcopy()) { + migration_rate_set(new->max_bandwidth); + } + } + + if (new->has_x_checkpoint_delay) { + colo_checkpoint_delay_set(); + } + + if (new->has_xbzrle_cache_size) { + xbzrle_cache_resize(new->xbzrle_cache_size, errp); + } + + if (new->has_max_postcopy_bandwidth) { + if (s->to_dst_file && migration_in_postcopy()) { + migration_rate_set(new->max_postcopy_bandwidth); + } + } +} + /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. @@ -1437,7 +1462,7 @@ static void migrate_params_test_apply(MigrationParame= ters *params, } } =20 -static void migrate_params_apply(MigrationParameters *params, Error **errp) +static void migrate_params_apply(MigrationParameters *params) { MigrationState *s =3D migrate_get_current(); =20 @@ -1477,9 +1502,6 @@ static void migrate_params_apply(MigrationParameters = *params, Error **errp) =20 if (params->has_max_bandwidth) { s->parameters.max_bandwidth =3D params->max_bandwidth; - if (s->to_dst_file && !migration_in_postcopy()) { - migration_rate_set(s->parameters.max_bandwidth); - } } =20 if (params->has_avail_switchover_bandwidth) { @@ -1492,7 +1514,6 @@ static void migrate_params_apply(MigrationParameters = *params, Error **errp) =20 if (params->has_x_checkpoint_delay) { s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - colo_checkpoint_delay_set(); } =20 if (params->has_multifd_channels) { @@ -1512,13 +1533,9 @@ static void migrate_params_apply(MigrationParameters= *params, Error **errp) } if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - xbzrle_cache_resize(params->xbzrle_cache_size, errp); } if (params->has_max_postcopy_bandwidth) { s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - if (s->to_dst_file && migration_in_postcopy()) { - migration_rate_set(s->parameters.max_postcopy_bandwidth); - } } if (params->has_max_cpu_throttle) { s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; @@ -1592,7 +1609,8 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) migrate_params_test_apply(params, &tmp); =20 if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(params, errp); + migrate_params_apply(params); + migrate_post_update_params(params, errp); } =20 migrate_tls_opts_free(&tmp); diff --git a/migration/ram.c b/migration/ram.c index 29f016cb25..a49afbd995 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -176,7 +176,7 @@ static void XBZRLE_cache_unlock(void) /** * xbzrle_cache_resize: resize the xbzrle cache * - * This function is called from migrate_params_apply in main + * This function is called from migrate_post_update_params in main * thread, possibly while a migration is in progress. A running * migration may be using the cache and might finish during this call, * hence changes to the cache are protected by XBZRLE.lock(). --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836347; cv=none; d=zohomail.com; s=zohoarc; b=ZfPapo03dFKe/8BPE4iTw50CT3TyFUxwPa4klBPmNoXXnH5cmqOvQ218FIfyfNOnAYwQzWnNd0uoD5NqCx1RxGA7eD7IUwE1LnNSxuKpcEJ8P03TVN795EuYqmq82XksVUs+LTSkF3CSHNxLeax1hhMSSH86nCpQtCKOCm1JM8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836347; 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=GJvG76Q4MRyf/6x4TyO7///Sqex9FH/YFLAPqQtRKyE=; b=BTsWVd3gZ9Lb+t0BY5pp36ubFGwdGf/LOUNA6NUQGzoo4b239AzeK0eP3sBAPtPpHkmTOYI7imCy/5mvfx3qe3hFYISOFmmfFTCSXqkSrlfxarHARk4dUo5YxwBuHoANmp8xhlCP6arYsIVddyt0TZyjF2+msnDeK+Y0qvm8VqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836347132259.81913493438935; Mon, 15 Dec 2025 14:05:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdE-0002k7-Dr; Mon, 15 Dec 2025 17:01:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdA-0002jZ-Oe for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:24 -0500 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 1vVGd9-0002eX-5p for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:24 -0500 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 B39E35BDE8; Mon, 15 Dec 2025 22:01:15 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EBE4D3EA63; Mon, 15 Dec 2025 22:01:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sNjjKSmFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836076; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GJvG76Q4MRyf/6x4TyO7///Sqex9FH/YFLAPqQtRKyE=; b=Av+/yO4Loz+zPsmOSjQXCmPVl5ovGZ3i+1WZ+VzQiwjVmK4iWn35ztUPPVqsNlxVarmwZl O72CnpgpfY5wFLNlC5A2TeOAYwqP51xmeDv4IxPF0if82LJ5NHN540xoHvW9E7i6nIuJE0 gLd7q4umycFDndzGqOGtW3uLSb8w+ck= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836076; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GJvG76Q4MRyf/6x4TyO7///Sqex9FH/YFLAPqQtRKyE=; b=TSy80n3b0sb+IFtvRTBPqmiqycCNGtifFBY982XtBYdtp5rypP9V/IZTKFP/1fSE+2JtaB jv9hXvkJkhrJJ0BA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=KcKHjHXf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=WE2+bIwy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836075; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GJvG76Q4MRyf/6x4TyO7///Sqex9FH/YFLAPqQtRKyE=; b=KcKHjHXfON0UDEmizKGz0UMf1lk/M+RolFO7yCqXoaqu0I63aHEjQC53BzWhD05kUFFqSF Bs+Ibg2ICbV1P6f7tvHjb4kav1Zlo1O1RLlnKDJdO7/JNR+DEeQO+jW8BYyKwkFijdsH0O 3NJZNzhW1fOSgSRtbXO7cZ5WGpqfZQc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836075; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GJvG76Q4MRyf/6x4TyO7///Sqex9FH/YFLAPqQtRKyE=; b=WE2+bIwyw0rZ0B+MooX4Wu2dzcZDK8+FBt06t1be007BlYfdCc5avgjnqkuEABdJxgEDFF g+D01Kh3mcIzwcCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Kevin Wolf Subject: [PATCH v3 09/51] migration: Add a flag to track block-bitmap-mapping input Date: Mon, 15 Dec 2025 18:59:55 -0300 Message-ID: <20251215220041.12657-10-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: B39E35BDE8 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1765836349470154100 Content-Type: text/plain; charset="utf-8" The QAPI converts an empty list on the block-bitmap-mapping input into a NULL BitmapMigrationNodeAliasList. The empty list is a valid input for the block-bitmap-mapping option, so commit 3cba22c9ad ("migration: Fix block_bitmap_mapping migration") started using the s->parameters.has_block_bitmap_mapping field to tell when the user has passed in an empty list vs. when no list has been passed at all. Using s->parameters.has_block_bitmap_mapping field is only possible because MigrationParameters has had its members made optional due to historical reasons. In order to make improvements to the way configuration options are set for a migration, we'd like to reduce the open-coded usage of the has_* fields of the global configuration object (s->parameters). Add a separate boolean to track the status of the block_bitmap_mapping option. No functional change intended. (this was verified to not regress iotest 300, which is the test that 3cba22c9ad refers to) CC: Kevin Wolf Acked-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 3 ++- migration/migration.h | 7 +++++++ migration/options.c | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index a83aba9630..4f9f5800de 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -321,6 +321,7 @@ static void monitor_print_cpr_exec_command(Monitor *mon= , strList *args) void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) { MigrationParameters *params; + MigrationState *s =3D migrate_get_current(); =20 params =3D qmp_query_migrate_parameters(NULL); =20 @@ -407,7 +408,7 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), params->max_postcopy_bandwidth); =20 - if (params->has_block_bitmap_mapping) { + if (s->has_block_bitmap_mapping) { const BitmapMigrationNodeAliasList *bmnal; =20 monitor_printf(mon, "%s:\n", diff --git a/migration/migration.h b/migration/migration.h index 213b33fe6e..20802596fb 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -514,6 +514,13 @@ struct MigrationState { QemuEvent postcopy_package_loaded_event; =20 GSource *hup_source; + + /* + * The block-bitmap-mapping option is allowed to be an empty list, + * therefore we need a way to know whether the user has given + * anything as input. + */ + bool has_block_bitmap_mapping; }; =20 void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, diff --git a/migration/options.c b/migration/options.c index e7f4aeaf03..5ef30e0f8d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -784,7 +784,7 @@ bool migrate_has_block_bitmap_mapping(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.has_block_bitmap_mapping; + return s->has_block_bitmap_mapping; } =20 uint32_t migrate_checkpoint_delay(void) @@ -1069,7 +1069,7 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) params->has_announce_step =3D true; params->announce_step =3D s->parameters.announce_step; =20 - if (s->parameters.has_block_bitmap_mapping) { + if (s->has_block_bitmap_mapping) { params->has_block_bitmap_mapping =3D true; params->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, @@ -1557,7 +1557,7 @@ static void migrate_params_apply(MigrationParameters = *params) qapi_free_BitmapMigrationNodeAliasList( s->parameters.block_bitmap_mapping); =20 - s->parameters.has_block_bitmap_mapping =3D true; + s->has_block_bitmap_mapping =3D true; s->parameters.block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, params->block_bitmap_mapping); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836167; cv=none; d=zohomail.com; s=zohoarc; b=Ct8ee5WAF0M3rRaEJ2+f76WDGPyX9P3BMRJJi9Es5BBaHJaQIyzcgu9Cs1D6gBR1VoTIkPXtabbjA4SYAMA095SIAG2u7aYbq9SFa+2ekkvSMQK0/sTdz9TyRovfzHQehyFk+tWrKicOIJ3MDeUj1YVHGD6nARweTTvKWCE/oRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836167; 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=a9eq/y3UmyvAYxYRZu9xtiGYM+7Zy4+9XV42ZmBPrjs=; b=fqFWNvFc+uxk6xwfYkt3eyt6lyHiPlTh1xLWKiSWc2ZmXhyaUfzMVYt2YXdn8aCK33Qf/UMdPUCPqTfCtlxikYDI8/4NZBUfJ2JbPs7wIfsADuW7eMzPNcRf1Yxv4ZkaxFVNmK5xddcyvXoQOkbhpMan0PXr/Ne6ZHC9wMCs30k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836167199143.00622164147444; Mon, 15 Dec 2025 14:02:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdI-0002l0-FN; Mon, 15 Dec 2025 17:01:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdG-0002kq-K9 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:30 -0500 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 1vVGdE-0002fl-Hc for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:30 -0500 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 C5F325BDEF; Mon, 15 Dec 2025 22:01:17 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 44F543EA65; Mon, 15 Dec 2025 22:01:16 +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 0C8XAiyFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a9eq/y3UmyvAYxYRZu9xtiGYM+7Zy4+9XV42ZmBPrjs=; b=0HTHXkm7JK3ua3sjzCHnMjEGPsmVm2btYgrrZETbGXEaFZ/Lx3EWtIPUnE/vTCvTK7PZYL td227oDQW4hzBI1Ys0GveLVnR+YNa42rUjQbrHp3bYTYIevVgNsoIQhcdDLk0fRqgd1m2e fY/En4HxISUNkggNtFj5ZPtMN6cV/3I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a9eq/y3UmyvAYxYRZu9xtiGYM+7Zy4+9XV42ZmBPrjs=; b=AUEAKUzCoQkD16cBSxJFB2AZ+G/ix+H0tT+cPuMdMTM0dpslAvPgvxz5dHyr+auegHkup3 fhs5Cxx+zEC3dCAA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a9eq/y3UmyvAYxYRZu9xtiGYM+7Zy4+9XV42ZmBPrjs=; b=0HTHXkm7JK3ua3sjzCHnMjEGPsmVm2btYgrrZETbGXEaFZ/Lx3EWtIPUnE/vTCvTK7PZYL td227oDQW4hzBI1Ys0GveLVnR+YNa42rUjQbrHp3bYTYIevVgNsoIQhcdDLk0fRqgd1m2e fY/En4HxISUNkggNtFj5ZPtMN6cV/3I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a9eq/y3UmyvAYxYRZu9xtiGYM+7Zy4+9XV42ZmBPrjs=; b=AUEAKUzCoQkD16cBSxJFB2AZ+G/ix+H0tT+cPuMdMTM0dpslAvPgvxz5dHyr+auegHkup3 fhs5Cxx+zEC3dCAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 10/51] migration: Remove checks for s->parameters has_* fields Date: Mon, 15 Dec 2025 18:59:56 -0300 Message-ID: <20251215220041.12657-11-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836170426158500 Content-Type: text/plain; charset="utf-8" The migration parameters validation produces a temporary structure which is the merge of the current parameter values (s->parameters, MigrationParameters) with the new parameters set by the user (former MigrateSetParameters). When copying the values from s->parameters into the temporary structure, the has_* fields are copied along, but when merging the user-input values they are not. During migrate_params_check(), only the parameters that have the corresponding has_* field will be checked, so only the parameters that were initialized in migrate_params_init() will be validated. This causes (almost) all of the migration parameters to be validated every time a parameter is set, regardless of which fields the user touched, but it also skips validation of any values that are not set in migrate_params_init(). It's not clear what was the intention of the original code, whether to validate all fields always, or only validate what the user input changed. Since the current situation is closer to the former option, make the choice of validating all parameters by removing the checks for the has_* fields when validating. Note that bringing the user input into the temporary structure for validation still needs to look at the has_* fields, otherwise any parameters not set by the user (i.e. 0) would override the corresponding value in s->parameters. The empty migrate_params_init() will be kept because subsequent patches will add code to it. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 2 +- migration/options.c | 102 ++++++++++++------------------------------ 2 files changed, 30 insertions(+), 74 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 92c84c3177..35c1826633 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2120,7 +2120,7 @@ static bool migrate_prepare(MigrationState *s, bool r= esume, Error **errp) } =20 if (migrate_mode() =3D=3D MIG_MODE_CPR_EXEC && - !s->parameters.has_cpr_exec_command) { + !s->parameters.cpr_exec_command) { error_setg(errp, "cpr-exec mode requires setting cpr-exec-command"= ); return false; } diff --git a/migration/options.c b/migration/options.c index 5ef30e0f8d..855fa980a3 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1095,32 +1095,6 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) =20 void migrate_params_init(MigrationParameters *params) { - /* Set has_* up only for parameter checks */ - params->has_throttle_trigger_threshold =3D true; - params->has_cpu_throttle_initial =3D true; - params->has_cpu_throttle_increment =3D true; - params->has_cpu_throttle_tailslow =3D true; - params->has_max_bandwidth =3D true; - params->has_downtime_limit =3D true; - params->has_x_checkpoint_delay =3D true; - params->has_multifd_channels =3D true; - params->has_multifd_compression =3D true; - params->has_multifd_zlib_level =3D true; - params->has_multifd_qatzip_level =3D true; - params->has_multifd_zstd_level =3D true; - params->has_xbzrle_cache_size =3D true; - params->has_max_postcopy_bandwidth =3D true; - params->has_max_cpu_throttle =3D true; - params->has_announce_initial =3D true; - params->has_announce_max =3D true; - params->has_announce_rounds =3D true; - params->has_announce_step =3D true; - params->has_x_vcpu_dirty_limit_period =3D true; - params->has_vcpu_dirty_limit =3D true; - params->has_mode =3D true; - params->has_zero_page_detection =3D true; - params->has_direct_io =3D true; - params->has_cpr_exec_command =3D true; } =20 static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) @@ -1156,34 +1130,31 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) { ERRP_GUARD(); =20 - if (params->has_throttle_trigger_threshold && - (params->throttle_trigger_threshold < 1 || - params->throttle_trigger_threshold > 100)) { + if (params->throttle_trigger_threshold < 1 || + params->throttle_trigger_threshold > 100) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "throttle_trigger_threshold", "an integer in the range of 1 to 100"); return false; } =20 - if (params->has_cpu_throttle_initial && - (params->cpu_throttle_initial < 1 || - params->cpu_throttle_initial > 99)) { + if (params->cpu_throttle_initial < 1 || + params->cpu_throttle_initial > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); return false; } =20 - if (params->has_cpu_throttle_increment && - (params->cpu_throttle_increment < 1 || - params->cpu_throttle_increment > 99)) { + if (params->cpu_throttle_increment < 1 || + params->cpu_throttle_increment > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); return false; } =20 - if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { + if (params->max_bandwidth > SIZE_MAX) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "max_bandwidth", "an integer in the range of 0 to "stringify(SIZE_MAX) @@ -1191,8 +1162,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return false; } =20 - if (params->has_avail_switchover_bandwidth && - (params->avail_switchover_bandwidth > SIZE_MAX)) { + if (params->avail_switchover_bandwidth > SIZE_MAX) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "avail_switchover_bandwidth", "an integer in the range of 0 to "stringify(SIZE_MAX) @@ -1200,8 +1170,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) return false; } =20 - if (params->has_downtime_limit && - (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { + if (params->downtime_limit > MAX_MIGRATE_DOWNTIME) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "downtime_limit", "an integer in the range of 0 to " @@ -1211,93 +1180,82 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) =20 /* x_checkpoint_delay is now always positive */ =20 - if (params->has_multifd_channels && (params->multifd_channels < 1)) { + if (params->multifd_channels < 1) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_channels", "a value between 1 and 255"); return false; } =20 - if (params->has_multifd_zlib_level && - (params->multifd_zlib_level > 9)) { + if (params->multifd_zlib_level > 9) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", "a value between 0 and 9"); return false; } =20 - if (params->has_multifd_qatzip_level && - ((params->multifd_qatzip_level > 9) || - (params->multifd_qatzip_level < 1))) { + if (params->multifd_qatzip_level > 9 || + params->multifd_qatzip_level < 1) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_qatzip_lev= el", "a value between 1 and 9"); return false; } =20 - if (params->has_multifd_zstd_level && - (params->multifd_zstd_level > 20)) { + if (params->multifd_zstd_level > 20) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", "a value between 0 and 20"); return false; } =20 - if (params->has_xbzrle_cache_size && - (params->xbzrle_cache_size < qemu_target_page_size() || - !is_power_of_2(params->xbzrle_cache_size))) { + if (params->xbzrle_cache_size < qemu_target_page_size() || + !is_power_of_2(params->xbzrle_cache_size)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "xbzrle_cache_size", "a power of two no less than the target page size"); return false; } =20 - if (params->has_max_cpu_throttle && - (params->max_cpu_throttle < params->cpu_throttle_initial || - params->max_cpu_throttle > 99)) { + if (params->max_cpu_throttle < params->cpu_throttle_initial || + params->max_cpu_throttle > 99) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "max_cpu_throttle", "an integer in the range of cpu_throttle_initial to 99"= ); return false; } =20 - if (params->has_announce_initial && - params->announce_initial > 100000) { + if (params->announce_initial > 100000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_initial", "a value between 0 and 100000"); return false; } - if (params->has_announce_max && - params->announce_max > 100000) { + if (params->announce_max > 100000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_max", "a value between 0 and 100000"); return false; } - if (params->has_announce_rounds && - params->announce_rounds > 1000) { + if (params->announce_rounds > 1000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_rounds", "a value between 0 and 1000"); return false; } - if (params->has_announce_step && - (params->announce_step < 1 || - params->announce_step > 10000)) { + if (params->announce_step < 1 || + params->announce_step > 10000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "announce_step", "a value between 0 and 10000"); return false; } =20 - if (params->has_block_bitmap_mapping && - !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { + if (!check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); return false; } =20 #ifdef CONFIG_LINUX if (migrate_zero_copy_send() && - ((params->has_multifd_compression && params->multifd_compression) = || - *params->tls_creds->u.s)) { + (params->multifd_compression || *params->tls_creds->u.s)) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; @@ -1311,23 +1269,21 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) return false; } =20 - if (params->has_x_vcpu_dirty_limit_period && - (params->x_vcpu_dirty_limit_period < 1 || - params->x_vcpu_dirty_limit_period > 1000)) { + if (params->x_vcpu_dirty_limit_period < 1 || + params->x_vcpu_dirty_limit_period > 1000) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "x-vcpu-dirty-limit-period", "a value between 1 and 1000"); return false; } =20 - if (params->has_vcpu_dirty_limit && - (params->vcpu_dirty_limit < 1)) { + if (params->vcpu_dirty_limit < 1) { error_setg(errp, "Parameter 'vcpu_dirty_limit' must be greater than 1 MB= /s"); return false; } =20 - if (params->has_direct_io && params->direct_io && !qemu_has_direct_io(= )) { + if (params->direct_io && !qemu_has_direct_io()) { error_setg(errp, "No build-time support for direct-io"); return false; } --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836253; cv=none; d=zohomail.com; s=zohoarc; b=O/spIy/nr6IuzhbYWEYKtrEVx/2mngnLinWJikBaLugCxU5sShm2qpoVsOspvcbII+0dzI9Av9aguCvF7D0c2QhavBq/iJCQdaGF5Yt5fggPsEwkSkPuqkMWpczps7CV2DTuA/0mUvoJ/UW9CIasoN2eqIUVXtPYIOPju/LH7aM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836253; 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=EurrJ2AcnBh7V9oMQIQwtMecIqYubUGFdzBsgTxErT0=; b=cdWOtFHAX6ywcwovlZz/0aLy6hMaNPph2BogK4u699Jfbk2MhVEGau2GOxHHb665qCf4mvnsUIm0mNPOHWVnKt9f0zr9QPqMToEX5eeDUrkmShJlj6rIX/JkZmAlwB12l4vHw56jJ4EdtzzF8GUJ2G+Avmxe1SU2/7ekyXnpzfQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836253170377.08854529456937; Mon, 15 Dec 2025 14:04:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdO-0002li-Er; Mon, 15 Dec 2025 17:01:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdM-0002lW-3y for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:36 -0500 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 1vVGdK-0002gE-0r for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:35 -0500 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 E94A55BDDC; Mon, 15 Dec 2025 22:01: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 640563EA63; Mon, 15 Dec 2025 22:01:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QK+sCS6FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EurrJ2AcnBh7V9oMQIQwtMecIqYubUGFdzBsgTxErT0=; b=h5tP2j0vNl/dqYdBv/jS5WLAUKr0UMdSXQR7jzFpVEjxOlG113nPk86Fxe8zt5j+WySEsi EXAhmzvfVw2kWyCu1Fd2qKKMM+RPMTZ2mLytNfHZTFEDpcUQw1+OUcaaXUnPK96fvasrHp UPHYwx6BOlUKTpTulaa5lRdlGt+4v0E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EurrJ2AcnBh7V9oMQIQwtMecIqYubUGFdzBsgTxErT0=; b=Rgynr0Cggh+33UUS34Qawoo0D2Bb11abDtjA/cGZv/2VKT+ND62mvyrMiPK6s8lzcN9zrF cPU/m8O8BGm9ayBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836079; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EurrJ2AcnBh7V9oMQIQwtMecIqYubUGFdzBsgTxErT0=; b=Qn1nXqNXI7QEGm2lDh8AKPG8KATBH+bjh4OgcWEyCtIscXhrmUiawpttm5wfeC3k/YNrNF 9uNs/mHhCYcBzr3LKk7EbKUgTxCol7ZU68B7wGduCwMUtryV5HFkCRHI0f9Abz1TDYBz1N z8Yerq5IeUCTC5OkjD37jjASOgx0XGc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836079; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EurrJ2AcnBh7V9oMQIQwtMecIqYubUGFdzBsgTxErT0=; b=/EPTshsw4BwYbLop0EhrE5SsLZq8KVaFRtO4AwMSIM6/lN+m4tdDzfz3ZctebIxoOeoLVw HGkn4pLHaiHQICDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 11/51] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Date: Mon, 15 Dec 2025 18:59:57 -0300 Message-ID: <20251215220041.12657-12-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: 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: 1765836256190154100 Content-Type: text/plain; charset="utf-8" The QERR_INVALID_PARAMETER_VALUE macro is documented as not to be used in new code. Remove the usage from migration/options.c. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 3 +-- migration/options.c | 56 +++++++++++++++--------------------------- migration/page_cache.c | 6 ++--- migration/ram.c | 3 +-- 4 files changed, 24 insertions(+), 44 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 35c1826633..2c8acd2ee1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2327,8 +2327,7 @@ static void qmp_migrate_finish(MigrationAddress *addr= , bool resume_requested, } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { file_start_outgoing_migration(s, &addr->u.file, &local_err); } else { - error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", - "a valid migration protocol"); + error_setg(&local_err, "uri is not a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); } diff --git a/migration/options.c b/migration/options.c index 855fa980a3..c72e63015c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1132,120 +1132,105 @@ bool migrate_params_check(MigrationParameters *pa= rams, Error **errp) =20 if (params->throttle_trigger_threshold < 1 || params->throttle_trigger_threshold > 100) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "throttle_trigger_threshold", + error_setg(errp, "Option throttle_trigger_threshold expects " "an integer in the range of 1 to 100"); return false; } =20 if (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_initial", + error_setg(errp, "Option cpu_throttle_initial expects " "an integer in the range of 1 to 99"); return false; } =20 if (params->cpu_throttle_increment < 1 || params->cpu_throttle_increment > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_increment", + error_setg(errp, "Option cpu_throttle_increment expects " "an integer in the range of 1 to 99"); return false; } =20 if (params->max_bandwidth > SIZE_MAX) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_bandwidth", + error_setg(errp, "Option max_bandwidth expects " "an integer in the range of 0 to "stringify(SIZE_MAX) " bytes/second"); return false; } =20 if (params->avail_switchover_bandwidth > SIZE_MAX) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "avail_switchover_bandwidth", + error_setg(errp, "Option avail_switchover_bandwidth expects " "an integer in the range of 0 to "stringify(SIZE_MAX) " bytes/second"); return false; } =20 if (params->downtime_limit > MAX_MIGRATE_DOWNTIME) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "downtime_limit", + error_setg(errp, "Option downtime_limit expects " "an integer in the range of 0 to " stringify(MAX_MIGRATE_DOWNTIME)" ms"); return false; } =20 - /* x_checkpoint_delay is now always positive */ - if (params->multifd_channels < 1) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_channels", + error_setg(errp, "Option multifd_channels expects " "a value between 1 and 255"); return false; } =20 if (params->multifd_zlib_level > 9) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", + error_setg(errp, "Option multifd_zlib_level expects " "a value between 0 and 9"); return false; } =20 if (params->multifd_qatzip_level > 9 || params->multifd_qatzip_level < 1) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_qatzip_lev= el", + error_setg(errp, "Option multifd_qatzip_level expects " "a value between 1 and 9"); return false; } =20 if (params->multifd_zstd_level > 20) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", + error_setg(errp, "Option multifd_zstd_level expects " "a value between 0 and 20"); return false; } =20 if (params->xbzrle_cache_size < qemu_target_page_size() || !is_power_of_2(params->xbzrle_cache_size)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "xbzrle_cache_size", + error_setg(errp, "Option xbzrle_cache_size expects " "a power of two no less than the target page size"); return false; } =20 if (params->max_cpu_throttle < params->cpu_throttle_initial || params->max_cpu_throttle > 99) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_cpu_throttle", + error_setg(errp, "max_Option cpu_throttle expects " "an integer in the range of cpu_throttle_initial to 99"= ); return false; } =20 if (params->announce_initial > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_initial", + error_setg(errp, "Option announce_initial expects " "a value between 0 and 100000"); return false; } if (params->announce_max > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_max", + error_setg(errp, "Option announce_max expects " "a value between 0 and 100000"); - return false; + return false; } if (params->announce_rounds > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_rounds", + error_setg(errp, "Option announce_rounds expects " "a value between 0 and 1000"); - return false; + return false; } if (params->announce_step < 1 || params->announce_step > 10000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_step", + error_setg(errp, "Option announce_step expects " "a value between 0 and 10000"); - return false; + return false; } =20 if (!check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { @@ -1271,8 +1256,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) =20 if (params->x_vcpu_dirty_limit_period < 1 || params->x_vcpu_dirty_limit_period > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "x-vcpu-dirty-limit-period", + error_setg(errp, "Option x-vcpu-dirty-limit-period expects " "a value between 1 and 1000"); return false; } diff --git a/migration/page_cache.c b/migration/page_cache.c index 6d4f7a9bbc..650b15e48c 100644 --- a/migration/page_cache.c +++ b/migration/page_cache.c @@ -45,15 +45,13 @@ PageCache *cache_init(uint64_t new_size, size_t page_si= ze, Error **errp) PageCache *cache; =20 if (new_size < page_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "is smaller than one target page size"); + error_setg(errp, "cache size is smaller than target page size"); return NULL; } =20 /* round down to the nearest power of 2 */ if (!is_power_of_2(num_pages)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "is not a power of two number of pages"); + error_setg(errp, "number of pages is not a power of two"); return NULL; } =20 diff --git a/migration/ram.c b/migration/ram.c index a49afbd995..3eda85b110 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -193,8 +193,7 @@ int xbzrle_cache_resize(uint64_t new_size, Error **errp) =20 /* Check for truncation */ if (new_size !=3D (size_t)new_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "exceeding address space"); + error_setg(errp, "xbzrle cache size integer overflow"); return -1; } =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836249; cv=none; d=zohomail.com; s=zohoarc; b=KPG33VoZgsDvoWaFV76hqiA8TTBBawlRuYZbrF+6SLfK8K+mlaIG6Q3CxZrC0DMYmaKg/KU3qQAYFXMNFoRzWHkULBNZtbeTc2g+xCX8CbA4sTPhPv6naoWqQxJxWE6AW/2MxO3GV3KmOPAWcZO3H+uZi2zDo41RWESgl81dSLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836249; 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=hyI3anxAzJoPsMnvfbHyVnv/o6qXg6b9/huSOQgQJJg=; b=dqcsVZY7EbkC+Pn6UoxZtdJRgmbG18qF+hiiGK6ZHd0iGSaZ4bduV0snKhYfv7HCvQii2bLNcrdhfjG8q3cgH0+0LRqypykZCYPGW+N5uo9M4zDRIAvwETvH2oHdtGO6WgpvX4TpiMoF7sv5ggokKiNp5KJI/8zRcfbDIDywRn4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836249531193.90237014772856; Mon, 15 Dec 2025 14:04:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdT-0002nC-87; Mon, 15 Dec 2025 17:01:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdR-0002ml-DR for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:41 -0500 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 1vVGdP-0002hF-KQ for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:41 -0500 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 4EC6F5BDF9; Mon, 15 Dec 2025 22:01: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 776603EA65; Mon, 15 Dec 2025 22:01: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 8G4QDjCFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836082; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hyI3anxAzJoPsMnvfbHyVnv/o6qXg6b9/huSOQgQJJg=; b=qwovlhaw68T139HMefrkp7lYBUywAyM7DtbySus/+BSdGF2/WVXy5xK94I7auOLiYP3wdS Jve4QP6ENvSUXohRn941dSDQ2XKWEbO+cV1RgA+Ih6P/zmX2O5meAFsZCfvgBePBb0OqFv eGC/8hEzjljiI7aDR3vRcdLUf9E5pKg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836082; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hyI3anxAzJoPsMnvfbHyVnv/o6qXg6b9/huSOQgQJJg=; b=cqnVu59FLUK7YmnF3RhnnEv5h7ogQ3XAVBxaihprxDXBjitN9OCuMXWXFqRlqFyfHrxEfy mXgX3dClWeT6fDBg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836082; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hyI3anxAzJoPsMnvfbHyVnv/o6qXg6b9/huSOQgQJJg=; b=qwovlhaw68T139HMefrkp7lYBUywAyM7DtbySus/+BSdGF2/WVXy5xK94I7auOLiYP3wdS Jve4QP6ENvSUXohRn941dSDQ2XKWEbO+cV1RgA+Ih6P/zmX2O5meAFsZCfvgBePBb0OqFv eGC/8hEzjljiI7aDR3vRcdLUf9E5pKg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836082; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hyI3anxAzJoPsMnvfbHyVnv/o6qXg6b9/huSOQgQJJg=; b=cqnVu59FLUK7YmnF3RhnnEv5h7ogQ3XAVBxaihprxDXBjitN9OCuMXWXFqRlqFyfHrxEfy mXgX3dClWeT6fDBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Kevin Wolf Subject: [PATCH v3 12/51] migration: Extract code to mark all parameters as present Date: Mon, 15 Dec 2025 18:59:58 -0300 Message-ID: <20251215220041.12657-13-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.989]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836250518158500 Content-Type: text/plain; charset="utf-8" MigrationParameters needs to have all of its has_* fields marked as true when used as the return of query_migrate_parameters because the corresponding QMP command has all of its members non-optional by design, despite them being marked as optional in migration.json. Extract this code into a function and make it assert if any field is missing. With this we ensure future changes will not inadvertently leave any parameters missing. Note that the block-bitmap-mapping is a special case because the empty list is considered a valid value, so it has historically not been present in the command's output if it has never been set. CC: Kevin Wolf Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/options.c | 89 ++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/migration/options.c b/migration/options.c index c72e63015c..aafd688f5c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1018,6 +1018,44 @@ static void tls_opt_to_str(StrOrNull *opt) opt->u.s =3D g_strdup(""); } =20 +/* + * query-migrate-parameters expects all members of MigrationParameters + * to be present, but we cannot mark them non-optional in QAPI because + * the structure is also used for migrate-set-parameters, which needs + * the optionality. Force all parameters to be seen as present + * now. Note that this depends on some form of default being set for + * every member of MigrationParameters, currently done during qdev + * init using migration_properties defined in this file. The TLS + * options are a special case because they don't have a default and + * need to be normalized before use. + */ +static void migrate_mark_all_params_present(MigrationParameters *p) +{ + int len, n_str_args =3D 3; /* tls-creds, tls-hostname, tls-authz */ + bool *has_fields[] =3D { + &p->has_throttle_trigger_threshold, &p->has_cpu_throttle_initial, + &p->has_cpu_throttle_increment, &p->has_cpu_throttle_tailslow, + &p->has_max_bandwidth, &p->has_avail_switchover_bandwidth, + &p->has_downtime_limit, &p->has_x_checkpoint_delay, + &p->has_multifd_channels, &p->has_multifd_compression, + &p->has_multifd_zlib_level, &p->has_multifd_qatzip_level, + &p->has_multifd_zstd_level, &p->has_xbzrle_cache_size, + &p->has_max_postcopy_bandwidth, &p->has_max_cpu_throttle, + &p->has_announce_initial, &p->has_announce_max, &p->has_announce_r= ounds, + &p->has_announce_step, &p->has_block_bitmap_mapping, + &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, + &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, + &p->has_cpr_exec_command, + }; + + len =3D ARRAY_SIZE(has_fields); + assert(len + n_str_args =3D=3D MIGRATION_PARAMETER__MAX); + + for (int i =3D 0; i < len; i++) { + *has_fields[i] =3D true; + } +} + MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; @@ -1025,70 +1063,53 @@ MigrationParameters *qmp_query_migrate_parameters(E= rror **errp) =20 /* TODO use QAPI_CLONE() instead of duplicating it inline */ params =3D g_malloc0(sizeof(*params)); - params->has_throttle_trigger_threshold =3D true; + params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; - params->has_cpu_throttle_initial =3D true; params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; - params->has_cpu_throttle_increment =3D true; params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; - params->has_cpu_throttle_tailslow =3D true; params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); params->tls_authz =3D QAPI_CLONE(StrOrNull, s->parameters.tls_authz); - params->has_max_bandwidth =3D true; params->max_bandwidth =3D s->parameters.max_bandwidth; - params->has_avail_switchover_bandwidth =3D true; params->avail_switchover_bandwidth =3D s->parameters.avail_switchover_= bandwidth; - params->has_downtime_limit =3D true; params->downtime_limit =3D s->parameters.downtime_limit; - params->has_x_checkpoint_delay =3D true; params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; - params->has_multifd_channels =3D true; params->multifd_channels =3D s->parameters.multifd_channels; - params->has_multifd_compression =3D true; params->multifd_compression =3D s->parameters.multifd_compression; - params->has_multifd_zlib_level =3D true; params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; - params->has_multifd_qatzip_level =3D true; params->multifd_qatzip_level =3D s->parameters.multifd_qatzip_level; - params->has_multifd_zstd_level =3D true; params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; - params->has_xbzrle_cache_size =3D true; params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; - params->has_max_postcopy_bandwidth =3D true; params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; - params->has_max_cpu_throttle =3D true; params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; - params->has_announce_initial =3D true; params->announce_initial =3D s->parameters.announce_initial; - params->has_announce_max =3D true; params->announce_max =3D s->parameters.announce_max; - params->has_announce_rounds =3D true; params->announce_rounds =3D s->parameters.announce_rounds; - params->has_announce_step =3D true; params->announce_step =3D s->parameters.announce_step; - - if (s->has_block_bitmap_mapping) { - params->has_block_bitmap_mapping =3D true; - params->block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); - } - - params->has_x_vcpu_dirty_limit_period =3D true; params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; - params->has_vcpu_dirty_limit =3D true; params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; - params->has_mode =3D true; params->mode =3D s->parameters.mode; - params->has_zero_page_detection =3D true; params->zero_page_detection =3D s->parameters.zero_page_detection; - params->has_direct_io =3D true; params->direct_io =3D s->parameters.direct_io; - params->has_cpr_exec_command =3D true; params->cpr_exec_command =3D QAPI_CLONE(strList, s->parameters.cpr_exec_command); + params->block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + s->parameters.block_bitmap_mapping); + + migrate_mark_all_params_present(params); + + /* + * The block-bitmap-mapping breaks the expected API of + * query-migrate-parameters of having all members present. To keep + * compatibility, only emit this field if it's actually been + * set. The empty list is a valid value. + */ + if (!s->has_block_bitmap_mapping) { + params->has_block_bitmap_mapping =3D false; + qapi_free_BitmapMigrationNodeAliasList(params->block_bitmap_mappin= g); + } =20 return params; } --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836180; cv=none; d=zohomail.com; s=zohoarc; b=YB4Dl4itqhficAJHfWMd7whIdVMwwYyWfJXmc28xALwTtTaLjOBAayM5Ww3ivPvkEmGE1fm6kEU39dbRfAI7KzwlyesdSSVQ2998FwF4HMb+G8f3aa1fpGaX1R2uvKqiorfbL2z5sS1V8HzNS6Zsmey4YMIy+SqsE/PN5Pck+Ps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836180; 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=BhUXtDDkw/wGate8Qf89Qn3ZQ5fMM5ydBQNPoWYb0uU=; b=PFIpkueU2ikjgK4OuZcYZSZ+QpTpRc6+V+979vxL7vwQfKp2RBHoEWxAd6YOrE+g5neHGNCCAEsNEFwXEE7vX4vyvP0kxc5SuGczOShlljEAy9QyjtkEd/9FI5gKlu+8pdISpey7laVU2lD0HuQXyWe4eqDgc8MbH1q//0E9k5E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836180832300.16841030529883; Mon, 15 Dec 2025 14:03:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdZ-0002r6-CS; Mon, 15 Dec 2025 17:01:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdW-0002q7-Mz for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:46 -0500 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 1vVGdV-0002i3-36 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:46 -0500 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 5FAE15BE04; Mon, 15 Dec 2025 22:01: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 D1CB33EA63; Mon, 15 Dec 2025 22:01: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 GPpLJDKFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836084; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BhUXtDDkw/wGate8Qf89Qn3ZQ5fMM5ydBQNPoWYb0uU=; b=KJsxbSaFVJYgRQEuHBgX4ZLe/YL+hl2uJFeFILtgrveWbTO7xv5nrizryZWM8hPdKLSSN5 zNuwpc6Vr5EYb2oKdQI/1zJPdwAIbokzrdH29KKTlpyjP9RcclZurRcHqKDjnROW9bdNZd 6iJqpSE2rj4Y/YU0R6MfFZlcweB7CjM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836084; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BhUXtDDkw/wGate8Qf89Qn3ZQ5fMM5ydBQNPoWYb0uU=; b=OmYr1ZaScy9roLkPodJytPbCuEIMFkPhmlf79FWb46d+526GxQ4TOMnIoLHy3tDUayg3Hi SYgnhQHin6Shj4AQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836084; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BhUXtDDkw/wGate8Qf89Qn3ZQ5fMM5ydBQNPoWYb0uU=; b=KJsxbSaFVJYgRQEuHBgX4ZLe/YL+hl2uJFeFILtgrveWbTO7xv5nrizryZWM8hPdKLSSN5 zNuwpc6Vr5EYb2oKdQI/1zJPdwAIbokzrdH29KKTlpyjP9RcclZurRcHqKDjnROW9bdNZd 6iJqpSE2rj4Y/YU0R6MfFZlcweB7CjM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836084; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BhUXtDDkw/wGate8Qf89Qn3ZQ5fMM5ydBQNPoWYb0uU=; b=OmYr1ZaScy9roLkPodJytPbCuEIMFkPhmlf79FWb46d+526GxQ4TOMnIoLHy3tDUayg3Hi SYgnhQHin6Shj4AQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 13/51] migration: Use QAPI_CLONE_MEMBERS in query_migrate_parameters Date: Mon, 15 Dec 2025 18:59:59 -0300 Message-ID: <20251215220041.12657-14-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.986]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836183268154100 Content-Type: text/plain; charset="utf-8" QAPI_CLONE_MEMBERS is a better option than copying parameters one by one because it operates on the entire struct and follows pointers. It also avoids the need to alter this function every time a new parameter is added. For this to work, the has_* fields of s->parameters need to be already set beforehand, so move migrate_mark_all_params_present() to the init routine. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/options.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/migration/options.c b/migration/options.c index aafd688f5c..6b60003a32 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1058,47 +1058,9 @@ static void migrate_mark_all_params_present(Migratio= nParameters *p) =20 MigrationParameters *qmp_query_migrate_parameters(Error **errp) { - MigrationParameters *params; MigrationState *s =3D migrate_get_current(); - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - params =3D g_malloc0(sizeof(*params)); - - params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; - params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; - params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; - params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; - params->tls_creds =3D QAPI_CLONE(StrOrNull, s->parameters.tls_creds); - params->tls_hostname =3D QAPI_CLONE(StrOrNull, s->parameters.tls_hostn= ame); - params->tls_authz =3D QAPI_CLONE(StrOrNull, s->parameters.tls_authz); - params->max_bandwidth =3D s->parameters.max_bandwidth; - params->avail_switchover_bandwidth =3D s->parameters.avail_switchover_= bandwidth; - params->downtime_limit =3D s->parameters.downtime_limit; - params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; - params->multifd_channels =3D s->parameters.multifd_channels; - params->multifd_compression =3D s->parameters.multifd_compression; - params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; - params->multifd_qatzip_level =3D s->parameters.multifd_qatzip_level; - params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; - params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; - params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; - params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; - params->announce_initial =3D s->parameters.announce_initial; - params->announce_max =3D s->parameters.announce_max; - params->announce_rounds =3D s->parameters.announce_rounds; - params->announce_step =3D s->parameters.announce_step; - params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; - params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; - params->mode =3D s->parameters.mode; - params->zero_page_detection =3D s->parameters.zero_page_detection; - params->direct_io =3D s->parameters.direct_io; - params->cpr_exec_command =3D QAPI_CLONE(strList, - s->parameters.cpr_exec_command); - params->block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); - - migrate_mark_all_params_present(params); + MigrationParameters *params =3D QAPI_CLONE(MigrationParameters, + &s->parameters); =20 /* * The block-bitmap-mapping breaks the expected API of @@ -1116,6 +1078,7 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 void migrate_params_init(MigrationParameters *params) { + migrate_mark_all_params_present(params); } =20 static void migrate_post_update_params(MigrationParameters *new, Error **e= rrp) --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836289; cv=none; d=zohomail.com; s=zohoarc; b=Tt/jPH/0i8p9M+GTLPu/sDOZFCJAr3N0ezfyFox2Hg7IayuGEkMYm8YDUsBckbSNCLfgOTJ1CZh6d7CWjrF1aA07j/f8cJukg5CRvBTk3V31XyJ9z087OeEaryDTB+r67CsZhjdMCz9yssB6iegH9BWJxm4WoWWNmVlpPsFBOyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836289; 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=MjFysnpdZpV88oPmRBU5DG+u+cyC6eRlynwz83XBoTM=; b=F6MqCxRLw3SfWg6JDy5AYjjCG+/fn1o1C/qEkV585tGsP6Vql+2yRdnCYwD/v9zxAP0Z0zq8XRlS4o6IHWQpheYBYq8EXXHV+J9wmCgMGQvjzFo1N+6/jYyVwoHtaGuOedt9cJSmsYflezWzZ7xOhXExKGyXj0ALjP5Q2a52GLQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836289098696.5619100896894; Mon, 15 Dec 2025 14:04:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGde-0002sC-3c; Mon, 15 Dec 2025 17:01:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdc-0002rb-PE for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:52 -0500 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 1vVGda-0002j8-8k for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:52 -0500 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 71C825BDE8; Mon, 15 Dec 2025 22:01: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 E16F63EA63; Mon, 15 Dec 2025 22:01: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 QC1bKDSFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjFysnpdZpV88oPmRBU5DG+u+cyC6eRlynwz83XBoTM=; b=J2Gth1gcjA+OTiPihJFJ4KGRO1JiRMolXW0dW2V0awKi+MbH6tBXhQ4B9XLQrsmA0BSFst lUpdKBSSmpOTWBt9Nr1RlxBU8R1IzuauRc+r00AOJVJdQPwZ+2MclZ/mp+xHt+bjc/WC/l r3u8/4E3em/DcXV4FXni5Xtx6EOjBkg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjFysnpdZpV88oPmRBU5DG+u+cyC6eRlynwz83XBoTM=; b=Pb5d+5/FCiQjmGNSQIlnQSCUpUn4/i4HwD6R/nwWLnXRxQaVtjYQ7f/j2F1biumlgsM+/y mKVDJyDljIZQAoBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjFysnpdZpV88oPmRBU5DG+u+cyC6eRlynwz83XBoTM=; b=J2Gth1gcjA+OTiPihJFJ4KGRO1JiRMolXW0dW2V0awKi+MbH6tBXhQ4B9XLQrsmA0BSFst lUpdKBSSmpOTWBt9Nr1RlxBU8R1IzuauRc+r00AOJVJdQPwZ+2MclZ/mp+xHt+bjc/WC/l r3u8/4E3em/DcXV4FXni5Xtx6EOjBkg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjFysnpdZpV88oPmRBU5DG+u+cyC6eRlynwz83XBoTM=; b=Pb5d+5/FCiQjmGNSQIlnQSCUpUn4/i4HwD6R/nwWLnXRxQaVtjYQ7f/j2F1biumlgsM+/y mKVDJyDljIZQAoBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 14/51] migration: Use QAPI_CLONE_MEMBERS in migrate_params_test_apply Date: Mon, 15 Dec 2025 19:00:00 -0300 Message-ID: <20251215220041.12657-15-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.988]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836290647158500 Content-Type: text/plain; charset="utf-8" Use QAPI_CLONE_MEMBERS instead of making an assignment. The QAPI method makes the handling of the TLS strings more intuitive because it clones them as well. Signed-off-by: Fabiano Rosas --- migration/options.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/migration/options.c b/migration/options.c index 6b60003a32..2901b37228 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1262,9 +1262,9 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) static void migrate_params_test_apply(MigrationParameters *params, MigrationParameters *dest) { - *dest =3D migrate_get_current()->parameters; + MigrationState *s =3D migrate_get_current(); =20 - /* TODO use QAPI_CLONE() instead of duplicating it inline */ + QAPI_CLONE_MEMBERS(MigrationParameters, dest, &s->parameters); =20 if (params->has_throttle_trigger_threshold) { dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; @@ -1283,24 +1283,18 @@ static void migrate_params_test_apply(MigrationPara= meters *params, } =20 if (params->tls_creds) { + qapi_free_StrOrNull(dest->tls_creds); dest->tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_creds); - } else { - /* clear the reference, it's owned by s->parameters */ - dest->tls_creds =3D NULL; } =20 if (params->tls_hostname) { + qapi_free_StrOrNull(dest->tls_hostname); dest->tls_hostname =3D QAPI_CLONE(StrOrNull, params->tls_hostname); - } else { - /* clear the reference, it's owned by s->parameters */ - dest->tls_hostname =3D NULL; } =20 if (params->tls_authz) { + qapi_free_StrOrNull(dest->tls_authz); dest->tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_authz); - } else { - /* clear the reference, it's owned by s->parameters */ - dest->tls_authz =3D NULL; } =20 if (params->has_max_bandwidth) { @@ -1357,7 +1351,6 @@ static void migrate_params_test_apply(MigrationParame= ters *params, } =20 if (params->has_block_bitmap_mapping) { - dest->has_block_bitmap_mapping =3D true; dest->block_bitmap_mapping =3D params->block_bitmap_mapping; } =20 @@ -1532,6 +1525,14 @@ void qmp_migrate_set_parameters(MigrationParameters = *params, Error **errp) =20 migrate_params_test_apply(params, &tmp); =20 + /* + * Mark block_bitmap_mapping as present now while we have the + * params structure with the user input around. + */ + if (params->has_block_bitmap_mapping) { + migrate_get_current()->has_block_bitmap_mapping =3D true; + } + if (migrate_params_check(&tmp, errp)) { migrate_params_apply(params); migrate_post_update_params(params, errp); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836180; cv=none; d=zohomail.com; s=zohoarc; b=gPD/1QDLyoIaFNzo64KmZ6iDxaxT91cy3jpBiuAKoUivLJI0k4JvWqQ9met90LRGuWrwxaPZhw0gfXAaJDIhkVqxgS4HJbd6sFQV/x65i1Y2WGPEcXtdwCnG+Bpz8Nu9FeYq6kI52SOCnpUHNX4pVT2fHp71ZkbUxcZUZc3QwW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836180; 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=Rv2kWoOoZ1W6ki7xl5d8pZ99rzFd7UPYEB3Nt7NaR2A=; b=jxTJKKOgzs7xT5+TFtiCofXE93/BEkgcbpi6Bqm8CcZJnYXQcf3/jdbJjK8Sxvyfx2qJ89rMMbk7SZHKr1O7+YHT0sKHR9zxtrfhQxZ+L/+4SIx43jO8xUu9Ow6rWC9B+exDedw76XjVtkaqmDuKby+foLibIW18bx5HqpZdaRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836180553863.5562837005939; Mon, 15 Dec 2025 14:03:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdm-0003YA-M5; Mon, 15 Dec 2025 17:02:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdk-0003Iq-It for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:00 -0500 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 1vVGdg-0002ly-Ur for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:00 -0500 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 9CFC35BE05; Mon, 15 Dec 2025 22:01: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 17B7F3EA63; Mon, 15 Dec 2025 22:01: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 2N4+LTaFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836088; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rv2kWoOoZ1W6ki7xl5d8pZ99rzFd7UPYEB3Nt7NaR2A=; b=zQUsqeDSv6taW+4xsxRyZt/f1amnkAlXUuxpROoh1qRZrBl0fuSURDMVDeW/+UtDsjVArP GfYICnqOFKBR7AE53dKs4kDK0LeYP/XpMA4c3dSZC7/G39ql2jaIyxmBEdXGPgigAb28eT JCDAmxfubVMpFfKAiYsgFytgtvxv1BU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836088; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rv2kWoOoZ1W6ki7xl5d8pZ99rzFd7UPYEB3Nt7NaR2A=; b=h26BD9FIan1KM4n8+btKfUs7KCfgO1KquKgzmyT1H/ZgmlJl+0RiBDKEkE/o3Xy4WjDO4l gNWktX4+ANyU22Cg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836088; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rv2kWoOoZ1W6ki7xl5d8pZ99rzFd7UPYEB3Nt7NaR2A=; b=zQUsqeDSv6taW+4xsxRyZt/f1amnkAlXUuxpROoh1qRZrBl0fuSURDMVDeW/+UtDsjVArP GfYICnqOFKBR7AE53dKs4kDK0LeYP/XpMA4c3dSZC7/G39ql2jaIyxmBEdXGPgigAb28eT JCDAmxfubVMpFfKAiYsgFytgtvxv1BU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836088; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rv2kWoOoZ1W6ki7xl5d8pZ99rzFd7UPYEB3Nt7NaR2A=; b=h26BD9FIan1KM4n8+btKfUs7KCfgO1KquKgzmyT1H/ZgmlJl+0RiBDKEkE/o3Xy4WjDO4l gNWktX4+ANyU22Cg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 15/51] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Date: Mon, 15 Dec 2025 19:00:01 -0300 Message-ID: <20251215220041.12657-16-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.988]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836183317154100 Content-Type: text/plain; charset="utf-8" Instead of setting parameters one by one, use the temporary object, which already contains the current migration parameters plus the new ones and was just validated by migration_params_check(). Use cloning to overwrite it. This avoids the need to alter this function every time a new parameter is added. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/options.c | 134 ++++---------------------------------------- 1 file changed, 12 insertions(+), 122 deletions(-) diff --git a/migration/options.c b/migration/options.c index 2901b37228..03e63c918c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qemu/main-loop.h" #include "exec/target_page.h" #include "qapi/clone-visitor.h" #include "qapi/error.h" @@ -1379,132 +1380,21 @@ static void migrate_params_test_apply(MigrationPar= ameters *params, } } =20 +/* + * Caller must ensure all has_* fields of @params are true to ensure + * all fields 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 */ + assert(bql_locked()); =20 - if (params->has_throttle_trigger_threshold) { - s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; - } - - if (params->has_cpu_throttle_initial) { - s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; - } - - if (params->has_cpu_throttle_increment) { - s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; - } - - if (params->has_cpu_throttle_tailslow) { - s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; - } - - if (params->tls_creds) { - qapi_free_StrOrNull(s->parameters.tls_creds); - s->parameters.tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_cred= s); - } - - if (params->tls_hostname) { - qapi_free_StrOrNull(s->parameters.tls_hostname); - s->parameters.tls_hostname =3D QAPI_CLONE(StrOrNull, - params->tls_hostname); - } - - if (params->tls_authz) { - qapi_free_StrOrNull(s->parameters.tls_authz); - s->parameters.tls_authz =3D QAPI_CLONE(StrOrNull, params->tls_auth= z); - } - - if (params->has_max_bandwidth) { - s->parameters.max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_avail_switchover_bandwidth) { - s->parameters.avail_switchover_bandwidth =3D params->avail_switcho= ver_bandwidth; - } - - if (params->has_downtime_limit) { - s->parameters.downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_multifd_channels) { - s->parameters.multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - s->parameters.multifd_compression =3D params->multifd_compression; - } - if (params->has_multifd_qatzip_level) { - s->parameters.multifd_qatzip_level =3D params->multifd_qatzip_leve= l; - } - if (params->has_multifd_zlib_level) { - s->parameters.multifd_zlib_level =3D params->multifd_zlib_level; - } - if (params->has_multifd_zstd_level) { - s->parameters.multifd_zstd_level =3D params->multifd_zstd_level; - } - if (params->has_xbzrle_cache_size) { - s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - } - if (params->has_max_postcopy_bandwidth) { - s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - } - if (params->has_max_cpu_throttle) { - s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - s->parameters.announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - s->parameters.announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - s->parameters.announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - s->parameters.announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - qapi_free_BitmapMigrationNodeAliasList( - s->parameters.block_bitmap_mapping); - - s->has_block_bitmap_mapping =3D true; - s->parameters.block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - params->block_bitmap_mapping); - } - - if (params->has_x_vcpu_dirty_limit_period) { - s->parameters.x_vcpu_dirty_limit_period =3D - params->x_vcpu_dirty_limit_period; - } - if (params->has_vcpu_dirty_limit) { - s->parameters.vcpu_dirty_limit =3D params->vcpu_dirty_limit; - } - - if (params->has_mode) { - s->parameters.mode =3D params->mode; - } - - if (params->has_zero_page_detection) { - s->parameters.zero_page_detection =3D params->zero_page_detection; - } - - if (params->has_direct_io) { - s->parameters.direct_io =3D params->direct_io; - } - - 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 *params, Error **errp) @@ -1534,7 +1424,7 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) } =20 if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(params); + migrate_params_apply(&tmp); migrate_post_update_params(params, errp); } =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836180; cv=none; d=zohomail.com; s=zohoarc; b=iWMP7HSt7/Iwqry+uqicGu04tFMRvxmomoPyAROqRQZ0iMB0NASIKa1cvjycRx+lwoFvE1cjwejiNyl+aoxdlLz6ueOzsiBN/n6fWWbRD2QZhdjsC8eKbFFyNm+9UrVzdMEqyr7r9F/Tya+5VAAALW/N7/1pOkYdxEkubt7ItKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836180; 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=PBzJkpOkkK0HoW8hl5SIwKzpENa8ip8NNhwNebfQdeQ=; b=RxC1JHWZODA2ouFjnewdw4mVwV0Ag2mGPPxOUAeO/zPoNHwEhJ96tGpwqGcwW4NIKfycaB94Y7KpAjvr5668wpBTFUCAENlvNh1Ia705xvSSJSIPOo2Xmnx5uDnBNDrcS3lo0nLOMqj5YO0ODg45hRWWst31k+x/vZW2NcDFX+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836180723742.2715656012203; Mon, 15 Dec 2025 14:03:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGds-00040C-Fc; Mon, 15 Dec 2025 17:02:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdp-0003tO-Sf for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:05 -0500 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 1vVGdo-0002ob-3P for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:05 -0500 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 EB1225BDEF; Mon, 15 Dec 2025 22:01:30 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2DAF23EA63; Mon, 15 Dec 2025 22:01: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 CPK5NziFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836091; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PBzJkpOkkK0HoW8hl5SIwKzpENa8ip8NNhwNebfQdeQ=; b=neDJY19ZQraqjlqh4jn+5vUdT8phTL8z903OQem8H9z3H5xLDNy8oEW57DDUyeTJGgEMuC Uk6dmlVLymbN0jkxWVYl1wcMAhEkVSfV91N42JG/28PZ3rloKYyHDuDE4S/4MNmzapkjHf Q/sO19DvjVJ0eKRDDfPvbpaTSpsyUro= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836091; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PBzJkpOkkK0HoW8hl5SIwKzpENa8ip8NNhwNebfQdeQ=; b=blHkOrCGLeG2XJ4qfT58FhBmzH4fwKE1s+IwN1ACYY4uZOMckK/Z/y/ZK4WXlcTVEi9vvz YnY8w9HQGbcy7KCw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836090; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PBzJkpOkkK0HoW8hl5SIwKzpENa8ip8NNhwNebfQdeQ=; b=AEIukR4IH+ynN8FQIKAVlUO6QuaUHVt7mel1xsb3GJ+bD6ygs6hGjB8Ove55JfP6Wjhrvl jQky8dbf2uxvMfxBglbjbbVNo/TUAy04OwJgVtv9/aDrcydVFVxQV8hVcNVM/ctgiEkdle SVRJz08+CUGVMDi7jG3URPTykT8k5Ow= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836090; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PBzJkpOkkK0HoW8hl5SIwKzpENa8ip8NNhwNebfQdeQ=; b=RCCI7oznM22hXdEvmWGUTVRrkiVN2PteAk7cVG7KreTJbBzYQU+nsSsBKJ61AlQz5vxsFk Y/v563+7XBQAU7Cg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Michael Roth Subject: [PATCH v3 16/51] qapi: Add QAPI_MERGE Date: Mon, 15 Dec 2025 19:00:02 -0300 Message-ID: <20251215220041.12657-17-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.995]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: 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: 1765836182033158501 Content-Type: text/plain; charset="utf-8" The migration subsystem currently has code to merge two objects of the same type. It does so by checking which fields are present in a source object and overwriting the corresponding fields on the destination object. This leads to a lot of open-coded lines such as: if (src->has_foobar) { dst->foobar =3D src->foobar; } This pattern could be replaced by a copy using visitors. Implement a macro that extracts elements from a source object using an output visitor and merges it with a destination object using an input visitor. Signed-off-by: Fabiano Rosas Acked-by: Peter Xu --- include/qapi/type-helpers.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/qapi/type-helpers.h b/include/qapi/type-helpers.h index fc8352cdec..011716c6ad 100644 --- a/include/qapi/type-helpers.h +++ b/include/qapi/type-helpers.h @@ -10,6 +10,8 @@ */ =20 #include "qapi/qapi-types-common.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/qobject-output-visitor.h" =20 HumanReadableText *human_readable_text_from_str(GString *str); =20 @@ -20,3 +22,30 @@ HumanReadableText *human_readable_text_from_str(GString = *str); * cleanup. */ char **strv_from_str_list(const strList *list); + +/* + * Merge @src over @dst by copying deep clones of the present members + * from @src to @dst. Non-present on @src are left untouched on @dst. + */ +#define QAPI_MERGE(type, dst_, src_) \ + ({ \ + QObject *out_ =3D NULL; \ + Visitor *v_; \ + /* read in from src */ \ + v_ =3D qobject_output_visitor_new(&out_); \ + visit_type_ ## type(v_, NULL, &src_, &error_abort); \ + visit_complete(v_, &out_); \ + visit_free(v_); \ + /* \ + * Write to dst but leave existing fields intact (except for \ + * has_* which will be updated according to their presence in \ + * src). \ + */ \ + v_ =3D qobject_input_visitor_new(out_); \ + visit_start_struct(v_, NULL, NULL, 0, &error_abort); \ + visit_type_ ## type ## _members(v_, dst_, &error_abort); \ + visit_check_struct(v_, &error_abort); \ + visit_end_struct(v_, NULL); \ + visit_free(v_); \ + qobject_unref(out_); \ + }) --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836191; cv=none; d=zohomail.com; s=zohoarc; b=mgbQYbgetr+UNg127R08xEsUyTK+zdC5jEMv93hNFrTb72Z1MTtgPw9LnzdvkqeuoHqpvyqO88how1vScwM83bApyAfofV6QNHRkTHPretTZGnYqReqDwHA8wXzQZjdy3VWO48XAtyqheFrAw6g3GevT5K1Eo05TBsxI8QvUbtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836191; 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=ANsQLnOi5r+0TJdIl2TP4Q9xn6fuGF1JvuOmuuwC1Yo=; b=aVhgqtuYina/mI9z7GdHhBPbwLzY1Ny+qxVHd40BEWl8aYcOw8PG7vzx0Dfi/PEg8DLwYAvfcRe62nlqNp9k46VK4hyZorV//QluEvxBPf2W/u0J6FzGLLS8wcAgnc8HVk9t/yELWW4PuXLAY8EmEhfdjUs72n4IGnR4p/GHro0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836191913436.0906592593875; Mon, 15 Dec 2025 14:03:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGe0-0004Gr-JO; Mon, 15 Dec 2025 17:02:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdw-0004Di-1F for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:12 -0500 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 1vVGdt-0002pS-D7 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:11 -0500 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 064305BE06; Mon, 15 Dec 2025 22:01: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 7CCE73EA63; Mon, 15 Dec 2025 22:01: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 GDgZDzuFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ANsQLnOi5r+0TJdIl2TP4Q9xn6fuGF1JvuOmuuwC1Yo=; b=M4TFS8IGnUP6slqi3RsD8IcVaffbpnjgMFWMVJLJdarHAYEeey/BbWYm19d6M0ncSoiyJ6 bZiv1nBS+DfSEC3FbHqUgeDnn6ak7X6lirHGiMkLmyHJ7QDP8sWNkvYRa3LXiZ9Ov3gFYb NE0nPRYww1XW0PX4JBmMmz9cUBuWuYY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ANsQLnOi5r+0TJdIl2TP4Q9xn6fuGF1JvuOmuuwC1Yo=; b=Xg8/UoQW5+IEfqDqcSUCJoI3OhAall68CWj1Hwnm28KJnNqQK+P/Wa/G3/DUmQPy7PO3Mg PFENt7mmziA4rzAA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ANsQLnOi5r+0TJdIl2TP4Q9xn6fuGF1JvuOmuuwC1Yo=; b=M4TFS8IGnUP6slqi3RsD8IcVaffbpnjgMFWMVJLJdarHAYEeey/BbWYm19d6M0ncSoiyJ6 bZiv1nBS+DfSEC3FbHqUgeDnn6ak7X6lirHGiMkLmyHJ7QDP8sWNkvYRa3LXiZ9Ov3gFYb NE0nPRYww1XW0PX4JBmMmz9cUBuWuYY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ANsQLnOi5r+0TJdIl2TP4Q9xn6fuGF1JvuOmuuwC1Yo=; b=Xg8/UoQW5+IEfqDqcSUCJoI3OhAall68CWj1Hwnm28KJnNqQK+P/Wa/G3/DUmQPy7PO3Mg PFENt7mmziA4rzAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 17/51] migration: Use QAPI_MERGE in migrate_params_test_apply Date: Mon, 15 Dec 2025 19:00:03 -0300 Message-ID: <20251215220041.12657-18-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.989]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836192354158500 Content-Type: text/plain; charset="utf-8" Convert the code in migrate_params_test_apply() from an open-coded copy of every migration parameter to a copy using visitors. The current code has conditionals for each parameter's has_* field, which is exactly what the visitors do. This hides the details of QAPI from the migration code and avoids the need to update migrate_params_test_apply() every time a new migration parameter is added. Both were very confusing and while the visitor code can become a bit involved, there is no need for new contributors to ever touch it. Change the name of the function to a more direct reference of what it does: merging the user params with the temporary copy. Move the QAPI_CLONE_MEMBERS into the caller, so QAPI_CLONE can be used and there's no need to allocate memory in the migration code. Similarly, turn 'tmp' into a pointer so the proper qapi_free_ routine can be used. An extra call to migrate_mark_all_params_present() is now needed because the visitors update the has_ field for non-present fields, but we actually want them all set so migrate_params_apply() can copy all of them. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/options.c | 137 +++++++------------------------------------- 1 file changed, 22 insertions(+), 115 deletions(-) diff --git a/migration/options.c b/migration/options.c index 03e63c918c..36feaa5fe6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -20,6 +20,7 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qerror.h" +#include "qapi/type-helpers.h" #include "qobject/qnull.h" #include "system/runstate.h" #include "migration/colo.h" @@ -1260,124 +1261,28 @@ bool migrate_params_check(MigrationParameters *par= ams, Error **errp) return true; } =20 -static void migrate_params_test_apply(MigrationParameters *params, - MigrationParameters *dest) +static void migrate_params_merge(MigrationParameters *dst, + MigrationParameters *src) { - 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; + /* free memory from pointers that are about to be assigned */ + if (src->has_block_bitmap_mapping) { + g_clear_pointer(&dst->block_bitmap_mapping, + qapi_free_BitmapMigrationNodeAliasList); } =20 - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; + if (src->tls_creds) { + g_clear_pointer(&dst->tls_creds, qapi_free_StrOrNull); } =20 - if (params->tls_creds) { - qapi_free_StrOrNull(dest->tls_creds); - dest->tls_creds =3D QAPI_CLONE(StrOrNull, params->tls_creds); + if (src->tls_hostname) { + g_clear_pointer(&dst->tls_hostname, qapi_free_StrOrNull); } =20 - if (params->tls_hostname) { - qapi_free_StrOrNull(dest->tls_hostname); - dest->tls_hostname =3D QAPI_CLONE(StrOrNull, params->tls_hostname); + if (src->tls_authz) { + g_clear_pointer(&dst->tls_authz, qapi_free_StrOrNull); } =20 - 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) { - dest->block_bitmap_mapping =3D params->block_bitmap_mapping; - } - - if (params->has_x_vcpu_dirty_limit_period) { - dest->x_vcpu_dirty_limit_period =3D - params->x_vcpu_dirty_limit_period; - } - if (params->has_vcpu_dirty_limit) { - dest->vcpu_dirty_limit =3D params->vcpu_dirty_limit; - } - - if (params->has_mode) { - dest->mode =3D params->mode; - } - - if (params->has_zero_page_detection) { - dest->zero_page_detection =3D params->zero_page_detection; - } - - if (params->has_direct_io) { - dest->direct_io =3D params->direct_io; - } - - if (params->has_cpr_exec_command) { - dest->cpr_exec_command =3D params->cpr_exec_command; - } + QAPI_MERGE(MigrationParameters, dst, src); } =20 /* @@ -1399,7 +1304,9 @@ static void migrate_params_apply(MigrationParameters = *params) =20 void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { - MigrationParameters tmp; + MigrationState *s =3D migrate_get_current(); + g_autoptr(MigrationParameters) tmp =3D QAPI_CLONE(MigrationParameters, + &s->parameters); =20 /* * Convert QTYPE_QNULL and NULL to the empty string (""). Even @@ -1413,7 +1320,7 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) tls_opt_to_str(params->tls_hostname); tls_opt_to_str(params->tls_authz); =20 - migrate_params_test_apply(params, &tmp); + migrate_params_merge(tmp, params); =20 /* * Mark block_bitmap_mapping as present now while we have the @@ -1423,10 +1330,10 @@ void qmp_migrate_set_parameters(MigrationParameters= *params, Error **errp) migrate_get_current()->has_block_bitmap_mapping =3D true; } =20 - if (migrate_params_check(&tmp, errp)) { - migrate_params_apply(&tmp); + if (migrate_params_check(tmp, errp)) { + /* mark all present, so they're all copied */ + migrate_mark_all_params_present(tmp); + migrate_params_apply(tmp); migrate_post_update_params(params, errp); } - - migrate_tls_opts_free(&tmp); } --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836205; cv=none; d=zohomail.com; s=zohoarc; b=RMpo3Pdo4X1xI9JQuD/ebFQtDS9keLcUWbPrzG6nOGbV5wkeRkCXaeq/irGN7TJdhTASD3AVj2E7qMxfjYcLL6qVBWjkQnmuy1ISRJlHevShMuT7ni8XTJbGLv4gM5ElRRHX3UWohi69ZG4Zw4za4ldAonSOKTUPZausCu7M2/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836205; 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=uJocILz+uSA9/P/KQL2bGoCUFFMgBjETMhLQ4bdlXMc=; b=OHcpppa8pYvGE9HXGJVoMSxzDnKNMfRb9qH1daxqfzjTv0uoY/WsGx5lvEwcocXqyhOKOtGbcXUTVNoEgGeETgseTQLzewn2T/W9/6lgCUP8kaid76WLRPRNpiuvAmGZBIKfi2i38Ec5FOiEZbPceYPXItf2V/EgH2uwLb3TvFc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836205896240.94820018013456; Mon, 15 Dec 2025 14:03:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdP-0002mP-UL; Mon, 15 Dec 2025 17:01:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdO-0002m4-Qu for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:38 -0500 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 1vVGdM-0002gW-7d for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:37 -0500 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 0DFEF3378B; Mon, 15 Dec 2025 22:01: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 87FFC3EA63; Mon, 15 Dec 2025 22:01: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 CCOBEj2FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836095; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uJocILz+uSA9/P/KQL2bGoCUFFMgBjETMhLQ4bdlXMc=; b=XU2BOzjB0RmidjLb1pjysH4Kud+BVti1odhTWEb6lVW6UyZvJjVI55HGr4HX5uR3JtufFT 7t8thGfAaxNKlcXtkxnzdteHRTMkwW/tY07VytqeDIbKRahWG52iGpkH8nkCDBAm/Y0P41 ivsD22udP07mb904H8vkQsdChQ5wVdo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836095; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uJocILz+uSA9/P/KQL2bGoCUFFMgBjETMhLQ4bdlXMc=; b=ktuqeCN2K45RF0SoihmlrPb3Wgfna5jMWL8Kt/GW87U+eFdDTvYsO8DGCOI8E4lttNxrDT hAtaVyRDQWfFMiDw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836095; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uJocILz+uSA9/P/KQL2bGoCUFFMgBjETMhLQ4bdlXMc=; b=XU2BOzjB0RmidjLb1pjysH4Kud+BVti1odhTWEb6lVW6UyZvJjVI55HGr4HX5uR3JtufFT 7t8thGfAaxNKlcXtkxnzdteHRTMkwW/tY07VytqeDIbKRahWG52iGpkH8nkCDBAm/Y0P41 ivsD22udP07mb904H8vkQsdChQ5wVdo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836095; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uJocILz+uSA9/P/KQL2bGoCUFFMgBjETMhLQ4bdlXMc=; b=ktuqeCN2K45RF0SoihmlrPb3Wgfna5jMWL8Kt/GW87U+eFdDTvYsO8DGCOI8E4lttNxrDT hAtaVyRDQWfFMiDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 18/51] migration: Cleanup hmp_info_migrate_parameters Date: Mon, 15 Dec 2025 19:00:04 -0300 Message-ID: <20251215220041.12657-19-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836206348158500 Content-Type: text/plain; charset="utf-8" Do a cleanup of hmp_info_migrate_parameters() before adding more lines into it: - Make sure every parameter asserts that the has_* field is set. qmp_query_migrate_parameters should have set them all. (except for block-bitmap-mapping) - Remove the if (params), qmp_query_migrate_parameters never returns NULL. - Add a macro to encapsulate boilerplate. - Line breaks for legibility. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 292 ++++++++++++++++++--------------- 1 file changed, 163 insertions(+), 129 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 4f9f5800de..670ddb047b 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -33,6 +33,11 @@ #include "options.h" #include "migration.h" =20 +#define PARAM_INFO(_a, _f, _e, _v) do { \ + assert(_a); \ + monitor_printf(mon, _f, MigrationParameter_str(_e), _v); \ + } while (0) + static void migration_global_dump(Monitor *mon) { MigrationState *ms =3D migrate_get_current(); @@ -324,140 +329,169 @@ void hmp_info_migrate_parameters(Monitor *mon, cons= t QDict *qdict) MigrationState *s =3D migrate_get_current(); =20 params =3D qmp_query_migrate_parameters(NULL); + assert(params); =20 - if (params) { - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_INITIAL), - params->announce_initial); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_MAX), - params->announce_max); - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_ROUNDS), - params->announce_rounds); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_STEP), - params->announce_step); - assert(params->has_throttle_trigger_threshold); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_THROTTLE_TRIGGER_TH= RESHOLD), - params->throttle_trigger_threshold); - assert(params->has_cpu_throttle_initial); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIA= L), - params->cpu_throttle_initial); - assert(params->has_cpu_throttle_increment); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREM= ENT), - params->cpu_throttle_increment); - assert(params->has_cpu_throttle_tailslow); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_TAILSL= OW), - params->cpu_throttle_tailslow ? "on" : "off"); - assert(params->has_max_cpu_throttle); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_CPU_THROTTLE), - params->max_cpu_throttle); - assert(params->tls_creds); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), - params->tls_creds->u.s); - assert(params->tls_hostname); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), - params->tls_hostname->u.s); - assert(params->tls_authz); - monitor_printf(mon, "%s: '%s'\n", - MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), - params->tls_authz->u.s); - assert(params->has_max_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), - params->max_bandwidth); - assert(params->has_avail_switchover_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", - MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BA= NDWIDTH), - params->avail_switchover_bandwidth); - assert(params->has_max_postcopy_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), - params->max_postcopy_bandwidth); - assert(params->has_downtime_limit); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT), - params->downtime_limit); - assert(params->has_x_checkpoint_delay); - monitor_printf(mon, "%s: %u ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY), - params->x_checkpoint_delay); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_CHANNELS), - params->multifd_channels); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_COMPRESSION= ), - MultiFDCompression_str(params->multifd_compression)); - assert(params->has_zero_page_detection); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_ZERO_PAGE_DETECTION= ), - qapi_enum_lookup(&ZeroPageDetection_lookup, - params->zero_page_detection)); - monitor_printf(mon, "%s: %" PRIu64 " bytes\n", - MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), - params->xbzrle_cache_size); - monitor_printf(mon, "%s: %" PRIu64 "\n", - MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), - params->max_postcopy_bandwidth); - - if (s->has_block_bitmap_mapping) { - const BitmapMigrationNodeAliasList *bmnal; - - monitor_printf(mon, "%s:\n", - MigrationParameter_str( - MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); - - for (bmnal =3D params->block_bitmap_mapping; - bmnal; - bmnal =3D bmnal->next) - { - const BitmapMigrationNodeAlias *bmna =3D bmnal->value; - const BitmapMigrationBitmapAliasList *bmbal; - - monitor_printf(mon, " '%s' -> '%s'\n", - bmna->node_name, bmna->alias); - - for (bmbal =3D bmna->bitmaps; bmbal; bmbal =3D bmbal->next= ) { - const BitmapMigrationBitmapAlias *bmba =3D bmbal->valu= e; - - monitor_printf(mon, " '%s' -> '%s'\n", - bmba->name, bmba->alias); - } + PARAM_INFO(params->has_announce_initial, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_ANNOUNCE_INITIAL, + params->announce_initial); + + PARAM_INFO(params->has_announce_max, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_ANNOUNCE_MAX, + params->announce_max); + + PARAM_INFO(params->has_announce_rounds, + "%s: %" PRIu64 "\n", + MIGRATION_PARAMETER_ANNOUNCE_ROUNDS, + params->announce_rounds); + + PARAM_INFO(params->has_announce_step, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_ANNOUNCE_STEP, + params->announce_step); + + PARAM_INFO(params->has_throttle_trigger_threshold, + "%s: %u\n", + MIGRATION_PARAMETER_THROTTLE_TRIGGER_THRESHOLD, + params->throttle_trigger_threshold); + + PARAM_INFO(params->has_cpu_throttle_initial, + "%s: %u\n", + MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL, + params->cpu_throttle_initial); + + PARAM_INFO(params->has_cpu_throttle_increment, + "%s: %u\n", + MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT, + params->cpu_throttle_increment); + + PARAM_INFO(params->has_cpu_throttle_tailslow, + "%s: %s\n", + MIGRATION_PARAMETER_CPU_THROTTLE_TAILSLOW, + params->cpu_throttle_tailslow ? "on" : "off"); + + PARAM_INFO(params->has_max_cpu_throttle, + "%s: %u\n", + MIGRATION_PARAMETER_MAX_CPU_THROTTLE, + params->max_cpu_throttle); + + PARAM_INFO(params->tls_creds, + "%s: '%s'\n", + MIGRATION_PARAMETER_TLS_CREDS, + params->tls_creds->u.s); + + PARAM_INFO(params->tls_hostname, + "%s: '%s'\n", + MIGRATION_PARAMETER_TLS_HOSTNAME, + params->tls_hostname->u.s); + + PARAM_INFO(params->has_max_bandwidth, + "%s: %" PRIu64 " bytes/second\n", + MIGRATION_PARAMETER_MAX_BANDWIDTH, + params->max_bandwidth); + + PARAM_INFO(params->has_avail_switchover_bandwidth, + "%s: %" PRIu64 " bytes/second\n", + MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BANDWIDTH, + params->avail_switchover_bandwidth); + + PARAM_INFO(params->has_downtime_limit, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_DOWNTIME_LIMIT, + params->downtime_limit); + + PARAM_INFO(params->has_x_checkpoint_delay, + "%s: %u ms\n", + MIGRATION_PARAMETER_X_CHECKPOINT_DELAY, + params->x_checkpoint_delay); + + PARAM_INFO(params->has_multifd_channels, + "%s: %u\n", + MIGRATION_PARAMETER_MULTIFD_CHANNELS, + params->multifd_channels); + + PARAM_INFO(params->has_multifd_compression, + "%s: %s\n", + MIGRATION_PARAMETER_MULTIFD_COMPRESSION, + qapi_enum_lookup(&MultiFDCompression_lookup, + params->multifd_compression)); + + PARAM_INFO(params->has_zero_page_detection, + "%s: %s\n", + MIGRATION_PARAMETER_ZERO_PAGE_DETECTION, + qapi_enum_lookup(&ZeroPageDetection_lookup, + params->zero_page_detection)); + + PARAM_INFO(params->has_xbzrle_cache_size, + "%s: %" PRIu64 " bytes\n", + MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE, + params->xbzrle_cache_size); + + PARAM_INFO(params->has_max_postcopy_bandwidth, + "%s: %" PRIu64 "\n", + MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWIDTH, + params->max_postcopy_bandwidth); + + PARAM_INFO(params->tls_authz, + "%s: '%s'\n", + MIGRATION_PARAMETER_TLS_AUTHZ, + params->tls_authz->u.s); + + if (s->has_block_bitmap_mapping) { + const BitmapMigrationNodeAliasList *bmnal; + + monitor_printf(mon, "%s:\n", + MigrationParameter_str( + MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); + + for (bmnal =3D params->block_bitmap_mapping; + bmnal; + bmnal =3D bmnal->next) + { + const BitmapMigrationNodeAlias *bmna =3D bmnal->value; + const BitmapMigrationBitmapAliasList *bmbal; + + monitor_printf(mon, " '%s' -> '%s'\n", + bmna->node_name, bmna->alias); + + for (bmbal =3D bmna->bitmaps; bmbal; bmbal =3D bmbal->next) { + const BitmapMigrationBitmapAlias *bmba =3D bmbal->value; + + monitor_printf(mon, " '%s' -> '%s'\n", + bmba->name, bmba->alias); } } - - monitor_printf(mon, "%s: %" PRIu64 " ms\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), - params->x_vcpu_dirty_limit_period); - - monitor_printf(mon, "%s: %" PRIu64 " MB/s\n", - MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), - params->vcpu_dirty_limit); - - assert(params->has_mode); - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str(MIGRATION_PARAMETER_MODE), - qapi_enum_lookup(&MigMode_lookup, params->mode)); - - if (params->has_direct_io) { - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str( - MIGRATION_PARAMETER_DIRECT_IO), - params->direct_io ? "on" : "off"); - } - - assert(params->has_cpr_exec_command); - monitor_print_cpr_exec_command(mon, params->cpr_exec_command); } =20 + PARAM_INFO(params->has_x_vcpu_dirty_limit_period, + "%s: %" PRIu64 " ms\n", + MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERIOD, + params->x_vcpu_dirty_limit_period); + + PARAM_INFO(params->has_vcpu_dirty_limit, + "%s: %" PRIu64 " MB/s\n", + MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT, + params->vcpu_dirty_limit); + + PARAM_INFO(params->has_mode, + "%s: %s\n", + MIGRATION_PARAMETER_MODE, + qapi_enum_lookup(&MigMode_lookup, params->mode)); + + PARAM_INFO(params->has_direct_io, + "%s: %s\n", + MIGRATION_PARAMETER_DIRECT_IO, + params->direct_io ? "on" : "off"); + + PARAM_INFO(params->has_max_postcopy_bandwidth, + "%s: %" PRIu64 "\n", + MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWIDTH, + params->max_postcopy_bandwidth); + + assert(params->has_cpr_exec_command); + monitor_print_cpr_exec_command(mon, params->cpr_exec_command); + qapi_free_MigrationParameters(params); } =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836167; cv=none; d=zohomail.com; s=zohoarc; b=nkx4ja8bkrdhoIbmY/SD4h2r/ZtpBIc+Vapuwlf0T4IguvLxunSZ3LNn5/KJKVb4Ykpqa2sYtBInmJZA9j5V/0KXXFhhVm++/6jHMUx8kROfpRN+xPaC+NUalTaa66UPYuk4clk8uyuMuJlqDF0zmPl3Fi6KKrpvQx2FiyZfWC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836167; 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=c3SKjC4+BiHTxLnD651fTkVFSrHjqHq6jFO/JjVfTHw=; b=QumTiQMh0NkrpYfDMQ8KKjCogxRK/SgV2UzlmSJV2+G2DfrlrMT+fmIDuY9samvuAqrqJJ2TsAtN8AWoFvvPUP5fCsxhhcLf6ejel7PuksrPwT4GjkqDt0oPdB7Tr1ZaoetNaLr9WgqZV9ON8S4UjKVM1GO3c9rxcqpHB0ridjU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836167201492.41027903130157; Mon, 15 Dec 2025 14:02:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGe7-0004Ll-J1; Mon, 15 Dec 2025 17:02:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGe1-0004H6-Sb for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:17 -0500 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 1vVGdz-0002qT-26 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:17 -0500 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 6AA985BDDC; Mon, 15 Dec 2025 22:01:37 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A0C733EA63; Mon, 15 Dec 2025 22:01:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UE4/GD+FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c3SKjC4+BiHTxLnD651fTkVFSrHjqHq6jFO/JjVfTHw=; b=K4gFWGcggH6meby2tS//wSVgMCY7TD285Vii57rQ5nEaAFzDx/pOS/6mEDKytfizPQUiB1 xXIhBpIqGZZiAQGPUAp99czselopA+CSddAl4w6EpkI3uwcpdrjqdYxfKrZtiLXV0qSfot 7if408TCGjqOsZ8niAErma7SDf/1isY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c3SKjC4+BiHTxLnD651fTkVFSrHjqHq6jFO/JjVfTHw=; b=6nrLTn0PmZqZbL+cxXOZTNMgCsinlG/jXclq16ZUa3J+BQn4snAYiU21jHSRalCGo6srge VnkHb2TuqoTXGABw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c3SKjC4+BiHTxLnD651fTkVFSrHjqHq6jFO/JjVfTHw=; b=K4gFWGcggH6meby2tS//wSVgMCY7TD285Vii57rQ5nEaAFzDx/pOS/6mEDKytfizPQUiB1 xXIhBpIqGZZiAQGPUAp99czselopA+CSddAl4w6EpkI3uwcpdrjqdYxfKrZtiLXV0qSfot 7if408TCGjqOsZ8niAErma7SDf/1isY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c3SKjC4+BiHTxLnD651fTkVFSrHjqHq6jFO/JjVfTHw=; b=6nrLTn0PmZqZbL+cxXOZTNMgCsinlG/jXclq16ZUa3J+BQn4snAYiU21jHSRalCGo6srge VnkHb2TuqoTXGABw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake Subject: [PATCH v3 19/51] migration: Add capabilities into MigrationParameters Date: Mon, 15 Dec 2025 19:00:05 -0300 Message-ID: <20251215220041.12657-20-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836170448158500 Content-Type: text/plain; charset="utf-8" Add capabilities to MigrationParameters. This structure will hold all migration options. Capabilities will go away in the next patch. Also add capabilities to MigrationParameter as the enum needs to be kept in sync with MigrationParameters. This affects the parsing of migration HMP commands so make the necessary additions there too. (while here, also ensure MigrationParameter has their members in the same order relative to MigrationParameters) From this point on, both QMP and HMP versions of migrate-set-parameters and query-migrate-parameters gain the ability to work with capabilities. With MigrationParameters now having members for each capability, the migration capabilities commands (query-migrate-capabilities, migrate-set-capabilities) will soon be deprecated. Add a set of helpers to convert between the old MigrationCapability representation and the new representation as members of MigrationParameters. Acked-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 198 +++++++++++++++++++++++++++++++++ migration/migration.c | 8 ++ migration/options.c | 130 +++++++++++++++++++++- migration/options.h | 5 + qapi/migration.json | 140 ++++++++++++++++++++++- 5 files changed, 474 insertions(+), 7 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 670ddb047b..28b48c34bf 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -492,6 +492,116 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) assert(params->has_cpr_exec_command); monitor_print_cpr_exec_command(mon, params->cpr_exec_command); =20 + PARAM_INFO(params->has_xbzrle, + "%s: %s\n", + MIGRATION_PARAMETER_XBZRLE, + params->xbzrle ? "on" : "off"); + + PARAM_INFO(params->has_rdma_pin_all, + "%s: %s\n", + MIGRATION_PARAMETER_RDMA_PIN_ALL, + params->rdma_pin_all ? "on" : "off"); + + PARAM_INFO(params->has_auto_converge, + "%s: %s\n", + MIGRATION_PARAMETER_AUTO_CONVERGE, + params->auto_converge ? "on" : "off"); + + PARAM_INFO(params->has_zero_blocks, + "%s: %s\n", + MIGRATION_PARAMETER_ZERO_BLOCKS, + params->zero_blocks ? "on" : "off"); + + PARAM_INFO(params->has_events, + "%s: %s\n", + MIGRATION_PARAMETER_EVENTS, + params->events ? "on" : "off"); + + PARAM_INFO(params->has_postcopy_ram, + "%s: %s\n", + MIGRATION_PARAMETER_POSTCOPY_RAM, + params->postcopy_ram ? "on" : "off"); + + PARAM_INFO(params->has_x_colo, + "%s: %s\n", + MIGRATION_PARAMETER_X_COLO, + params->x_colo ? "on" : "off"); + + PARAM_INFO(params->has_release_ram, + "%s: %s\n", + MIGRATION_PARAMETER_RELEASE_RAM, + params->release_ram ? "on" : "off"); + + PARAM_INFO(params->has_return_path, + "%s: %s\n", + MIGRATION_PARAMETER_RETURN_PATH, + params->return_path ? "on" : "off"); + + PARAM_INFO(params->has_pause_before_switchover, + "%s: %s\n", + MIGRATION_PARAMETER_PAUSE_BEFORE_SWITCHOVER, + params->pause_before_switchover ? "on" : "off"); + + PARAM_INFO(params->has_multifd, + "%s: %s\n", + MIGRATION_PARAMETER_MULTIFD, + params->multifd ? "on" : "off"); + + PARAM_INFO(params->has_dirty_bitmaps, + "%s: %s\n", + MIGRATION_PARAMETER_DIRTY_BITMAPS, + params->dirty_bitmaps ? "on" : "off"); + + PARAM_INFO(params->has_postcopy_blocktime, + "%s: %s\n", + MIGRATION_PARAMETER_POSTCOPY_BLOCKTIME, + params->postcopy_blocktime ? "on" : "off"); + + PARAM_INFO(params->has_late_block_activate, + "%s: %s\n", + MIGRATION_PARAMETER_LATE_BLOCK_ACTIVATE, + params->late_block_activate ? "on" : "off"); + + PARAM_INFO(params->has_x_ignore_shared, + "%s: %s\n", + MIGRATION_PARAMETER_X_IGNORE_SHARED, + params->x_ignore_shared ? "on" : "off"); + + PARAM_INFO(params->has_validate_uuid, + "%s: %s\n", + MIGRATION_PARAMETER_VALIDATE_UUID, + params->validate_uuid ? "on" : "off"); + + PARAM_INFO(params->has_background_snapshot, + "%s: %s\n", + MIGRATION_PARAMETER_BACKGROUND_SNAPSHOT, + params->background_snapshot ? "on" : "off"); + + PARAM_INFO(params->has_zero_copy_send, + "%s: %s\n", + MIGRATION_PARAMETER_ZERO_COPY_SEND, + params->zero_copy_send ? "on" : "off"); + + PARAM_INFO(params->has_postcopy_preempt, + "%s: %s\n", + MIGRATION_PARAMETER_POSTCOPY_PREEMPT, + params->postcopy_preempt ? "on" : "off"); + + PARAM_INFO(params->has_switchover_ack, + "%s: %s\n", + MIGRATION_PARAMETER_SWITCHOVER_ACK, + params->switchover_ack ? "on" : "off"); + + PARAM_INFO(params->has_dirty_limit, + "%s: %s\n", + MIGRATION_PARAMETER_DIRTY_LIMIT, + params->dirty_limit ? "on" : "off"); + + PARAM_INFO(params->has_mapped_ram, + "%s: %s\n", + MIGRATION_PARAMETER_MAPPED_RAM, + params->mapped_ram ? "on" : "off"); + qapi_free_MigrationParameters(params); } =20 @@ -792,6 +902,94 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) p->has_cpr_exec_command =3D true; break; } + case MIGRATION_PARAMETER_XBZRLE: + p->has_xbzrle =3D true; + visit_type_bool(v, param, &p->xbzrle, &err); + break; + case MIGRATION_PARAMETER_RDMA_PIN_ALL: + p->has_rdma_pin_all =3D true; + visit_type_bool(v, param, &p->rdma_pin_all, &err); + break; + case MIGRATION_PARAMETER_AUTO_CONVERGE: + p->has_auto_converge =3D true; + visit_type_bool(v, param, &p->auto_converge, &err); + break; + case MIGRATION_PARAMETER_ZERO_BLOCKS: + p->has_zero_blocks =3D true; + visit_type_bool(v, param, &p->zero_blocks, &err); + break; + case MIGRATION_PARAMETER_EVENTS: + p->has_events =3D true; + visit_type_bool(v, param, &p->events, &err); + break; + case MIGRATION_PARAMETER_POSTCOPY_RAM: + p->has_postcopy_ram =3D true; + visit_type_bool(v, param, &p->postcopy_ram, &err); + break; + case MIGRATION_PARAMETER_X_COLO: + p->has_x_colo =3D true; + visit_type_bool(v, param, &p->x_colo, &err); + break; + case MIGRATION_PARAMETER_RELEASE_RAM: + p->has_release_ram =3D true; + visit_type_bool(v, param, &p->release_ram, &err); + break; + case MIGRATION_PARAMETER_RETURN_PATH: + p->has_return_path =3D true; + visit_type_bool(v, param, &p->return_path, &err); + break; + case MIGRATION_PARAMETER_PAUSE_BEFORE_SWITCHOVER: + p->has_pause_before_switchover =3D true; + visit_type_bool(v, param, &p->pause_before_switchover, &err); + break; + case MIGRATION_PARAMETER_MULTIFD: + p->has_multifd =3D true; + visit_type_bool(v, param, &p->multifd, &err); + break; + case MIGRATION_PARAMETER_DIRTY_BITMAPS: + p->has_dirty_bitmaps =3D true; + visit_type_bool(v, param, &p->dirty_bitmaps, &err); + break; + case MIGRATION_PARAMETER_POSTCOPY_BLOCKTIME: + p->has_postcopy_blocktime =3D true; + visit_type_bool(v, param, &p->postcopy_blocktime, &err); + break; + case MIGRATION_PARAMETER_LATE_BLOCK_ACTIVATE: + p->has_late_block_activate =3D true; + visit_type_bool(v, param, &p->late_block_activate, &err); + break; + case MIGRATION_PARAMETER_X_IGNORE_SHARED: + p->has_x_ignore_shared =3D true; + visit_type_bool(v, param, &p->x_ignore_shared, &err); + break; + case MIGRATION_PARAMETER_VALIDATE_UUID: + p->has_validate_uuid =3D true; + visit_type_bool(v, param, &p->validate_uuid, &err); + break; + case MIGRATION_PARAMETER_BACKGROUND_SNAPSHOT: + p->has_background_snapshot =3D true; + visit_type_bool(v, param, &p->background_snapshot, &err); + break; + case MIGRATION_PARAMETER_ZERO_COPY_SEND: + p->has_zero_copy_send =3D true; + visit_type_bool(v, param, &p->zero_copy_send, &err); + break; + case MIGRATION_PARAMETER_POSTCOPY_PREEMPT: + p->has_postcopy_preempt =3D true; + visit_type_bool(v, param, &p->postcopy_preempt, &err); + break; + case MIGRATION_PARAMETER_SWITCHOVER_ACK: + p->has_switchover_ack =3D true; + visit_type_bool(v, param, &p->switchover_ack, &err); + break; + case MIGRATION_PARAMETER_DIRTY_LIMIT: + p->has_dirty_limit =3D true; + visit_type_bool(v, param, &p->dirty_limit, &err); + break; + case MIGRATION_PARAMETER_MAPPED_RAM: + p->has_mapped_ram =3D true; + visit_type_bool(v, param, &p->mapped_ram, &err); + break; default: g_assert_not_reached(); } diff --git a/migration/migration.c b/migration/migration.c index 2c8acd2ee1..f0e74cbf4b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4196,6 +4196,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 36feaa5fe6..b23dcc15f9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -730,6 +730,111 @@ bool migrate_caps_check(bool *old_caps, bool *new_cap= s, Error **errp) return true; } =20 +static bool *migrate_capability_get_addr(MigrationParameters *params, int = i) +{ + bool *cap_addr =3D NULL; + + switch (i) { + case MIGRATION_CAPABILITY_XBZRLE: + cap_addr =3D ¶ms->xbzrle; + break; + case MIGRATION_CAPABILITY_RDMA_PIN_ALL: + cap_addr =3D ¶ms->rdma_pin_all; + break; + case MIGRATION_CAPABILITY_AUTO_CONVERGE: + cap_addr =3D ¶ms->auto_converge; + break; + case MIGRATION_CAPABILITY_ZERO_BLOCKS: + cap_addr =3D ¶ms->zero_blocks; + break; + case MIGRATION_CAPABILITY_EVENTS: + cap_addr =3D ¶ms->events; + break; + case MIGRATION_CAPABILITY_POSTCOPY_RAM: + cap_addr =3D ¶ms->postcopy_ram; + break; + case MIGRATION_CAPABILITY_X_COLO: + cap_addr =3D ¶ms->x_colo; + break; + case MIGRATION_CAPABILITY_RELEASE_RAM: + cap_addr =3D ¶ms->release_ram; + break; + case MIGRATION_CAPABILITY_RETURN_PATH: + cap_addr =3D ¶ms->return_path; + break; + case MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER: + cap_addr =3D ¶ms->pause_before_switchover; + break; + case MIGRATION_CAPABILITY_MULTIFD: + cap_addr =3D ¶ms->multifd; + break; + case MIGRATION_CAPABILITY_DIRTY_BITMAPS: + cap_addr =3D ¶ms->dirty_bitmaps; + break; + case MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME: + cap_addr =3D ¶ms->postcopy_blocktime; + break; + case MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE: + cap_addr =3D ¶ms->late_block_activate; + break; + case MIGRATION_CAPABILITY_X_IGNORE_SHARED: + cap_addr =3D ¶ms->x_ignore_shared; + break; + case MIGRATION_CAPABILITY_VALIDATE_UUID: + cap_addr =3D ¶ms->validate_uuid; + break; + case MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT: + cap_addr =3D ¶ms->background_snapshot; + break; + case MIGRATION_CAPABILITY_ZERO_COPY_SEND: + cap_addr =3D ¶ms->zero_copy_send; + break; + case MIGRATION_CAPABILITY_POSTCOPY_PREEMPT: + cap_addr =3D ¶ms->postcopy_preempt; + break; + case MIGRATION_CAPABILITY_SWITCHOVER_ACK: + cap_addr =3D ¶ms->switchover_ack; + break; + case MIGRATION_CAPABILITY_DIRTY_LIMIT: + cap_addr =3D ¶ms->dirty_limit; + break; + case MIGRATION_CAPABILITY_MAPPED_RAM: + cap_addr =3D ¶ms->mapped_ram; + break; + default: + g_assert_not_reached(); + } + + return cap_addr; +} + +/* Compatibility for code that reads capabilities in a loop */ +bool migrate_capability_get_compat(MigrationParameters *params, int i) +{ + return *(migrate_capability_get_addr(params, i)); +} + +/* Compatibility for code that writes capabilities in a loop */ +void migrate_capability_set_compat(MigrationParameters *params, int i, boo= l val) +{ + *(migrate_capability_get_addr(params, i)) =3D val; +} + +/* + * Set capabilities for compatibility with the old + * migrate-set-capabilities command. + */ +void migrate_capabilities_set_compat(MigrationParameters *params, + MigrationCapabilityStatusList *caps) +{ + MigrationCapabilityStatusList *cap; + + for (cap =3D caps; cap; cap =3D cap->next) { + migrate_capability_set_compat(params, cap->value->capability, + cap->value->state); + } +} + MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; @@ -771,6 +876,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 */ @@ -1047,7 +1154,15 @@ static void migrate_mark_all_params_present(Migratio= nParameters *p) &p->has_announce_step, &p->has_block_bitmap_mapping, &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, - &p->has_cpr_exec_command, + &p->has_cpr_exec_command, &p->has_xbzrle, &p->has_rdma_pin_all, + &p->has_auto_converge, &p->has_zero_blocks, &p->has_events, + &p->has_postcopy_ram, &p->has_x_colo, &p->has_release_ram, + &p->has_return_path, &p->has_pause_before_switchover, &p->has_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); @@ -1320,6 +1435,19 @@ void qmp_migrate_set_parameters(MigrationParameters = *params, Error **errp) tls_opt_to_str(params->tls_hostname); tls_opt_to_str(params->tls_authz); =20 + /* + * FIXME: Temporarily while migrate_caps_check is not + * converted to look at s->parameters. Will be gone the end of + * the series. + */ + bool new_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; + for (int i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { + new_caps[i] =3D migrate_capability_get_compat(&s->parameters, i); + } + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + return; + } + migrate_params_merge(tmp, params); =20 /* diff --git a/migration/options.h b/migration/options.h index 25fb316420..794cf23870 100644 --- a/migration/options.h +++ b/migration/options.h @@ -93,4 +93,9 @@ ZeroPageDetection migrate_zero_page_detection(void); bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); void migrate_tls_opts_free(MigrationParameters *params); +bool migrate_capability_get_compat(MigrationParameters *params, int i); +void migrate_capability_set_compat(MigrationParameters *params, int i, + bool val); +void migrate_capabilities_set_compat(MigrationParameters *params, + MigrationCapabilityStatusList *caps); #endif diff --git a/qapi/migration.json b/qapi/migration.json index 201dedd982..fcbb699a47 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -832,15 +832,22 @@ 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', 'max-cpu-throttle', 'multifd-compression', - 'multifd-zlib-level', 'multifd-zstd-level', - 'multifd-qatzip-level', + 'multifd-zlib-level', 'multifd-qatzip-level', 'multifd-zstd-lev= el', 'block-bitmap-mapping', { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= }, 'vcpu-dirty-limit', 'mode', 'zero-page-detection', 'direct-io', - 'cpr-exec-command'] } + 'cpr-exec-command', + 'xbzrle', 'rdma-pin-all', 'auto-converge', + 'zero-blocks', 'events', 'postcopy-ram', 'x-colo', + 'release-ram', 'return-path', 'pause-before-switchover', + 'multifd', 'dirty-bitmaps', 'postcopy-blocktime', + 'late-block-activate', 'x-ignore-shared', + 'validate-uuid', 'background-snapshot', + 'zero-copy-send', 'postcopy-preempt', + 'switchover-ack', 'dirty-limit', 'mapped-ram' ] } =20 ## # @migrate-set-parameters: @@ -1016,10 +1023,109 @@ # is @cpr-exec. The first list element is the program's filename, # the remainder its arguments. (Since 10.2) # +# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length +# Encoding). This feature allows us to minimize migration traffic +# for certain work loads, by sending compressed difference of the +# pages +# +# @rdma-pin-all: Controls whether or not the entire VM memory +# footprint is mlock()'d on demand or all at once. Refer to +# docs/rdma.txt for usage. Disabled by default. (since 2.0) +# +# @zero-blocks: During storage migration encode blocks of zeroes +# efficiently. This essentially saves 1MB of zeroes per block on +# the wire. Enabling requires source and target VM to support +# this feature. To enable it is sufficient to enable the +# capability on the source VM. The feature is disabled by +# default. (since 1.6) +# +# @events: Generate events for each migration state change. +# (since 2.4) +# +# @auto-converge: If enabled, QEMU will automatically throttle down +# the guest to speed up convergence of RAM migration. (since 1.6) +# +# @postcopy-ram: Start executing on the migration target before all of +# RAM has been migrated, pulling the remaining pages along as +# needed. The capacity must have the same setting on both source +# and target or migration will not even start. **Note:** If the +# migration fails during postcopy the VM will fail. (since 2.6) +# +# @x-colo: If enabled, migration will never end, and the state of the +# VM on the primary side will be migrated continuously to the VM +# on secondary side, this process is called COarse-Grain LOck +# Stepping (COLO) for Non-stop Service. (since 2.8) +# +# @release-ram: If enabled, QEMU will free the migrated ram pages on +# the source during postcopy-ram migration. (since 2.9) +# +# @return-path: If enabled, migration will use the return path even +# for precopy. (since 2.10) +# +# @pause-before-switchover: Pause outgoing migration before +# serialising device state and before disabling block IO. +# (since 2.11) +# +# @multifd: Use more than one fd for migration. (since 4.0) +# +# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps. +# (since 2.12) +# +# @postcopy-blocktime: Calculate downtime for postcopy live migration. +# (since 3.0) +# +# @late-block-activate: If enabled, the destination will not activate +# block devices (and thus take locks) immediately at the end of +# migration. (since 3.0) +# +# @x-ignore-shared: If enabled, QEMU will not migrate shared memory +# that is accessible on the destination machine. (since 4.0) +# +# @validate-uuid: Send the UUID of the source to allow the destination +# to ensure it is the same. (since 4.2) +# +# @background-snapshot: If enabled, the migration stream will be a +# snapshot of the VM exactly at the point when the migration +# procedure starts. The VM RAM is saved with running VM. +# (since 6.0) +# +# @zero-copy-send: Controls behavior on sending memory pages on +# migration. When true, enables a zero-copy mechanism for sending +# memory pages, if host supports it. Requires that QEMU be +# permitted to use locked memory for guest RAM pages. (since 7.1) +# +# @postcopy-preempt: If enabled, the migration process will allow +# postcopy requests to preempt precopy stream, so postcopy +# requests will be handled faster. This is a performance feature +# and should not affect the correctness of postcopy migration. +# (since 7.1) +# +# @switchover-ack: If enabled, migration will not stop the source VM +# and complete the migration until an ACK is received from the +# destination that it's OK to do so. Exactly when this ACK is +# sent depends on the migrated devices that use this feature. For +# example, a device can use it to make sure some of its data is +# sent and loaded in the destination before doing switchover. +# This can reduce downtime if devices that support this capability +# are present. 'return-path' capability must be enabled to use +# it. (since 8.1) +# +# @dirty-limit: If enabled, migration will throttle vCPUs as needed to +# keep their dirty page rate within @vcpu-dirty-limit. This can +# improve responsiveness of large guests during live migration, +# and can result in more stable read performance. Requires KVM +# with accelerator property "dirty-ring-size" set. (Since 8.1) +# +# @mapped-ram: Migrate using fixed offsets in the migration file for +# each RAM page. Requires a migration URI that supports seeking, +# such as a file. (since 9.0) +# # Features: # -# @unstable: Members @x-checkpoint-delay and -# @x-vcpu-dirty-limit-period are experimental. +# @unstable: Members @x-checkpoint-delay, @x-vcpu-dirty-limit-period, +# @x-colo and @x-ignore-shared are experimental. +# @deprecated: Member @zero-blocks is deprecated as being part of +# block migration which was already removed. # # Since: 2.4 ## @@ -1055,7 +1161,29 @@ '*mode': 'MigMode', '*zero-page-detection': 'ZeroPageDetection', '*direct-io': 'bool', - '*cpr-exec-command': [ 'str' ]} } + '*cpr-exec-command': [ 'str' ], + '*xbzrle': 'bool', + '*rdma-pin-all': 'bool', + '*auto-converge': 'bool', + '*zero-blocks': { 'type': 'bool', 'features': [ 'deprecated' ]= }, + '*events': 'bool', + '*postcopy-ram': 'bool', + '*x-colo': { 'type': 'bool', 'features': [ 'unstable' ] }, + '*release-ram': 'bool', + '*return-path': 'bool', + '*pause-before-switchover': 'bool', + '*multifd': 'bool', + '*dirty-bitmaps': 'bool', + '*postcopy-blocktime': 'bool', + '*late-block-activate': 'bool', + '*x-ignore-shared': { 'type': 'bool', 'features': [ 'unstable'= ] }, + '*validate-uuid': 'bool', + '*background-snapshot': 'bool', + '*zero-copy-send': 'bool', + '*postcopy-preempt': 'bool', + '*switchover-ack': 'bool', + '*dirty-limit': 'bool', + '*mapped-ram': 'bool' } } =20 ## # @query-migrate-parameters: --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836239; cv=none; d=zohomail.com; s=zohoarc; b=gBDnroUMsqf8bjC1J95JTp9tVwtsj2krddMZZFmP735wvEkKPsCsbZGdR2UcTi1YDck2m8vy/0QM5inMiU3Kb66j1MuN1W8EPbDMq/wO44T8QEGM72llvboWJ37qY3/bN4wRjJokT82Nn4SplAs9v7QwtCtQZAfHp/FuUcTdAqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836239; 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=YKPKJBkTp51hj6cCjBkLRwP50jjlnOW8s+DEvZSGbho=; b=GbdczbqEPHcI/j1f3sWmOjZkxQhPZSc5eFtH932rJ3TuDR+aVGWK/hvhVIqTNZLAaG1MBDrEJBgo5Igc8Lx1gPjouUTRI9QdbUvGLgBWbV7CDL81pz9AgZ2dFR9EabZ45oEsu4rE24uI9Gkllg9vY+jIOfHYtUeWx3nfXHYcyng= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836239188867.7627390417626; Mon, 15 Dec 2025 14:03:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdX-0002qT-Rv; Mon, 15 Dec 2025 17:01:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdV-0002pm-Dx for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:45 -0500 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 1vVGdS-0002hu-Fr for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:45 -0500 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 855FD3378B; Mon, 15 Dec 2025 22:01:39 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0919E3EA63; Mon, 15 Dec 2025 22:01:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KD8FL0GFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YKPKJBkTp51hj6cCjBkLRwP50jjlnOW8s+DEvZSGbho=; b=bNsqIdWW8ysiAd3MJ4NHvo86l9rnc3Qm5mUMrbLYg57dChxYlzlPNSYqtbMj7BJu5vG8ul gEwuQ6vabfSpE2PX8Q5R7dzpe5PURXKKuy5YHGAksDKyFICQWrQabwTAit0epIMGQM0nGg COuccVU20OmcxIGIcL0idKeyCenVmWw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YKPKJBkTp51hj6cCjBkLRwP50jjlnOW8s+DEvZSGbho=; b=Y2fCjnD4udpO53L1eCJrakQLBJ6Qsx4Y6Uu9cmoZRPUFc1WxIbBdRHvxOShVgdjhtr8w7r ebjkMFlsiMQIHQAw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YKPKJBkTp51hj6cCjBkLRwP50jjlnOW8s+DEvZSGbho=; b=bNsqIdWW8ysiAd3MJ4NHvo86l9rnc3Qm5mUMrbLYg57dChxYlzlPNSYqtbMj7BJu5vG8ul gEwuQ6vabfSpE2PX8Q5R7dzpe5PURXKKuy5YHGAksDKyFICQWrQabwTAit0epIMGQM0nGg COuccVU20OmcxIGIcL0idKeyCenVmWw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YKPKJBkTp51hj6cCjBkLRwP50jjlnOW8s+DEvZSGbho=; b=Y2fCjnD4udpO53L1eCJrakQLBJ6Qsx4Y6Uu9cmoZRPUFc1WxIbBdRHvxOShVgdjhtr8w7r ebjkMFlsiMQIHQAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 20/51] migration: Remove s->capabilities Date: Mon, 15 Dec 2025 19:00:06 -0300 Message-ID: <20251215220041.12657-21-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.990]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836240503158500 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 | 1 - migration/options.c | 310 +++++++++++++++++------------------------- migration/options.h | 19 +-- migration/savevm.c | 8 +- 5 files changed, 140 insertions(+), 220 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f0e74cbf4b..182dccd579 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -262,9 +262,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; @@ -4189,22 +4190,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 20802596fb..5fe5f8a23e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -359,7 +359,6 @@ struct MigrationState { int64_t downtime_start; int64_t downtime; int64_t expected_downtime; - bool capabilities[MIGRATION_CAPABILITY__MAX]; int64_t setup_time; =20 /* diff --git a/migration/options.c b/migration/options.c index b23dcc15f9..d3bb65513b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -82,9 +82,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 *, \ @@ -185,32 +182,42 @@ const Property migration_properties[] =3D { DEFINE_PROP_ZERO_PAGE_DETECTION("zero-page-detection", MigrationState, parameters.zero_page_detection, ZERO_PAGE_DETECTION_MULTIFD), - - /* Migration capabilities */ - DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), - DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), - DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), - DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), - DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), - DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), - DEFINE_PROP_MIG_CAP("x-postcopy-preempt", - MIGRATION_CAPABILITY_POSTCOPY_PREEMPT), - DEFINE_PROP_MIG_CAP("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-zero-blocks", + MigrationState, parameters.zero_blocks, false), + DEFINE_PROP_BOOL("x-events", + MigrationState, parameters.events, false), + DEFINE_PROP_BOOL("x-postcopy-ram", + MigrationState, parameters.postcopy_ram, false), + DEFINE_PROP_BOOL("x-postcopy-preempt", + MigrationState, parameters.postcopy_preempt, false), + DEFINE_PROP_BOOL("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_BOOL("x-switchover-ack", + MigrationState, parameters.switchover_ack, false), + DEFINE_PROP_BOOL("x-dirty-limit", + MigrationState, parameters.dirty_limit, false), + DEFINE_PROP_BOOL("mapped-ram", + MigrationState, parameters.mapped_ram, false), }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 @@ -285,7 +292,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) @@ -299,144 +306,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(); @@ -481,44 +486,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; @@ -527,34 +494,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; } @@ -562,26 +523,19 @@ bool migrate_rdma_caps_check(bool *caps, Error **errp) return true; } =20 -/** - * @migration_caps_check - check capability compatibility - * - * @old_caps: old capability list - * @new_caps: new capability list - * @errp: set *errp if the check failed, with reason - * - * Returns true if check passed, otherwise false. - */ -bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp) +bool migrate_caps_check(MigrationParameters *new, Error **errp) { - ERRP_GUARD(); + MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); + bool postcopy_already_on =3D s->parameters.postcopy_ram; + ERRP_GUARD(); =20 - if (new_caps[MIGRATION_CAPABILITY_ZERO_BLOCKS]) { + if (new->zero_blocks) { warn_report("zero-blocks capability is deprecated"); } =20 #ifndef CONFIG_REPLICATION - if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { + if (new->x_colo) { error_setg(errp, "QEMU compiled without replication module" " can't enable COLO"); error_append_hint(errp, "Please enable replication before COLO.\n"= ); @@ -589,27 +543,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. @@ -625,41 +579,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; } @@ -671,22 +629,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; @@ -699,21 +657,21 @@ bool migrate_caps_check(bool *old_caps, bool *new_cap= s, Error **errp) } } =20 - if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { - if (new_caps[MIGRATION_CAPABILITY_XBZRLE]) { + if (new->multifd) { + if (new->xbzrle) { error_setg(errp, "Multifd is not compatible with xbzrle"); return false; } } =20 - if (new_caps[MIGRATION_CAPABILITY_MAPPED_RAM]) { - if (new_caps[MIGRATION_CAPABILITY_XBZRLE]) { + if (new->mapped_ram) { + if (new->xbzrle) { error_setg(errp, "Mapped-ram migration is incompatible with xbzrle"); return false; } =20 - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (new->postcopy_ram) { error_setg(errp, "Mapped-ram migration is incompatible with postcopy= "); return false; @@ -724,7 +682,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; @@ -845,39 +803,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 */ @@ -938,9 +894,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) @@ -1373,6 +1328,10 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (!migrate_caps_check(params, errp)) { + return false; + } + return true; } =20 @@ -1435,19 +1394,6 @@ void qmp_migrate_set_parameters(MigrationParameters = *params, Error **errp) tls_opt_to_str(params->tls_hostname); tls_opt_to_str(params->tls_authz); =20 - /* - * FIXME: Temporarily while migrate_caps_check is not - * converted to look at s->parameters. Will be gone the end of - * the series. - */ - bool new_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; - for (int i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - new_caps[i] =3D migrate_capability_get_compat(&s->parameters, i); - } - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { - return; - } - migrate_params_merge(tmp, params); =20 /* diff --git a/migration/options.h b/migration/options.h index 794cf23870..ceb12b0ff0 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 */ @@ -88,8 +76,6 @@ const char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); =20 -/* parameters helpers */ - bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); void migrate_tls_opts_free(MigrationParameters *params); @@ -98,4 +84,5 @@ void migrate_capability_set_compat(MigrationParameters *p= arams, int i, bool val); void migrate_capabilities_set_compat(MigrationParameters *params, MigrationCapabilityStatusList *caps); +bool migrate_caps_check(MigrationParameters *new, Error **errp); #endif diff --git a/migration/savevm.c b/migration/savevm.c index 62cc2ce25c..d61d266902 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -291,7 +291,8 @@ static uint32_t get_validatable_capabilities_count(void) uint32_t result =3D 0; int i; for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->capabilities[i]) { + if (should_validate_capability(i) && + migrate_capability_get_compat(&s->parameters, i)) { result++; } } @@ -313,7 +314,8 @@ static int configuration_pre_save(void *opaque) state->capabilities =3D g_renew(MigrationCapability, state->capabiliti= es, state->caps_count); for (i =3D j =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->capabilities[i]) { + if (should_validate_capability(i) && + migrate_capability_get_compat(&s->parameters, i)) { state->capabilities[j++] =3D i; } } @@ -363,7 +365,7 @@ static bool configuration_validate_capabilities(SaveSta= te *state) continue; } source_state =3D test_bit(i, source_caps_bm); - target_state =3D s->capabilities[i]; + target_state =3D migrate_capability_get_compat(&s->parameters, i); if (source_state !=3D target_state) { error_report("Capability %s is %s, but received capability is = %s", MigrationCapability_str(i), --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836199; cv=none; d=zohomail.com; s=zohoarc; b=A1fwtf52G5olkdws461fRXev/bXQv2nwzhzfqSSaCWAHc9Lrg9tJzQ4bGyTIrr+QQc3kk9Z+4ciVPVe+QBUDXfy+pMEpXyrEnKNsNmUBuHY/vlwmGQ9OhtjlIRD4e/exeuq7V3BiHSTPmxn2mWzd/lfo2E3pYOUKIr1QDDMqD0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836199; 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=OuhQx5/pDZGDURCayIe/N6ZNncQIvyQGjL2IIkfbcH0=; b=HFomrQwcyWFXTJt8pfvlDVBRLbbecHDcFNukb3zzit1o2JTlLOuaOkXugKlhT4kC4Uh1bvWD10eaVhA7VEFFpmbixt4XkxSpn2no70Br4zpGskK+MdfcCNOzq4yodSPJvIjTO6ZI6R+DJF/H9pul3r2kswvHkcXOaaJfxk3bpcg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836199819503.27289599589824; Mon, 15 Dec 2025 14:03:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGeK-0004tl-Gy; Mon, 15 Dec 2025 17:02:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGe9-0004cG-84 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:25 -0500 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 1vVGe5-0002rL-Qr for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:24 -0500 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 1EDE85BDF9; Mon, 15 Dec 2025 22:01: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 1C2BD3EA63; Mon, 15 Dec 2025 22:01:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qEPHM0OFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836102; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuhQx5/pDZGDURCayIe/N6ZNncQIvyQGjL2IIkfbcH0=; b=O62IW4KPr/+zeCHRuzGx8UmpkqheXbKyAX5DqLCwcgxnArSW+8yT1jsuB4i7tjC5IwuP+e a3MA5SwcMorIoZybNzE7td4HK1yy3rjug0iU4PVZuQOx1jHvDHlr04VS2xX9IxsA4Xwdyh o76SgX6UVjbDpZ0RltLvfXgTo+LmrwA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836102; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuhQx5/pDZGDURCayIe/N6ZNncQIvyQGjL2IIkfbcH0=; b=8RPDqKAU0jIYAN3DhcNe4HtRp+jlhGZ9IKn8DjdlH+PiL36tU3lmzlu3FXoTU1Fjsyo27K pMpjJXt6jgD9C7DA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836102; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuhQx5/pDZGDURCayIe/N6ZNncQIvyQGjL2IIkfbcH0=; b=O62IW4KPr/+zeCHRuzGx8UmpkqheXbKyAX5DqLCwcgxnArSW+8yT1jsuB4i7tjC5IwuP+e a3MA5SwcMorIoZybNzE7td4HK1yy3rjug0iU4PVZuQOx1jHvDHlr04VS2xX9IxsA4Xwdyh o76SgX6UVjbDpZ0RltLvfXgTo+LmrwA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836102; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuhQx5/pDZGDURCayIe/N6ZNncQIvyQGjL2IIkfbcH0=; b=8RPDqKAU0jIYAN3DhcNe4HtRp+jlhGZ9IKn8DjdlH+PiL36tU3lmzlu3FXoTU1Fjsyo27K pMpjJXt6jgD9C7DA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , devel@lists.libvirt.org, Eric Blake Subject: [PATCH v3 21/51] qapi/migration: Deprecate capabilities commands Date: Mon, 15 Dec 2025 19:00:07 -0300 Message-ID: <20251215220041.12657-22-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.988]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836201550154100 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 | 10 ++++++++++ migration/migration-hmp-cmds.c | 6 ++++++ qapi/migration.json | 16 ++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ac31a2bce4..1949508efa 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -588,3 +588,13 @@ command documentation for details on the ``fdset`` usa= ge. =20 The ``zero-blocks`` capability was part of the block migration which doesn't exist anymore since it was removed in QEMU v9.1. + +``migrate-set-capabilities`` command (since 10.2) +''''''''''''''''''''''''''''''''''''''''''''''''' + +Use ``migrate-set-parameters`` instead. + +``query-migrate-capabilities`` command (since 10.2) +''''''''''''''''''''''''''''''''''''''''''''''''''' + +Use ``query-migrate-parameters`` instead. diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 28b48c34bf..7e5ac57da5 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -298,6 +298,9 @@ void hmp_info_migrate_capabilities(Monitor *mon, const = QDict *qdict) { MigrationCapabilityStatusList *caps, *cap; =20 + warn_report("info migrate_capabilities is deprecated;" + " use info migrate_parameters instead"); + caps =3D qmp_query_migrate_capabilities(NULL); =20 if (caps) { @@ -705,6 +708,9 @@ void hmp_migrate_set_capability(Monitor *mon, const QDi= ct *qdict) MigrationCapabilityStatus *value; int val; =20 + warn_report("migrate_set_capability is deprecated;" + " use migrate_set_parameter instead"); + val =3D qapi_enum_parse(&MigrationCapability_lookup, cap, -1, &err); if (val < 0) { goto end; diff --git a/qapi/migration.json b/qapi/migration.json index fcbb699a47..76a1e03f2f 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -570,6 +570,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:: @@ -579,13 +584,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:: @@ -601,7 +612,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.51.0 From nobody Mon Feb 9 04:32:46 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=1765836328; cv=none; d=zohomail.com; s=zohoarc; b=SMQvgoRzK82FljBKHSEwlaGtjUmSmhdoCH+8W8jonKK2HW7WGjduzzJDfh+4LAKAvJKz810665/OG5+jMR6fYh8DWFxX2qY39WM3DCN71nDoCv1ivnhk88ZthKTMsskpPYVopjl7J1dhaxafbB6bFjTxfoJTjylicgfasaXcAnQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836328; 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=gUsESkiBYJnoJz6SpMr59J6WRnxFY4FVJgC6WV2y+mI=; b=Xy8x+IX5rSn7tUWLoavptfs+JuO/k1EwTZsDi1ml5sHnzRzpmW7jgp+YdjwOMJ9aMVbsoaHYmzxwoIja7pX5GdYXulJfeuB1/Xw/mrBhz2sFJ2Z+8JXG9QUUw8166C7Zr2H1b0web8bLFZZORmvuem/kPEVnUYdW35Q2PY8vXak= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176583632869380.15109037453192; Mon, 15 Dec 2025 14:05:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdd-0002rn-ME; Mon, 15 Dec 2025 17:01:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdc-0002rJ-04 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:52 -0500 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 1vVGda-0002j2-1F for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:51 -0500 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 3A83833779; Mon, 15 Dec 2025 22:01: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 AB4693EA63; Mon, 15 Dec 2025 22:01:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8KsgG0aFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836104; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gUsESkiBYJnoJz6SpMr59J6WRnxFY4FVJgC6WV2y+mI=; b=i8yQhwy55NUW9g/m2XR0XPu7neOdHyhjlOrLSW6Wj2EjaBoU7wuC4/5xhWmlk40bsHmmtD pFHDEUwQ3ZmxyioJZjL82wIHQ89i6tSzhULFGohiRy5aP9wO2bext7O6y3Fat20bAcvyHI m+WiL707BWiC7x++8CDTOyDSErcAJUw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836104; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gUsESkiBYJnoJz6SpMr59J6WRnxFY4FVJgC6WV2y+mI=; b=2vpC/rwPptAhq9lbvX7CwmqXg4fi/eHl9rzWh+5/Eya46SuSvWGP+9QgRVRR3fWntBvFCL Bw4Q5KA3EhidNtCQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836104; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gUsESkiBYJnoJz6SpMr59J6WRnxFY4FVJgC6WV2y+mI=; b=i8yQhwy55NUW9g/m2XR0XPu7neOdHyhjlOrLSW6Wj2EjaBoU7wuC4/5xhWmlk40bsHmmtD pFHDEUwQ3ZmxyioJZjL82wIHQ89i6tSzhULFGohiRy5aP9wO2bext7O6y3Fat20bAcvyHI m+WiL707BWiC7x++8CDTOyDSErcAJUw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836104; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gUsESkiBYJnoJz6SpMr59J6WRnxFY4FVJgC6WV2y+mI=; b=2vpC/rwPptAhq9lbvX7CwmqXg4fi/eHl9rzWh+5/Eya46SuSvWGP+9QgRVRR3fWntBvFCL Bw4Q5KA3EhidNtCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu Subject: [PATCH v3 22/51] migration: Store the initial values used for s->parameters Date: Mon, 15 Dec 2025 19:00:08 -0300 Message-ID: <20251215220041.12657-23-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.986]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836331277154100 Content-Type: text/plain; charset="utf-8" Each migration parameter has a default value, store them for later use in resetting s->parameters. Values overridden via the command line with the debugging option -global migration. will be included. Make the structure const and change the appropriate signatures to make sure its values are not changed by accident. Some functions take two MigrationParameters pointers and it's easy to confuse them. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 3 +++ migration/migration.h | 6 ++++++ migration/options.c | 21 +++++++++++++++++---- migration/options.h | 7 ++++--- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 182dccd579..90b381b1fe 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -331,6 +331,7 @@ void migration_object_init(void) current_incoming->exit_on_error =3D INMIGRATE_DEFAULT_EXIT_ON_ERROR; =20 migration_object_check(current_migration, &error_fatal); + migrate_params_store_defaults(current_migration); =20 ram_mig_init(); dirty_bitmap_mig_init(); @@ -4149,6 +4150,8 @@ static void migration_instance_finalize(Object *obj) =20 qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_map= ping); qapi_free_strList(ms->parameters.cpr_exec_command); + /* drop const */ + qapi_free_MigrationParameters((MigrationParameters *)ms->initial_param= s); qemu_mutex_destroy(&ms->error_mutex); qemu_mutex_destroy(&ms->qemu_file_lock); qemu_sem_destroy(&ms->wait_unplug_sem); diff --git a/migration/migration.h b/migration/migration.h index 5fe5f8a23e..a4b5dbb09b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -320,6 +320,12 @@ struct MigrationState { =20 /* params from 'migrate-set-parameters' */ MigrationParameters parameters; + /* + * This holds the values initially set in the 'parameters' struct + * above. Any values overriden by -global migration. + * will be reflected here as well. + */ + const MigrationParameters *initial_params; =20 MigrationStatus state; =20 diff --git a/migration/options.c b/migration/options.c index d3bb65513b..d1d8e5c181 100644 --- a/migration/options.c +++ b/migration/options.c @@ -505,7 +505,7 @@ bool migrate_can_snapshot(Error **errp) return true; } =20 -bool migrate_rdma_caps_check(MigrationParameters *params, Error **errp) +bool migrate_rdma_caps_check(const MigrationParameters *params, Error **er= rp) { if (params->xbzrle) { error_setg(errp, "RDMA and XBZRLE can't be used together"); @@ -523,7 +523,7 @@ bool migrate_rdma_caps_check(MigrationParameters *param= s, Error **errp) return true; } =20 -bool migrate_caps_check(MigrationParameters *new, Error **errp) +bool migrate_caps_check(const MigrationParameters *new, Error **errp) { MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); @@ -1182,7 +1182,7 @@ static void migrate_post_update_params(MigrationParam= eters *new, Error **errp) * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. */ -bool migrate_params_check(MigrationParameters *params, Error **errp) +bool migrate_params_check(const MigrationParameters *params, Error **errp) { ERRP_GUARD(); =20 @@ -1363,7 +1363,7 @@ static void migrate_params_merge(MigrationParameters = *dst, * Caller must ensure all has_* fields of @params are true to ensure * all fields get copied and the pointer members don't dangle. */ -static void migrate_params_apply(MigrationParameters *params) +static void migrate_params_apply(const MigrationParameters *params) { MigrationState *s =3D migrate_get_current(); MigrationParameters *cur =3D &s->parameters; @@ -1376,6 +1376,19 @@ static void migrate_params_apply(MigrationParameters= *params) QAPI_CLONE_MEMBERS(MigrationParameters, cur, params); } =20 +void migrate_params_store_defaults(MigrationState *s) +{ + assert(!s->initial_params); + + /* + * The defaults set for each qdev property in migration_properties + * will be stored as the default values for each migration + * parameter. For debugging, using -global can override the + * defaults. + */ + s->initial_params =3D QAPI_CLONE(MigrationParameters, &s->parameters); +} + void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index ceb12b0ff0..47f84bf180 100644 --- a/migration/options.h +++ b/migration/options.h @@ -46,7 +46,7 @@ bool migrate_postcopy(void); bool migrate_rdma(void); bool migrate_tls(void); =20 -bool migrate_rdma_caps_check(MigrationParameters *config, Error **errp); +bool migrate_rdma_caps_check(const MigrationParameters *config, Error **er= rp); bool migrate_can_snapshot(Error **errp); =20 /* parameters */ @@ -76,7 +76,7 @@ const char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); =20 -bool migrate_params_check(MigrationParameters *params, Error **errp); +bool migrate_params_check(const MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); void migrate_tls_opts_free(MigrationParameters *params); bool migrate_capability_get_compat(MigrationParameters *params, int i); @@ -84,5 +84,6 @@ void migrate_capability_set_compat(MigrationParameters *p= arams, int i, bool val); void migrate_capabilities_set_compat(MigrationParameters *params, MigrationCapabilityStatusList *caps); -bool migrate_caps_check(MigrationParameters *new, Error **errp); +bool migrate_caps_check(const MigrationParameters *const new, Error **errp= ); +void migrate_params_store_defaults(MigrationState *s); #endif --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836194; cv=none; d=zohomail.com; s=zohoarc; b=e2UfpEWynA89tH1Iylj6XFEPD2FfJTU1k47BFsFibx7XYvQUiIAKXMBXLnSLE3JaF92p1Bn3TZhCkivyoKVs9fv774901Y9SmFbqyBSnxmARdWhXpAd+p8WzljD0Vq43H62ZjxiiOrF40HlmHUWpDkgdm1hZiVBQvXw8MyZIEwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836194; 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=yETfNAilT25BcWaBM8mdKvqxVx/YTqV9EQ8Ncz8MsIA=; b=fWZ1xZT13ydoJnrnRWGyJSzUvmILKX/IfwfThPri4eWzYt4wXwVRlSIKU+L/YhQScIoUPTUgPBo2mPAXlSyToN5htFjC31oYIwE+5z7M/coeD5yjwryKvcRvmQcX40/HmuquGDYt9V8HUcgkWC4TH+aknFLIVyDCjCCpIhcibgk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836194099661.966498959199; Mon, 15 Dec 2025 14:03:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGec-0005en-D9; Mon, 15 Dec 2025 17:02:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGeI-00050q-Qs for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:36 -0500 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 1vVGeD-0002tF-BG for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:33 -0500 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 DC11B5BE04; Mon, 15 Dec 2025 22:01: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 CD7C13EA63; Mon, 15 Dec 2025 22:01: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 eElXI0iFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yETfNAilT25BcWaBM8mdKvqxVx/YTqV9EQ8Ncz8MsIA=; b=gGnE6wQq7THSMnFCQLb5NncJsh76vczMTOqpNyj7bXjp2nSc6y1GRE5+q5QE0yi2Iu38fl 2AX4nDK3XIT4UW1NqeShV0okc2iWnDSnwvyh0QWd3uR968sfpqxkn7hAMp6YtvytQZ7bM2 sQDWCUktey8p/A0UE8nLKfoyxgp41bc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yETfNAilT25BcWaBM8mdKvqxVx/YTqV9EQ8Ncz8MsIA=; b=IZk2K6vMGl68Y4mjeT2T7Kj3wm67DUjDGZ+LSG2uEjxwewi8v9xBiZUH4IakTr3xa7wPnt eV4cN1t/15X3WPDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yETfNAilT25BcWaBM8mdKvqxVx/YTqV9EQ8Ncz8MsIA=; b=gGnE6wQq7THSMnFCQLb5NncJsh76vczMTOqpNyj7bXjp2nSc6y1GRE5+q5QE0yi2Iu38fl 2AX4nDK3XIT4UW1NqeShV0okc2iWnDSnwvyh0QWd3uR968sfpqxkn7hAMp6YtvytQZ7bM2 sQDWCUktey8p/A0UE8nLKfoyxgp41bc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yETfNAilT25BcWaBM8mdKvqxVx/YTqV9EQ8Ncz8MsIA=; b=IZk2K6vMGl68Y4mjeT2T7Kj3wm67DUjDGZ+LSG2uEjxwewi8v9xBiZUH4IakTr3xa7wPnt eV4cN1t/15X3WPDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Eric Blake , Paolo Bonzini Subject: [PATCH v3 23/51] migration: Allow migrate commands to provide the migration config Date: Mon, 15 Dec 2025 19:00:09 -0300 Message-ID: <20251215220041.12657-24-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64: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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836195253154100 Content-Type: text/plain; charset="utf-8" Allow the migrate and migrate_incoming commands to pass the migration configuration options all at once, dispensing the use of migrate-set-parameters and migrate-set-capabilities. The motivation of this is to simplify the interface with the management layer and avoid the usage of several command invocations to configure a migration. It also avoids stale parameters from a previous migration to influence the current migration. The options that are changed during the migration can still be set with the existing commands. The order of precedence is: 'config' argument > migrate-set-parameters > -global migration cmdline > defaults (migration_properties) I.e. the config takes precedence over all, values not present in the config assume the default values. The -global migration command line option allows the defaults to be overridden for debug. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 5 +++-- migration/migration.c | 28 +++++++++++++++++++++++++--- migration/options.c | 19 +++++++++++++++++++ migration/options.h | 4 +++- qapi/migration.json | 10 ++++++++++ system/vl.c | 3 ++- 6 files changed, 62 insertions(+), 7 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 7e5ac57da5..e9c3541352 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -672,7 +672,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qd= ict) } QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); =20 - qmp_migrate_incoming(NULL, true, caps, true, false, &err); + qmp_migrate_incoming(NULL, true, caps, NULL, true, false, &err); qapi_free_MigrationChannelList(caps); =20 end: @@ -1070,7 +1070,8 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) } QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); =20 - qmp_migrate(NULL, true, caps, false, false, true, resume, &err); + qmp_migrate(NULL, true, caps, NULL, false, false, true, resume, + &err); if (hmp_handle_error(mon, err)) { return; } diff --git a/migration/migration.c b/migration/migration.c index 90b381b1fe..d23ab2905a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1930,13 +1930,24 @@ void migrate_del_blocker(Error **reasonp) =20 void qmp_migrate_incoming(const char *uri, bool has_channels, MigrationChannelList *channels, - bool has_exit_on_error, bool exit_on_error, - Error **errp) + MigrationParameters *config, bool has_exit_on_er= ror, + bool exit_on_error, Error **errp) { Error *local_err =3D NULL; static bool once =3D true; + MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 + if (config) { + /* + * If a config was provided, all options set previously by + * migrate-set-parameters get ignored. + */ + if (!migrate_params_override(s, config, errp)) { + return; + } + } + if (!once) { error_setg(errp, "The incoming migration has already been started"= ); return; @@ -2208,7 +2219,8 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, } =20 void qmp_migrate(const char *uri, bool has_channels, - MigrationChannelList *channels, bool has_detach, bool det= ach, + MigrationChannelList *channels, + bool has_detach, bool detach, MigrationParameters *config, bool has_resume, bool resume, Error **errp) { bool resume_requested; @@ -2219,6 +2231,16 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; MigrationChannel *cpr_channel =3D NULL; =20 + if (config) { + /* + * If a config was provided, all options set previously by + * migrate-set-parameters get ignored. + */ + if (!migrate_params_override(s, config, errp)) { + return; + } + } + /* * Having preliminary checks for uri and channel */ diff --git a/migration/options.c b/migration/options.c index d1d8e5c181..ccc25ad008 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1389,6 +1389,25 @@ void migrate_params_store_defaults(MigrationState *s) s->initial_params =3D QAPI_CLONE(MigrationParameters, &s->parameters); } =20 +bool migrate_params_override(MigrationState *s, MigrationParameters *new, + Error **errp) +{ + ERRP_GUARD(); + + assert(bql_locked()); + + /* reset to initial parameters */ + migrate_params_apply(s->initial_params); + + /* apply the new ones on top */ + qmp_migrate_set_parameters(new, errp); + if (*errp) { + return false; + } + + return true; +} + void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 47f84bf180..29dee6f444 100644 --- a/migration/options.h +++ b/migration/options.h @@ -84,6 +84,8 @@ void migrate_capability_set_compat(MigrationParameters *p= arams, int i, bool val); void migrate_capabilities_set_compat(MigrationParameters *params, MigrationCapabilityStatusList *caps); -bool migrate_caps_check(const MigrationParameters *const new, Error **errp= ); +bool migrate_caps_check(const MigrationParameters *new, Error **errp); void migrate_params_store_defaults(MigrationState *s); +bool migrate_params_override(MigrationState *s, MigrationParameters *new, + Error **errp); #endif diff --git a/qapi/migration.json b/qapi/migration.json index 76a1e03f2f..bd799d67e4 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1546,6 +1546,10 @@ # will fail unless migration is in "postcopy-paused" state. # (default: false, since 3.0) # +# @config: migration configuration options. When present, any +# migration configuration previously set with +# @migrate-set-parameters is ignored. (since 11.0) +# # Features: # # @deprecated: Argument @detach is deprecated. @@ -1610,6 +1614,7 @@ 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], '*detach': { 'type': 'bool', 'features': [ 'deprecated' ] }, + '*config': 'MigrationParameters', '*resume': 'bool' } } =20 ## @@ -1629,6 +1634,10 @@ # :qapi:event:`MIGRATION` event, and error details could be # retrieved with `query-migrate`. (since 9.1) # +# @config: migration configuration options. When present, any +# migration configuration previously set with +# @migrate-set-parameters is ignored. (since 11.0) +# # Since: 2.3 # # .. admonition:: Notes @@ -1682,6 +1691,7 @@ { 'command': 'migrate-incoming', 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], + '*config': 'MigrationParameters', '*exit-on-error': 'bool' } } =20 ## diff --git a/system/vl.c b/system/vl.c index 5091fe52d9..d09dc9a61c 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2829,7 +2829,8 @@ void qmp_x_exit_preconfig(Error **errp) g_new0(MigrationChannelList, 1); =20 channels->value =3D incoming_channels[MIGRATION_CHANNEL_TYPE_M= AIN]; - qmp_migrate_incoming(NULL, true, channels, true, true, &local_= err); + qmp_migrate_incoming(NULL, true, channels, NULL, true, true, + &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836168; cv=none; d=zohomail.com; s=zohoarc; b=ZXH9HzZY/VW9T0jmHEmsLMI6QD3H/tq3qxvtrJAagaaKcqWNUjPJL1nMBZNMijFiVSqNqCeP5eoCUl2SXob0MuMUA8Bt42isULdBJpqfyoL+v7KmG1u0wQcUD3R1IIbr9QpE8Me2hjanWMWIRyCucLPKqRhGUqJQ+e45fjLX2/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836168; 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=nirVhd/ypAIBn1vzHwwG9vsWjnc9mkc05nhW4x74y4w=; b=NvXOaXHjbgAR2oJqnke9ILrDOBGtWTObTqZPRtEa9Jwxr0QQSUnnm4KXXGJIQkvrJ6YBOIOVO3qZObR2Ee8I2SRl+TfrThLBAmT+tEGwwJ2Pq4lqLRfLIrtlacXbiLUXA9YV+LCLERmi4PaJLyo6eIgXjd4tqcH8pwOnrZo26Zk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836167968481.2120885039094; Mon, 15 Dec 2025 14:02:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdi-000368-N1; Mon, 15 Dec 2025 17:01:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdh-0002tj-0v for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:57 -0500 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 1vVGdf-0002kh-21 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:01:56 -0500 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 25E0E33748; Mon, 15 Dec 2025 22:01:49 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5E1993EA63; Mon, 15 Dec 2025 22:01:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UO4xCEuFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836109; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nirVhd/ypAIBn1vzHwwG9vsWjnc9mkc05nhW4x74y4w=; b=LD4mksMmvDMdTXQSZgUomhg9AViUA9DwhgfsHK5LUFYNBQzEeTK1AtCJoDS/ufNhEdXIDs 1lVWaMANeBRmRAZ3lpjycEPWFbfTYi6QSSJpTY19SStRxJrmkZBxdyCkPpyRSEckiTD/IL DJd/mtFfltgcB5Xf4K3sdOVBHlGzox4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836109; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nirVhd/ypAIBn1vzHwwG9vsWjnc9mkc05nhW4x74y4w=; b=sLds6KTmemnJaC/KVBFptk/l3B7BrT6dc/utJ09vxWnEPzY1P2e6oBD1Ubofn42+pS2RkW NEHcsMvZvDnQc8CQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836109; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nirVhd/ypAIBn1vzHwwG9vsWjnc9mkc05nhW4x74y4w=; b=LD4mksMmvDMdTXQSZgUomhg9AViUA9DwhgfsHK5LUFYNBQzEeTK1AtCJoDS/ufNhEdXIDs 1lVWaMANeBRmRAZ3lpjycEPWFbfTYi6QSSJpTY19SStRxJrmkZBxdyCkPpyRSEckiTD/IL DJd/mtFfltgcB5Xf4K3sdOVBHlGzox4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836109; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nirVhd/ypAIBn1vzHwwG9vsWjnc9mkc05nhW4x74y4w=; b=sLds6KTmemnJaC/KVBFptk/l3B7BrT6dc/utJ09vxWnEPzY1P2e6oBD1Ubofn42+pS2RkW NEHcsMvZvDnQc8CQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Paolo Bonzini Subject: [PATCH v3 24/51] migration: Allow incoming cmdline to take config Date: Mon, 15 Dec 2025 19:00:10 -0300 Message-ID: <20251215220041.12657-25-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.990]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836171008154100 Content-Type: text/plain; charset="utf-8" When -incoming "defer" is not used, the incoming migration is invoked directly by the command line parsing code in vl.c. Allow the migration config to be passed via the -incoming command line option so that invocation of qmp_migrate_incoming() can receive it. E.g. -incoming '{"tls-creds": "tlscredsx509server0", "tls-hostname": "qemu.org"}' Signed-off-by: Fabiano Rosas --- This is useful for the tests. If we want to declare that config-passing only works with -incoming defer, that's fine with me. --- system/vl.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 100 insertions(+), 12 deletions(-) diff --git a/system/vl.c b/system/vl.c index d09dc9a61c..ac44933a11 100644 --- a/system/vl.c +++ b/system/vl.c @@ -169,6 +169,9 @@ static const char *mem_path; static const char *incoming; static const char *incoming_str[MIGRATION_CHANNEL_TYPE__MAX]; static MigrationChannel *incoming_channels[MIGRATION_CHANNEL_TYPE__MAX]; +static MigrationParameters *migration_config; +static Error *migration_channel_err; +static Error *migration_config_err; static const char *loadvm; static const char *accelerators; static bool have_custom_ram_size; @@ -1825,28 +1828,102 @@ static void object_option_add_visitor(Visitor *v) QTAILQ_INSERT_TAIL(&object_opts, opt, next); } =20 -static void incoming_option_parse(const char *str) +/* + * Either "defer" or a proper uri, whether plain string or a json + * representation of MigrationChannel. + */ +static bool incoming_option_parse_channels(const char *str, Error **errp) { MigrationChannelType type =3D MIGRATION_CHANNEL_TYPE_MAIN; - MigrationChannel *channel; + MigrationChannel *channel =3D NULL; Visitor *v; =20 - if (!strcmp(str, "defer")) { - channel =3D NULL; - } else if (migrate_is_uri(str)) { + if (g_str_equal(str, "defer")) { + incoming_str[type] =3D str; + return true; + } + + if (migrate_is_uri(str)) { migrate_uri_parse(str, &channel, &error_fatal); } else { v =3D qobject_input_visitor_new_str(str, "channel-type", &error_fa= tal); - visit_type_MigrationChannel(v, NULL, &channel, &error_fatal); + if (v && !visit_type_MigrationChannel(v, NULL, &channel, errp)) { + visit_free(v); + return false; + } visit_free(v); + } + + if (channel) { type =3D channel->channel_type; + /* New incoming spec replaces the previous */ + qapi_free_MigrationChannel(incoming_channels[type]); + incoming_channels[type] =3D channel; + incoming_str[type] =3D str; } =20 - /* New incoming spec replaces the previous */ - qapi_free_MigrationChannel(incoming_channels[type]); - incoming_channels[type] =3D channel; - incoming_str[type] =3D str; incoming =3D incoming_str[MIGRATION_CHANNEL_TYPE_MAIN]; + return true; +} + +/* + * The migration configuration object in JSON form. + */ +static bool incoming_option_parse_config(const char *str, Error **errp) +{ + MigrationParameters *config =3D NULL; + Visitor *v; + + v =3D qobject_input_visitor_new_str(str, "config", &error_fatal); + if (v && !visit_type_MigrationParameters(v, NULL, &config, errp)) { + visit_free(v); + return false; + } + + if (config) { + /* later incoming configs replace the previous ones */ + migration_config =3D config; + } + + visit_free(v); + return true; +} + +static void incoming_option_parse(const char *str) +{ + /* + * Independent Error objects because we don't know whether the + * input is meant to be the channels or the config. The parsing + * may fail for one and succeed for the other. + */ + g_autoptr(Error) channel_err =3D NULL; + g_autoptr(Error) config_err =3D NULL; + + /* + * Skip if there's already an error for a previous -incoming + * instance. + */ + if (migration_channel_err || migration_config_err) { + return; + } + + if (!migration_channel_err && + incoming_option_parse_channels(str, &channel_err)) { + return; + } + + if (!migration_config_err && + incoming_option_parse_config(str, &config_err)) { + return; + } + + if (channel_err) { + migration_channel_err =3D error_copy(channel_err); + error_prepend(&migration_channel_err, "-incoming %s: ", str); + } else if (config_err) { + migration_config_err =3D error_copy(config_err); + error_prepend(&migration_config_err, "-incoming %s: ", str); + } } =20 static void object_option_parse(const char *str) @@ -2537,6 +2614,16 @@ static void qemu_validate_options(const QDict *machi= ne_opts) exit(EXIT_FAILURE); } =20 + if (migration_channel_err && !incoming) { + error_report_err(migration_config_err); + exit(EXIT_FAILURE); + } + + if (migration_config_err && !migration_config) { + error_report_err(migration_config_err); + exit(EXIT_FAILURE); + } + #ifdef CONFIG_CURSES if (is_daemonized() && dpy.type =3D=3D DISPLAY_TYPE_CURSES) { error_report("curses display cannot be used with -daemonize"); @@ -2824,13 +2911,14 @@ void qmp_x_exit_preconfig(Error **errp) =20 if (incoming) { Error *local_err =3D NULL; + if (strcmp(incoming, "defer") !=3D 0) { g_autofree MigrationChannelList *channels =3D g_new0(MigrationChannelList, 1); =20 channels->value =3D incoming_channels[MIGRATION_CHANNEL_TYPE_M= AIN]; - qmp_migrate_incoming(NULL, true, channels, NULL, true, true, - &local_err); + qmp_migrate_incoming(NULL, true, channels, migration_config, t= rue, + true, &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836166; cv=none; d=zohomail.com; s=zohoarc; b=jeT6toFvmmp39psEF5dqwYqdPx4cFeg+Hnx7G+7iGmAhXIMCm4fHwfGiGspPHP9MGxgk+hh/EDL2YPTr3cBmk24uNjc2nyqcDHcN4pNSU7Jr4nO3lY6pLW0CSZuRbLnjYPOBO1zNoEQfgFSojtXHZ9TNRRPMOnJvkfACRZQecRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836166; 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=iLkti5HK8cPBvGiKTNRMV7ZzLL4wmNalm3Ux1Q8dj1c=; b=f9Tbuae9sokqblBRdXCc1+E326dv8rQsqdbKyGy0ucpXXz1CPiySubvjy7n1D2OX662B1Ww2mMAj6sMOni8Pc1lNaIdzha9n9lrW/n4XLBfEMmiriRyhdPbd0quS7UYqxhp/ke2txzKTztiF/cwCnwMrivMGA2XMYdo164zEVa0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836166260290.36721009316466; Mon, 15 Dec 2025 14:02:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdt-00044Q-6K; Mon, 15 Dec 2025 17:02:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdq-0003ue-2E for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:06 -0500 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 1vVGdk-0002nS-AQ for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:05 -0500 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 DC5E933742; Mon, 15 Dec 2025 22:01:51 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D07D73EA63; Mon, 15 Dec 2025 22:01:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UBGZI02FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iLkti5HK8cPBvGiKTNRMV7ZzLL4wmNalm3Ux1Q8dj1c=; b=b5lJUskbPg8iNiRE9JUsxGe4G1OfO+PqgMHIb/+rgRHl/R/IdDCmJbMEGNGX65ID9din64 WLgDm9jPgw/N/siZZXpZi0Ii+bIVKS1S2YLLxeHH582tIQ1PVt+4hNuINplmg5uoGomHpu 9gwoaznnHODhP3HW0x8h2+Yy2pPdx0Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iLkti5HK8cPBvGiKTNRMV7ZzLL4wmNalm3Ux1Q8dj1c=; b=YPMgwqkNLG0KAS743JGW1jluYPPGlWktn14hx8OooRcc7reY+t87EyvY1bkGVZGALUPURi uvn8kV4NZuUSIEBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iLkti5HK8cPBvGiKTNRMV7ZzLL4wmNalm3Ux1Q8dj1c=; b=b5lJUskbPg8iNiRE9JUsxGe4G1OfO+PqgMHIb/+rgRHl/R/IdDCmJbMEGNGX65ID9din64 WLgDm9jPgw/N/siZZXpZi0Ii+bIVKS1S2YLLxeHH582tIQ1PVt+4hNuINplmg5uoGomHpu 9gwoaznnHODhP3HW0x8h2+Yy2pPdx0Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iLkti5HK8cPBvGiKTNRMV7ZzLL4wmNalm3Ux1Q8dj1c=; b=YPMgwqkNLG0KAS743JGW1jluYPPGlWktn14hx8OooRcc7reY+t87EyvY1bkGVZGALUPURi uvn8kV4NZuUSIEBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 25/51] tests/qtest/migration: Pass MigrateCommon into test functions Date: Mon, 15 Dec 2025 19:00:11 -0300 Message-ID: <20251215220041.12657-26-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.989]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836169846154100 Content-Type: text/plain; charset="utf-8" With the upcoming addition of the config QDict, the tests will need a better way of managing the memory of the test data than putting the test arguments on the stack of the test functions. The config QDict will need to be merged into the arguments of migrate_qmp* functions, which causes a refcount increment, so the test functions would need to allocate and deref the config QDict themselves. A better approach is to already pass the arguments into the test functions and do the memory management in the existing wrapper. There is already migration_test_destroy(), which is called for every test. Do the following: - merge the two existing wrappers, migration_test_wrapper() and migration_test_wrapper_full(). The latter was pioneer in passing data into the tests, but now all tests will receive data, so we don't need it anymore. The usage of migration_test_wrapper_full() was in passing a slightly different test name string into the cancel tests, so still keep the migration_test_add_suffix() function. - add (char *name, MigrateCommon *args) to the signature of all test functions. - alter any code to stop allocating args on the stack and instead use the object that came as parameter. - pass args around as needed. - while here, order args (MigrateCommon) before args->start (MigrateStart) and put a blank like in between. No functional change. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/compression-tests.c | 127 +++--- tests/qtest/migration/cpr-tests.c | 71 ++-- tests/qtest/migration/file-tests.c | 184 ++++---- tests/qtest/migration/migration-util.c | 26 +- tests/qtest/migration/migration-util.h | 8 +- tests/qtest/migration/misc-tests.c | 108 ++--- tests/qtest/migration/postcopy-tests.c | 80 ++-- tests/qtest/migration/precopy-tests.c | 354 +++++++--------- tests/qtest/migration/tls-tests.c | 485 ++++++++++------------ 9 files changed, 642 insertions(+), 801 deletions(-) diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index b827665b8e..845e622cd5 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -31,30 +31,25 @@ migrate_hook_start_precopy_tcp_multifd_zstd(QTestState = *from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "zstd"); } =20 -static void test_multifd_tcp_zstd(void) +static void test_multifd_tcp_zstd(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_postcopy_tcp_zstd(void) +static void test_multifd_postcopy_tcp_zstd(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, - }; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, =20 - test_precopy_common(&args); + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; + + test_precopy_common(args); } #endif /* CONFIG_ZSTD */ =20 @@ -69,16 +64,14 @@ migrate_hook_start_precopy_tcp_multifd_qatzip(QTestStat= e *from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "qatzip= "); } =20 -static void test_multifd_tcp_qatzip(void) +static void test_multifd_tcp_qatzip(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_qatzip, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qatzip; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } #endif =20 @@ -90,16 +83,14 @@ migrate_hook_start_precopy_tcp_multifd_qpl(QTestState *= from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "qpl"); } =20 -static void test_multifd_tcp_qpl(void) +static void test_multifd_tcp_qpl(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_qpl, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qpl; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } #endif /* CONFIG_QPL */ =20 @@ -111,16 +102,14 @@ migrate_hook_start_precopy_tcp_multifd_uadk(QTestStat= e *from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "uadk"); } =20 -static void test_multifd_tcp_uadk(void) +static void test_multifd_tcp_uadk(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_uadk, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_uadk; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } #endif /* CONFIG_UADK */ =20 @@ -132,25 +121,23 @@ migrate_hook_start_xbzrle(QTestState *from, return NULL; } =20 -static void test_precopy_unix_xbzrle(void) +static void test_precopy_unix_xbzrle(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D uri, - .start_hook =3D migrate_hook_start_xbzrle, - .iterations =3D 2, - .start =3D { - .caps[MIGRATION_CAPABILITY_XBZRLE] =3D true, - }, - /* - * XBZRLE needs pages to be modified when doing the 2nd+ round - * iteration to have real data pushed to the stream. - */ - .live =3D true, - }; =20 - test_precopy_common(&args); + args->connect_uri =3D uri; + args->listen_uri =3D uri; + args->start_hook =3D migrate_hook_start_xbzrle; + args->iterations =3D 2; + /* + * XBZRLE needs pages to be modified when doing the 2nd+ round + * iteration to have real data pushed to the stream. + */ + args->live =3D true; + + args->start.caps[MIGRATION_CAPABILITY_XBZRLE] =3D true; + + test_precopy_common(args); } =20 static void * @@ -167,16 +154,14 @@ migrate_hook_start_precopy_tcp_multifd_zlib(QTestStat= e *from, return migrate_hook_start_precopy_tcp_multifd_common(from, to, "zlib"); } =20 -static void test_multifd_tcp_zlib(void) +static void test_multifd_tcp_zlib(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zlib, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zlib; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 static void migration_test_add_compression_smoke(MigrationTestEnv *env) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 2a186c6f35..0d97b5b89f 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -27,21 +27,19 @@ static void *migrate_hook_start_mode_reboot(QTestState = *from, QTestState *to) return NULL; } =20 -static void test_mode_reboot(void) +static void test_mode_reboot(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .start.mem_type =3D MEM_TYPE_SHMEM, - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_mode_reboot, - .start =3D { - .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, - }, - }; =20 - test_file_common(&args, true); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_mode_reboot; + + args->start.mem_type =3D MEM_TYPE_SHMEM; + args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true; + + test_file_common(args, true); } =20 static void *test_mode_transfer_start(QTestState *from, QTestState *to) @@ -55,7 +53,7 @@ static void *test_mode_transfer_start(QTestState *from, Q= TestState *to) * migration, and cannot connect synchronously to the monitor, so defer * the target connection. */ -static void test_mode_transfer_common(bool incoming_defer) +static void test_mode_transfer_common(MigrateCommon *args, bool incoming_d= efer) { g_autofree char *cpr_path =3D g_strdup_printf("%s/cpr.sock", tmpfs); g_autofree char *mig_path =3D g_strdup_printf("%s/migsocket", tmpfs); @@ -85,31 +83,31 @@ static void test_mode_transfer_common(bool incoming_def= er) opts_target =3D g_strdup_printf("-incoming cpr,addr.transport=3Dsocket= ," "addr.type=3Dfd,addr.str=3D%d %s", cpr_sockfd, opts); - MigrateCommon args =3D { - .start.opts_source =3D opts, - .start.opts_target =3D opts_target, - .start.defer_target_connect =3D true, - .start.mem_type =3D MEM_TYPE_MEMFD, - .listen_uri =3D incoming_defer ? "defer" : uri, - .connect_channels =3D connect_channels, - .cpr_channel =3D cpr_channel, - .start_hook =3D test_mode_transfer_start, - }; =20 - if (test_precopy_common(&args) < 0) { + args->listen_uri =3D incoming_defer ? "defer" : uri; + args->connect_channels =3D connect_channels; + args->cpr_channel =3D cpr_channel; + args->start_hook =3D test_mode_transfer_start; + + args->start.opts_source =3D opts; + args->start.opts_target =3D opts_target; + args->start.defer_target_connect =3D true; + args->start.mem_type =3D MEM_TYPE_MEMFD; + + if (test_precopy_common(args) < 0) { close(cpr_sockfd); unlink(cpr_path); } } =20 -static void test_mode_transfer(void) +static void test_mode_transfer(char *name, MigrateCommon *args) { - test_mode_transfer_common(NULL); + test_mode_transfer_common(args, false); } =20 -static void test_mode_transfer_defer(void) +static void test_mode_transfer_defer(char *name, MigrateCommon *args) { - test_mode_transfer_common(true); + test_mode_transfer_common(args, true); } =20 static void set_cpr_exec_args(QTestState *who, MigrateCommon *args) @@ -225,22 +223,21 @@ static void *test_mode_exec_start(QTestState *from, Q= TestState *to) return NULL; } =20 -static void test_mode_exec(void) +static void test_mode_exec(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); g_autofree char *listen_uri =3D g_strdup_printf("defer"); =20 - MigrateCommon args =3D { - .start.only_source =3D true, - .start.opts_source =3D "-machine aux-ram-share=3Don -nodefaults", - .start.mem_type =3D MEM_TYPE_MEMFD, - .connect_uri =3D uri, - .listen_uri =3D listen_uri, - .start_hook =3D test_mode_exec_start, - }; + args->connect_uri =3D uri; + args->listen_uri =3D listen_uri; + args->start_hook =3D test_mode_exec_start; =20 - test_cpr_exec(&args); + args->start.only_source =3D true; + args->start.opts_source =3D "-machine aux-ram-share=3Don -nodefaults"; + args->start.mem_type =3D MEM_TYPE_MEMFD; + + test_cpr_exec(args); } =20 void migration_test_add_cpr(MigrationTestEnv *env) diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/fil= e-tests.c index 4d78ce0855..5f1159076c 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -20,16 +20,14 @@ =20 static char *tmpfs; =20 -static void test_precopy_file(void) +static void test_precopy_file(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - }; + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; =20 - test_file_common(&args, true); + test_file_common(args, true); } =20 #ifndef _WIN32 @@ -66,107 +64,94 @@ static void *migrate_hook_start_file_offset_fdset(QTes= tState *from, return NULL; } =20 -static void test_precopy_file_offset_fdset(void) +static void test_precopy_file_offset_fdset(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", FILE_TEST_OFFSET); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_file_offset_fdset, - }; + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_file_offset_fdset; =20 - test_file_common(&args, false); + test_file_common(args, false); } #endif =20 -static void test_precopy_file_offset(void) +static void test_precopy_file_offset(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s,offset=3D%d", tmp= fs, FILE_TEST_FILENAME, FILE_TEST_OFFSET); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - }; =20 - test_file_common(&args, false); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + test_file_common(args, false); } =20 -static void test_precopy_file_offset_bad(void) +static void test_precopy_file_offset_bad(char *name, MigrateCommon *args) { /* using a value not supported by qemu_strtosz() */ g_autofree char *uri =3D g_strdup_printf("file:%s/%s,offset=3D0x20M", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .result =3D MIG_TEST_QMP_ERROR, - }; =20 - test_file_common(&args, false); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->result =3D MIG_TEST_QMP_ERROR; + + test_file_common(args, false); } =20 -static void test_precopy_file_mapped_ram_live(void) +static void test_precopy_file_mapped_ram_live(char *name, MigrateCommon *a= rgs) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, - }; - - test_file_common(&args, false); + + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + + test_file_common(args, false); } =20 -static void test_precopy_file_mapped_ram(void) +static void test_precopy_file_mapped_ram(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, - }; - - test_file_common(&args, true); + + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + + test_file_common(args, true); } =20 -static void test_multifd_file_mapped_ram_live(void) +static void test_multifd_file_mapped_ram_live(char *name, MigrateCommon *a= rgs) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, - }; - - test_file_common(&args, false); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + + test_file_common(args, false); } =20 -static void test_multifd_file_mapped_ram(void) +static void test_multifd_file_mapped_ram(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - }, - }; - - test_file_common(&args, true); + + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + + test_file_common(args, true); } =20 static void *migrate_hook_start_multifd_mapped_ram_dio(QTestState *from, @@ -178,26 +163,23 @@ static void *migrate_hook_start_multifd_mapped_ram_di= o(QTestState *from, return NULL; } =20 -static void test_multifd_file_mapped_ram_dio(void) +static void test_multifd_file_mapped_ram_dio(char *name, MigrateCommon *ar= gs) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram_dio, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_mapped_ram_dio; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 if (!probe_o_direct_support(tmpfs)) { g_test_skip("Filesystem does not support O_DIRECT"); return; } =20 - test_file_common(&args, true); + test_file_common(args, true); } =20 #ifndef _WIN32 @@ -252,45 +234,41 @@ static void *migrate_hook_start_multifd_mapped_ram_fd= set(QTestState *from, return NULL; } =20 -static void test_multifd_file_mapped_ram_fdset(void) +static void test_multifd_file_mapped_ram_fdset(char *name, MigrateCommon *= args) { g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", FILE_TEST_OFFSET); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset, - .end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; =20 - test_file_common(&args, true); + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset; + args->end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_file_common(args, true); } =20 -static void test_multifd_file_mapped_ram_fdset_dio(void) +static void test_multifd_file_mapped_ram_fdset_dio(char *name, + MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", FILE_TEST_OFFSET); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset_dio, - .end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset, - .start =3D { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; + args->connect_uri =3D uri; + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset_dio; + args->end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 if (!probe_o_direct_support(tmpfs)) { g_test_skip("Filesystem does not support O_DIRECT"); return; } =20 - test_file_common(&args, true); + test_file_common(args, true); } #endif /* !_WIN32 */ =20 diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration= /migration-util.c index 642cf50c8d..c2462306a1 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -235,14 +235,15 @@ char *resolve_machine_version(const char *alias, cons= t char *var1, =20 typedef struct { char *name; - void (*func)(void); - void (*func_full)(void *); + MigrateCommon *data; + void (*func)(char *name, MigrateCommon *args); } MigrationTest; =20 static void migration_test_destroy(gpointer data) { MigrationTest *test =3D (MigrationTest *)data; =20 + g_free(test->data); g_free(test->name); g_free(test); } @@ -251,11 +252,14 @@ static void migration_test_wrapper(const void *data) { MigrationTest *test =3D (MigrationTest *)data; =20 + test->data =3D g_new0(MigrateCommon, 1); + g_test_message("Running /%s%s", qtest_get_arch(), test->name); - test->func(); + test->func(test->name, test->data); } =20 -void migration_test_add(const char *path, void (*fn)(void)) +void migration_test_add(const char *path, + void (*fn)(char *name, MigrateCommon *args)) { MigrationTest *test =3D g_new0(MigrationTest, 1); =20 @@ -266,26 +270,18 @@ void migration_test_add(const char *path, void (*fn)(= void)) migration_test_destroy); } =20 -static void migration_test_wrapper_full(const void *data) -{ - MigrationTest *test =3D (MigrationTest *)data; - - g_test_message("Running /%s%s", qtest_get_arch(), test->name); - test->func_full(test->name); -} - void migration_test_add_suffix(const char *path, const char *suffix, - void (*fn)(void *)) + void (*fn)(char *name, MigrateCommon *args)) { MigrationTest *test =3D g_new0(MigrationTest, 1); =20 g_assert(g_str_has_suffix(path, "/")); g_assert(!g_str_has_prefix(suffix, "/")); =20 - test->func_full =3D fn; + test->func =3D fn; test->name =3D g_strconcat(path, suffix, NULL); =20 - qtest_add_data_func_full(test->name, test, migration_test_wrapper_full, + qtest_add_data_func_full(test->name, test, migration_test_wrapper, migration_test_destroy); } =20 diff --git a/tests/qtest/migration/migration-util.h b/tests/qtest/migration= /migration-util.h index 44815e9c42..e73d69bab0 100644 --- a/tests/qtest/migration/migration-util.h +++ b/tests/qtest/migration/migration-util.h @@ -15,6 +15,8 @@ =20 #include "libqtest.h" =20 +#include "migration/framework.h" + typedef struct QTestMigrationState { bool stop_seen; bool resume_seen; @@ -50,9 +52,11 @@ static inline bool probe_o_direct_support(const char *tm= pfs) =20 bool ufd_version_check(bool *uffd_feature_thread_id); bool kvm_dirty_ring_supported(void); -void migration_test_add(const char *path, void (*fn)(void)); + +void migration_test_add(const char *path, + void (*fn)(char *name, MigrateCommon *args)); void migration_test_add_suffix(const char *path, const char *suffix, - void (*fn)(void *)); + void (*fn)(char *name, MigrateCommon *args)= ); char *migrate_get_connect_uri(QTestState *who); void migrate_set_ports(QTestState *to, QList *channel_list); =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 20edaa51f5..810e9e6549 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -22,14 +22,13 @@ =20 static char *tmpfs; =20 -static void test_baddest(void) +static void test_baddest(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .hide_stderr =3D true - }; QTestState *from, *to; =20 - if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { + args->start.hide_stderr =3D true; + + if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; } migrate_qmp(from, to, "tcp:127.0.0.1:0", NULL, "{}"); @@ -38,24 +37,23 @@ static void test_baddest(void) } =20 #ifndef _WIN32 -static void test_analyze_script(void) +static void test_analyze_script(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - }; QTestState *from, *to; g_autofree char *uri =3D NULL; g_autofree char *file =3D NULL; int pid, wstatus; const char *python =3D g_getenv("PYTHON"); =20 + args->start.opts_source =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; + if (!python) { g_test_skip("PYTHON variable not set"); return; } =20 /* dummy url */ - if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { + if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; } =20 @@ -92,16 +90,15 @@ static void test_analyze_script(void) } #endif =20 -static void test_ignore_shared(void) +static void test_ignore_shared(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; - MigrateStart args =3D { - .mem_type =3D MEM_TYPE_SHMEM, - .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true, - }; =20 - if (migrate_start(&from, &to, uri, &args)) { + args->start.mem_type =3D MEM_TYPE_SHMEM; + args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true; + + if (migrate_start(&from, &to, uri, &args->start)) { return; } =20 @@ -161,45 +158,37 @@ static void do_test_validate_uuid(MigrateStart *args,= bool should_fail) migrate_end(from, to, false); } =20 -static void test_validate_uuid(void) +static void test_validate_uuid(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - .opts_target =3D "-uuid 11111111-1111-1111-1111-111111111111", - }; + args->start.opts_source =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; + args->start.opts_target =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(&args->start, false); } =20 -static void test_validate_uuid_error(void) +static void test_validate_uuid_error(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", - .hide_stderr =3D true, - }; + args->start.opts_source =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; + args->start.opts_target =3D "-uuid 22222222-2222-2222-2222-22222222222= 2"; + args->start.hide_stderr =3D true; =20 - do_test_validate_uuid(&args, true); + do_test_validate_uuid(&args->start, true); } =20 -static void test_validate_uuid_src_not_set(void) +static void test_validate_uuid_src_not_set(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", - .hide_stderr =3D true, - }; + args->start.opts_target =3D "-uuid 22222222-2222-2222-2222-22222222222= 2"; + args->start.hide_stderr =3D true; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(&args->start, false); } =20 -static void test_validate_uuid_dst_not_set(void) +static void test_validate_uuid_dst_not_set(char *name, MigrateCommon *args) { - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - .hide_stderr =3D true, - }; + args->start.opts_source =3D "-uuid 11111111-1111-1111-1111-11111111111= 1"; + args->start.hide_stderr =3D true; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(&args->start, false); } =20 static void do_test_validate_uri_channel(MigrateCommon *args) @@ -226,34 +215,27 @@ static void do_test_validate_uri_channel(MigrateCommo= n *args) migrate_end(from, to, false); } =20 -static void test_validate_uri_channels_both_set(void) +static void test_validate_uri_channels_both_set(char *name, MigrateCommon = *args) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "defer", - .connect_uri =3D "tcp:127.0.0.1:0", - .connect_channels =3D ("[ { ""'channel-type': 'main'," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," - " 'port': '0' } } ]"), - }; + args->listen_uri =3D "defer", + args->connect_uri =3D "tcp:127.0.0.1:0", + args->connect_channels =3D ("[ { ""'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]"), =20 - do_test_validate_uri_channel(&args); + args->start.hide_stderr =3D true; + + do_test_validate_uri_channel(args); } =20 -static void test_validate_uri_channels_none_set(void) +static void test_validate_uri_channels_none_set(char *name, MigrateCommon = *args) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "defer", - }; + args->listen_uri =3D "defer"; + args->start.hide_stderr =3D true; =20 - do_test_validate_uri_channel(&args); + do_test_validate_uri_channel(args); } =20 static void migration_test_add_misc_smoke(MigrationTestEnv *env) diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration= /postcopy-tests.c index 3773525843..7ae4d765d7 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -20,67 +20,51 @@ #include "qemu/range.h" #include "qemu/sockets.h" =20 -static void test_postcopy(void) +static void test_postcopy(char *name, MigrateCommon *args) { - MigrateCommon args =3D { }; - - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_postcopy_suspend(void) +static void test_postcopy_suspend(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start.suspend_me =3D true, - }; + args->start.suspend_me =3D true; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_postcopy_preempt(void) +static void test_postcopy_preempt(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_postcopy_recovery(void) +static void test_postcopy_recovery(char *name, MigrateCommon *args) { - MigrateCommon args =3D { }; - - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_postcopy_recovery_fail_handshake(void) +static void test_postcopy_recovery_fail_handshake(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_RECOVERY, - }; + args->postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_RECOVERY; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_postcopy_recovery_fail_reconnect(void) +static void test_postcopy_recovery_fail_reconnect(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_CHANNEL_ESTABLISH, - }; + args->postcopy_recovery_fail_stage =3D POSTCOPY_FAIL_CHANNEL_ESTABLISH; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_postcopy_preempt_recovery(void) +static void test_postcopy_preempt_recovery(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 static void migration_test_add_postcopy_smoke(MigrationTestEnv *env) @@ -94,27 +78,19 @@ static void migration_test_add_postcopy_smoke(Migration= TestEnv *env) } } =20 -static void test_multifd_postcopy(void) +static void test_multifd_postcopy(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_multifd_postcopy_preempt(void) +static void test_multifd_postcopy_preempt(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 void migration_test_add_postcopy(MigrationTestEnv *env) diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 57ca623de5..086d06a31c 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -35,68 +35,64 @@ =20 static char *tmpfs; =20 -static void test_precopy_unix_plain(void) +static void test_precopy_unix_plain(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .listen_uri =3D uri, - .connect_uri =3D uri, - /* - * The simplest use case of precopy, covering smoke tests of - * get-dirty-log dirty tracking. - */ - .live =3D true, - }; - - test_precopy_common(&args); + + args->listen_uri =3D uri; + args->connect_uri =3D uri; + /* + * The simplest use case of precopy, covering smoke tests of + * get-dirty-log dirty tracking. + */ + args->live =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_unix_suspend_live(void) +static void test_precopy_unix_suspend_live(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .listen_uri =3D uri, - .connect_uri =3D uri, - /* - * despite being live, the test is fast because the src - * suspends immediately. - */ - .live =3D true, - .start.suspend_me =3D true, - }; - - test_precopy_common(&args); + + args->listen_uri =3D uri; + args->connect_uri =3D uri; + /* + * despite being live, the test is fast because the src + * suspends immediately. + */ + args->live =3D true; + + args->start.suspend_me =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_unix_suspend_notlive(void) +static void test_precopy_unix_suspend_notlive(char *name, MigrateCommon *a= rgs) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .listen_uri =3D uri, - .connect_uri =3D uri, - .start.suspend_me =3D true, - }; =20 - test_precopy_common(&args); + args->listen_uri =3D uri; + args->connect_uri =3D uri; + args->start.suspend_me =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_unix_dirty_ring(void) +static void test_precopy_unix_dirty_ring(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .start =3D { - .use_dirty_ring =3D true, - }, - .listen_uri =3D uri, - .connect_uri =3D uri, - /* - * Besides the precopy/unix basic test, cover dirty ring interface - * rather than get-dirty-log. - */ - .live =3D true, - }; - - test_precopy_common(&args); + + args->listen_uri =3D uri; + args->connect_uri =3D uri; + /* + * Besides the precopy/unix basic test, cover dirty ring interface + * rather than get-dirty-log. + */ + args->live =3D true; + + args->start.use_dirty_ring =3D true; + + test_precopy_common(args); } =20 #ifdef CONFIG_RDMA @@ -162,7 +158,7 @@ static int new_rdma_link(char *buffer, bool ipv6) return -1; } =20 -static void __test_precopy_rdma_plain(bool ipv6) +static void __test_precopy_rdma_plain(MigrateCommon *args, bool ipv6) { char buffer[128] =3D {}; =20 @@ -187,50 +183,43 @@ static void __test_precopy_rdma_plain(bool ipv6) **/ g_autofree char *uri =3D g_strdup_printf("rdma:%s:29200", buffer); =20 - MigrateCommon args =3D { - .listen_uri =3D uri, - .connect_uri =3D uri, - }; + args->listen_uri =3D uri; + args->connect_uri =3D uri; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_rdma_plain(void) +static void test_precopy_rdma_plain(char *name, MigrateCommon *args) { - __test_precopy_rdma_plain(false); + __test_precopy_rdma_plain(args, false); } =20 -static void test_precopy_rdma_plain_ipv6(void) +static void test_precopy_rdma_plain_ipv6(char *name, MigrateCommon *args) { - __test_precopy_rdma_plain(true); + __test_precopy_rdma_plain(args, true); } #endif =20 -static void test_precopy_tcp_plain(void) +static void test_precopy_tcp_plain(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_switchover_ack(void) +static void test_precopy_tcp_switchover_ack(char *name, MigrateCommon *arg= s) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start =3D { - .caps[MIGRATION_CAPABILITY_RETURN_PATH] =3D true, - .caps[MIGRATION_CAPABILITY_SWITCHOVER_ACK] =3D true, - }, - /* - * Source VM must be running in order to consider the switchover A= CK - * when deciding to do switchover or not. - */ - .live =3D true, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + /* + * Source VM must be running in order to consider the switchover ACK + * when deciding to do switchover or not. + */ + args->live =3D true; =20 - test_precopy_common(&args); + args->start.caps[MIGRATION_CAPABILITY_RETURN_PATH] =3D true; + args->start.caps[MIGRATION_CAPABILITY_SWITCHOVER_ACK] =3D true; + + test_precopy_common(args); } =20 #ifndef _WIN32 @@ -291,15 +280,14 @@ static void migrate_hook_end_fd(QTestState *from, qobject_unref(rsp); } =20 -static void test_precopy_fd_socket(void) +static void test_precopy_fd_socket(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .connect_uri =3D "fd:fd-mig", - .start_hook =3D migrate_hook_start_fd, - .end_hook =3D migrate_hook_end_fd, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->connect_uri =3D "fd:fd-mig"; + args->start_hook =3D migrate_hook_start_fd; + args->end_hook =3D migrate_hook_end_fd; + + test_precopy_common(args); } =20 static void *migrate_hook_start_precopy_fd_file(QTestState *from, @@ -331,15 +319,14 @@ static void *migrate_hook_start_precopy_fd_file(QTest= State *from, return NULL; } =20 -static void test_precopy_fd_file(void) +static void test_precopy_fd_file(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .connect_uri =3D "fd:fd-mig", - .start_hook =3D migrate_hook_start_precopy_fd_file, - .end_hook =3D migrate_hook_end_fd, - }; - test_file_common(&args, true); + args->listen_uri =3D "defer"; + args->connect_uri =3D "fd:fd-mig"; + args->start_hook =3D migrate_hook_start_precopy_fd_file; + args->end_hook =3D migrate_hook_end_fd; + + test_file_common(args, true); } #endif /* _WIN32 */ =20 @@ -358,10 +345,9 @@ static void test_precopy_fd_file(void) * To make things even worse, we need to run the initial stage at * 3MB/s so we enter autoconverge even when host is (over)loaded. */ -static void test_auto_converge(void) +static void test_auto_converge(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateStart args =3D {}; QTestState *from, *to; int64_t percentage; =20 @@ -374,7 +360,7 @@ static void test_auto_converge(void) uint64_t prev_dirty_sync_cnt, dirty_sync_cnt; int max_try_count, hit =3D 0; =20 - if (migrate_start(&from, &to, uri, &args)) { + if (migrate_start(&from, &to, uri, &args->start)) { return; } =20 @@ -486,76 +472,68 @@ migrate_hook_start_precopy_tcp_multifd_no_zero_page(Q= TestState *from, return NULL; } =20 -static void test_multifd_tcp_uri_none(void) +static void test_multifd_tcp_uri_none(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_precopy_tcp_multifd, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - /* - * Multifd is more complicated than most of the features, it - * directly takes guest page buffers when sending, make sure - * everything will work alright even if guest page is changing. - */ - .live =3D true, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd; + /* + * Multifd is more complicated than most of the features, it + * directly takes guest page buffers when sending, make sure + * everything will work alright even if guest page is changing. + */ + args->live =3D true; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_zero_page_legacy(void) +static void test_multifd_tcp_zero_page_legacy(char *name, MigrateCommon *a= rgs) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_zero_page_l= egacy, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - /* - * Multifd is more complicated than most of the features, it - * directly takes guest page buffers when sending, make sure - * everything will work alright even if guest page is changing. - */ - .live =3D true, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zero_page_= legacy; + /* + * Multifd is more complicated than most of the features, it + * directly takes guest page buffers when sending, make sure + * everything will work alright even if guest page is changing. + */ + args->live =3D true; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_no_zero_page(void) +static void test_multifd_tcp_no_zero_page(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_precopy_tcp_multifd_no_zero_pag= e, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - /* - * Multifd is more complicated than most of the features, it - * directly takes guest page buffers when sending, make sure - * everything will work alright even if guest page is changing. - */ - .live =3D true, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_no_zero_pa= ge; + /* + * Multifd is more complicated than most of the features, it + * directly takes guest page buffers when sending, make sure + * everything will work alright even if guest page is changing. + */ + args->live =3D true; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_channels_none(void) +static void test_multifd_tcp_channels_none(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_precopy_tcp_multifd, - .live =3D true, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .connect_channels =3D ("[ { 'channel-type': 'main'," + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_precopy_tcp_multifd; + args->live =3D true; + args->connect_channels =3D ("[ { 'channel-type': 'main'," " 'addr': { 'transport': 'socket'," " 'type': 'inet'," " 'host': '127.0.0.1'," - " 'port': '0' } } ]"), - }; - test_precopy_common(&args); + " 'port': '0' } } ]"); + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 /* @@ -569,14 +547,13 @@ static void test_multifd_tcp_channels_none(void) * * And see that it works */ -static void test_multifd_tcp_cancel(bool postcopy_ram) +static void test_multifd_tcp_cancel(MigrateCommon *args, bool postcopy_ram) { - MigrateStart args =3D { - .hide_stderr =3D true, - }; QTestState *from, *to, *to2; =20 - if (migrate_start(&from, &to, "defer", &args)) { + args->start.hide_stderr =3D true; + + if (migrate_start(&from, &to, "defer", &args->start)) { return; } =20 @@ -621,11 +598,9 @@ static void test_multifd_tcp_cancel(bool postcopy_ram) */ wait_for_migration_status(from, "cancelled", NULL); =20 - args =3D (MigrateStart){ - .only_target =3D true, - }; + args->start.only_target =3D true; =20 - if (migrate_start(&from, &to2, "defer", &args)) { + if (migrate_start(&from, &to2, "defer", &args->start)) { return; } =20 @@ -656,14 +631,14 @@ static void test_multifd_tcp_cancel(bool postcopy_ram) migrate_end(from, to2, true); } =20 -static void test_multifd_precopy_tcp_cancel(void) +static void test_multifd_precopy_tcp_cancel(char *name, MigrateCommon *arg= s) { - test_multifd_tcp_cancel(false); + test_multifd_tcp_cancel(args, false); } =20 -static void test_multifd_postcopy_tcp_cancel(void) +static void test_multifd_postcopy_tcp_cancel(char *name, MigrateCommon *ar= gs) { - test_multifd_tcp_cancel(true); + test_multifd_tcp_cancel(args, true); } =20 static void test_cancel_src_after_failed(QTestState *from, QTestState *to, @@ -786,17 +761,15 @@ static void test_cancel_src_pre_switchover(QTestState= *from, QTestState *to, (const char * []) { "completed", NULL }); } =20 -static void test_cancel_src_after_status(void *opaque) +static void test_cancel_src_after_status(char *test_path, MigrateCommon *a= rgs) { - const char *test_path =3D opaque; g_autofree char *phase =3D g_path_get_basename(test_path); g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; - MigrateStart args =3D { - .hide_stderr =3D true, - }; =20 - if (migrate_start(&from, &to, "defer", &args)) { + args->start.hide_stderr =3D true; + + if (migrate_start(&from, &to, "defer", &args->start)) { return; } =20 @@ -980,7 +953,7 @@ static void dirtylimit_stop_vm(QTestState *vm) unlink(path); } =20 -static void test_vcpu_dirty_limit(void) +static void test_vcpu_dirty_limit(char *name, MigrateCommon *args) { QTestState *vm; int64_t origin_rate; @@ -1107,7 +1080,7 @@ static void migrate_dirty_limit_wait_showup(QTestStat= e *from, * And see if dirty limit migration works correctly. * This test case involves many passes, so it runs in slow mode only. */ -static void test_dirty_limit(void) +static void test_dirty_limit(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; @@ -1128,17 +1101,15 @@ static void test_dirty_limit(void) */ const int64_t expected_threshold =3D max_bandwidth * downtime_limit / = 1000; int max_try_count =3D 10; - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - .use_dirty_ring =3D true, - }, - .listen_uri =3D uri, - .connect_uri =3D uri, - }; + + args->start.hide_stderr =3D true; + args->start.use_dirty_ring =3D true; + + args->listen_uri =3D uri; + args->connect_uri =3D uri; =20 /* Start src, dst vm */ - if (migrate_start(&from, &to, args.listen_uri, &args.start)) { + if (migrate_start(&from, &to, args->listen_uri, &args->start)) { return; } =20 @@ -1146,7 +1117,7 @@ static void test_dirty_limit(void) migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_va= lue); =20 /* Start migrate */ - migrate_qmp(from, to, args.connect_uri, NULL, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, "{}"); =20 /* Wait for dirty limit throttle begin */ throttle_us_per_full =3D 0; @@ -1179,22 +1150,19 @@ static void test_dirty_limit(void) /* Assert dirty limit is not in service */ g_assert_cmpint(throttle_us_per_full, =3D=3D, 0); =20 - args =3D (MigrateCommon) { - .start =3D { - .only_target =3D true, - .use_dirty_ring =3D true, - }, - .listen_uri =3D uri, - .connect_uri =3D uri, - }; + args->listen_uri =3D uri; + args->connect_uri =3D uri; + + args->start.only_target =3D true; + args->start.use_dirty_ring =3D true; =20 /* Restart dst vm, src vm already show up so we needn't wait anymore */ - if (migrate_start(&from, &to, args.listen_uri, &args.start)) { + if (migrate_start(&from, &to, args->listen_uri, &args->start)) { return; } =20 /* Start migrate */ - migrate_qmp(from, to, args.connect_uri, NULL, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, "{}"); =20 /* Wait for dirty limit throttle begin */ throttle_us_per_full =3D 0; diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index e0e8a7335c..6a20c65104 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -362,149 +362,128 @@ migrate_hook_end_tls_x509(QTestState *from, } #endif /* CONFIG_TASN1 */ =20 -static void test_postcopy_tls_psk(void) +static void test_postcopy_tls_psk(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_common(&args); + test_postcopy_common(args); } =20 -static void test_postcopy_preempt_tls_psk(void) +static void test_postcopy_preempt_tls_psk(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; - - test_postcopy_common(&args); + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + + test_postcopy_common(args); } =20 -static void test_postcopy_recovery_tls_psk(void) +static void test_postcopy_recovery_tls_psk(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_multifd_postcopy_recovery_tls_psk(void) +static void test_multifd_postcopy_recovery_tls_psk(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - - test_postcopy_recovery_common(&args); + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_postcopy_recovery_common(args); } =20 /* This contains preempt+recovery+tls test altogether */ -static void test_postcopy_preempt_all(void) +static void test_postcopy_preempt_all(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_recovery_common(&args); + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + + test_postcopy_recovery_common(args); } =20 -static void test_multifd_postcopy_preempt_recovery_tls_psk(void) +static void test_multifd_postcopy_preempt_recovery_tls_psk(char *name, + MigrateCommon *= args) { - MigrateCommon args =3D { - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true, - }, - }; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_recovery_common(&args); + test_postcopy_recovery_common(args); } =20 -static void test_precopy_unix_tls_psk(void) +static void test_precopy_unix_tls_psk(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D uri, - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; =20 - test_precopy_common(&args); + args->connect_uri =3D uri; + args->listen_uri =3D uri; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + test_precopy_common(args); } =20 #ifdef CONFIG_TASN1 -static void test_precopy_unix_tls_x509_default_host(void) +static void test_precopy_unix_tls_x509_default_host(char *name, + MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .connect_uri =3D uri, - .listen_uri =3D uri, - .start_hook =3D migrate_hook_start_tls_x509_default_host, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, - }; =20 - test_precopy_common(&args); + args->connect_uri =3D uri; + args->listen_uri =3D uri; + args->start_hook =3D migrate_hook_start_tls_x509_default_host; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; + + args->start.hide_stderr =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_unix_tls_x509_override_host(void) +static void test_precopy_unix_tls_x509_override_host(char *name, + MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - MigrateCommon args =3D { - .connect_uri =3D uri, - .listen_uri =3D uri, - .start_hook =3D migrate_hook_start_tls_x509_override_host, - .end_hook =3D migrate_hook_end_tls_x509, - }; =20 - test_precopy_common(&args); + args->connect_uri =3D uri; + args->listen_uri =3D uri; + args->start_hook =3D migrate_hook_start_tls_x509_override_host; + args->end_hook =3D migrate_hook_end_tls_x509; + + test_precopy_common(args); } #endif /* CONFIG_TASN1 */ =20 -static void test_precopy_tcp_tls_psk_match(void) +static void test_precopy_tcp_tls_psk_match(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_psk_mismatch(void) +static void test_precopy_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_psk_mismatch, - .end_hook =3D migrate_hook_end_tls_psk, - .result =3D MIG_TEST_FAIL, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_psk_mismatch; + args->end_hook =3D migrate_hook_end_tls_psk; + args->result =3D MIG_TEST_FAIL; =20 - test_precopy_common(&args); + args->start.hide_stderr =3D true; + + test_precopy_common(args); } =20 static void *migrate_hook_start_no_tls(QTestState *from, QTestState *to) @@ -518,15 +497,13 @@ static void *migrate_hook_start_no_tls(QTestState *fr= om, QTestState *to) return data; } =20 -static void test_precopy_tcp_no_tls(void) +static void test_precopy_tcp_no_tls(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_no_tls, - .end_hook =3D migrate_hook_end_tls_psk, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_no_tls; + args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 static void * @@ -545,107 +522,96 @@ migrate_hook_start_tls_x509_no_host(QTestState *from= , QTestState *to) return data; } =20 -static void test_precopy_tcp_tls_no_hostname(void) +static void test_precopy_tcp_tls_no_hostname(char *name, MigrateCommon *ar= gs) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_no_host, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, - .start.hide_stderr =3D true, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_no_host; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 - test_precopy_common(&args); + args->start.hide_stderr =3D true; + + test_precopy_common(args); } =20 #ifdef CONFIG_TASN1 -static void test_precopy_tcp_tls_x509_default_host(void) +static void test_precopy_tcp_tls_x509_default_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_default_host, - .end_hook =3D migrate_hook_end_tls_x509, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_default_host; + args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_override_host(void) +static void test_precopy_tcp_tls_x509_override_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_override_host, - .end_hook =3D migrate_hook_end_tls_x509, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_override_host; + args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_mismatch_host(void) +static void test_precopy_tcp_tls_x509_mismatch_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_mismatch_host, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, - }; - - test_precopy_common(&args); + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_mismatch_host; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; + + args->start.hide_stderr =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_friendly_client(void) +static void test_precopy_tcp_tls_x509_friendly_client(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_friendly_client, - .end_hook =3D migrate_hook_end_tls_x509, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_friendly_client; + args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_hostile_client(void) +static void test_precopy_tcp_tls_x509_hostile_client(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_hostile_client, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL, - }; - - test_precopy_common(&args); + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_hostile_client; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; + + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_allow_anon_client(void) +static void test_precopy_tcp_tls_x509_allow_anon_client(char *name, + MigrateCommon *arg= s) { - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_allow_anon_client, - .end_hook =3D migrate_hook_end_tls_x509, - }; + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_allow_anon_client; + args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(&args); + test_precopy_common(args); } =20 -static void test_precopy_tcp_tls_x509_reject_anon_client(void) +static void test_precopy_tcp_tls_x509_reject_anon_client(char *name, + MigrateCommon *ar= gs) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, - .listen_uri =3D "tcp:127.0.0.1:0", - .start_hook =3D migrate_hook_start_tls_x509_reject_anon_client, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL, - }; - - test_precopy_common(&args); + args->listen_uri =3D "tcp:127.0.0.1:0"; + args->start_hook =3D migrate_hook_start_tls_x509_reject_anon_client; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; + + test_precopy_common(args); } #endif /* CONFIG_TASN1 */ =20 @@ -707,77 +673,70 @@ migrate_hook_start_multifd_tls_x509_reject_anon_clien= t(QTestState *from, } #endif /* CONFIG_TASN1 */ =20 -static void test_multifd_tcp_tls_psk_match(void) +static void test_multifd_tcp_tls_psk_match(char *name, MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_psk_mismatch(void) +static void test_multifd_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch, - .end_hook =3D migrate_hook_end_tls_psk, - .result =3D MIG_TEST_FAIL, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch; + args->end_hook =3D migrate_hook_end_tls_psk; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_postcopy_tcp_tls_psk_match(void) +static void test_multifd_postcopy_tcp_tls_psk_match(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - .caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true, - }, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match, - .end_hook =3D migrate_hook_end_tls_psk, - }; - - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; + args->end_hook =3D migrate_hook_end_tls_psk; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; + + test_precopy_common(args); } =20 #ifdef CONFIG_TASN1 -static void test_multifd_tcp_tls_x509_default_host(void) +static void test_multifd_tcp_tls_x509_default_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_default_host, - .end_hook =3D migrate_hook_end_tls_x509, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_default_host; + args->end_hook =3D migrate_hook_end_tls_x509; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_x509_override_host(void) +static void test_multifd_tcp_tls_x509_override_host(char *name, + MigrateCommon *args) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_override_host, - .end_hook =3D migrate_hook_end_tls_x509, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_override_host; + args->end_hook =3D migrate_hook_end_tls_x509; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_x509_mismatch_host(void) +static void test_multifd_tcp_tls_x509_mismatch_host(char *name, + MigrateCommon *args) { /* * This has different behaviour to the non-multifd case. @@ -792,45 +751,41 @@ static void test_multifd_tcp_tls_x509_mismatch_host(v= oid) * to load migration state, and thus just aborts the migration * without exiting. */ - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_x509_allow_anon_client(void) +static void test_multifd_tcp_tls_x509_allow_anon_client(char *name, + MigrateCommon *arg= s) { - MigrateCommon args =3D { - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cli= ent, - .end_hook =3D migrate_hook_end_tls_x509, - .start =3D { - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cl= ient; + args->end_hook =3D migrate_hook_end_tls_x509; + + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } =20 -static void test_multifd_tcp_tls_x509_reject_anon_client(void) +static void test_multifd_tcp_tls_x509_reject_anon_client(char *name, + MigrateCommon *ar= gs) { - MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - .caps[MIGRATION_CAPABILITY_MULTIFD] =3D true, - }, - .listen_uri =3D "defer", - .start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_cl= ient, - .end_hook =3D migrate_hook_end_tls_x509, - .result =3D MIG_TEST_FAIL, - }; - test_precopy_common(&args); + args->listen_uri =3D "defer"; + args->start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_c= lient; + args->end_hook =3D migrate_hook_end_tls_x509; + args->result =3D MIG_TEST_FAIL; + + args->start.hide_stderr =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + test_precopy_common(args); } #endif /* CONFIG_TASN1 */ =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836191; cv=none; d=zohomail.com; s=zohoarc; b=GsVKwmhFs7Z8yuZXJAJpoK98w18Salz/HZDyZj12HxLRZ/92ofnOVtAdhh2vy6FJA1ggqfOT2P9US3lgrwNHRgJZ6vWhCB+mAdR4KJmpP1+BPQjMgIFiyWy24CmYk8g9BMDsbKwnfWY9Kya+m0oQ2GM9BVwvhdBkXC4aPQgJcjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836191; 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=GirnPds6eybe2IGq51SAr5b0gzxORMXHl7tMh/4dldo=; b=Ao6axZnW+XqMyfxwlJdmKSBTtIWKQ+A1hSci5ErxafPzj6XrDFRSpm6/I6FrKwe4FVnEzp3pREdCnXKBcaa4qUFh8ZQ6JvqTdpqIaes+gDV3rCgsoHC3tDng1EvPfmwCpYVz/Z6g8fYE1cqktD3pU+30bbpZPLpuBCySr+PUnqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836191298203.31391786099186; Mon, 15 Dec 2025 14:03:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGdy-0004Fk-2s; Mon, 15 Dec 2025 17:02:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGdv-0004Dd-TG for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:11 -0500 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 1vVGdt-0002pU-Tf for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:11 -0500 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 71BC633779; Mon, 15 Dec 2025 22:01:54 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 69F593EA63; Mon, 15 Dec 2025 22:01:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EJ8nC1CFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836114; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GirnPds6eybe2IGq51SAr5b0gzxORMXHl7tMh/4dldo=; b=pYzSd1qPQUvabjghBi2L7LdG6gPj16R1WjHT6pg6F5IAfRzDuIdiAU7sh4PsHRosbJr7Ny sfqAoxFBmBNtZQ+v7mdIIxRo3IXwppqfLZeMdybOny0gMhZRnr2oX+Y64TPR6AVMaQDZQm 4WyRPqiovC+/a7not3IOjZijf9BujXg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836114; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GirnPds6eybe2IGq51SAr5b0gzxORMXHl7tMh/4dldo=; b=kq9iBGh0K9bJluBg3CmR35ifNgtRA1BXBro+rMxTccAPK9DbFiWunISCoXJ29ZP4EPd+t5 zXoYRlksEqgi2dBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836114; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GirnPds6eybe2IGq51SAr5b0gzxORMXHl7tMh/4dldo=; b=pYzSd1qPQUvabjghBi2L7LdG6gPj16R1WjHT6pg6F5IAfRzDuIdiAU7sh4PsHRosbJr7Ny sfqAoxFBmBNtZQ+v7mdIIxRo3IXwppqfLZeMdybOny0gMhZRnr2oX+Y64TPR6AVMaQDZQm 4WyRPqiovC+/a7not3IOjZijf9BujXg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836114; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GirnPds6eybe2IGq51SAr5b0gzxORMXHl7tMh/4dldo=; b=kq9iBGh0K9bJluBg3CmR35ifNgtRA1BXBro+rMxTccAPK9DbFiWunISCoXJ29ZP4EPd+t5 zXoYRlksEqgi2dBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 26/51] tests/qtest/migration: Pass MigrateStart into cancel tests Date: Mon, 15 Dec 2025 19:00:12 -0300 Message-ID: <20251215220041.12657-27-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.993]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836193210154100 Content-Type: text/plain; charset="utf-8" Pass the "args" parameter to the cancel tests so they can access the config object which will be part of this struct. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/precopy-tests.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 086d06a31c..aca7ed51ef 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -642,7 +642,8 @@ static void test_multifd_postcopy_tcp_cancel(char *name= , MigrateCommon *args) } =20 static void test_cancel_src_after_failed(QTestState *from, QTestState *to, - const char *uri, const char *phas= e) + const char *uri, const char *phas= e, + MigrateStart *args) { /* * No migrate_incoming_qmp() at the start to force source into @@ -669,7 +670,8 @@ static void test_cancel_src_after_failed(QTestState *fr= om, QTestState *to, } =20 static void test_cancel_src_after_cancelled(QTestState *from, QTestState *= to, - const char *uri, const char *p= hase) + const char *uri, const char *p= hase, + MigrateStart *args) { migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 @@ -693,7 +695,8 @@ static void test_cancel_src_after_cancelled(QTestState = *from, QTestState *to, } =20 static void test_cancel_src_after_complete(QTestState *from, QTestState *t= o, - const char *uri, const char *ph= ase) + const char *uri, const char *ph= ase, + MigrateStart *args) { migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 @@ -714,7 +717,8 @@ static void test_cancel_src_after_complete(QTestState *= from, QTestState *to, } =20 static void test_cancel_src_after_none(QTestState *from, QTestState *to, - const char *uri, const char *phase) + const char *uri, const char *phase, + MigrateStart *args) { /* * Test that cancelling without a migration happening does not @@ -735,7 +739,8 @@ static void test_cancel_src_after_none(QTestState *from= , QTestState *to, } =20 static void test_cancel_src_pre_switchover(QTestState *from, QTestState *t= o, - const char *uri, const char *ph= ase) + const char *uri, const char *ph= ase, + MigrateStart *args) { migrate_set_capability(from, "pause-before-switchover", true); migrate_set_capability(to, "pause-before-switchover", true); @@ -775,20 +780,20 @@ static void test_cancel_src_after_status(char *test_p= ath, MigrateCommon *args) =20 if (g_str_equal(phase, "cancelling") || g_str_equal(phase, "cancelled")) { - test_cancel_src_after_cancelled(from, to, uri, phase); + test_cancel_src_after_cancelled(from, to, uri, phase, &args->start= ); =20 } else if (g_str_equal(phase, "completed")) { - test_cancel_src_after_complete(from, to, uri, phase); + test_cancel_src_after_complete(from, to, uri, phase, &args->start); =20 } else if (g_str_equal(phase, "failed")) { - test_cancel_src_after_failed(from, to, uri, phase); + test_cancel_src_after_failed(from, to, uri, phase, &args->start); =20 } else if (g_str_equal(phase, "none")) { - test_cancel_src_after_none(from, to, uri, phase); + test_cancel_src_after_none(from, to, uri, phase, &args->start); =20 } else { /* any state that comes before pre-switchover */ - test_cancel_src_pre_switchover(from, to, uri, phase); + test_cancel_src_pre_switchover(from, to, uri, phase, &args->start); } =20 migrate_end(from, to, false); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836194; cv=none; d=zohomail.com; s=zohoarc; b=jE9wM52Bg126Sy2LbI3CXGZozNPPoAJBHbn7tczBgaSTVg6xsLVH5vGM/iX75npubrdldGCY44+tTZQK0C/BUG/qfQKo/WMpWFeBEtDvza9eHSsaVWQyrhjQm3wnuVnQs4toNGJFIyGzt/g+kfS6j/uYaJVXpZcXGDm5CSFpslE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836194; 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=QrAiykv9iUBDfBang+33s6+6HocOLLmKaPnqDkF+SbE=; b=XJvrAKxacS878VCvQrnqiR6iXSNvGxNrr1VGSP+DXkYQnyDF1sqUu7F2p0eOJHCC0KlVgxkA+ldpR3HeJevtl2qV7bynNUIT+3850752U9Z1KVpMAYAG5BgZKXnaPYcCHrTzm//ubmCU7WJ8cWOPzaUj67zSAqEPKz1SBBL5BmM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836194257295.24034597697073; Mon, 15 Dec 2025 14:03:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGeC-0004dO-13; Mon, 15 Dec 2025 17:02:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGe2-0004HV-8K for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:19 -0500 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 1vVGdz-0002qV-As for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:18 -0500 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 1C2CD33748; Mon, 15 Dec 2025 22:01:57 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 17E053EA63; Mon, 15 Dec 2025 22:01:54 +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 6C3BMlKFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836117; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QrAiykv9iUBDfBang+33s6+6HocOLLmKaPnqDkF+SbE=; b=qjIsDogzxKaY1z8f0Yu3LqagLh5Hk+zEI+lbb5Lky5fst9de47igZG844NlK81+SU03b2C J9CRjcFwZmMuNrDetPgF5FB8abnqGewchVN7mJS9FAOzWIIac7C7Erh0d5z0vkRQI1xAhZ cCPw7W7pxnPvslD+cf/sNEUCdpqwtEY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836117; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QrAiykv9iUBDfBang+33s6+6HocOLLmKaPnqDkF+SbE=; b=WSB0nBA3ZwuutewEgIRSoypEt6Ix89j0Slnxq8TB/U8BlJ5Q9+GvG4dQ5HPM13msjoNlOr /N/CYIcHZVpq+hAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836117; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QrAiykv9iUBDfBang+33s6+6HocOLLmKaPnqDkF+SbE=; b=qjIsDogzxKaY1z8f0Yu3LqagLh5Hk+zEI+lbb5Lky5fst9de47igZG844NlK81+SU03b2C J9CRjcFwZmMuNrDetPgF5FB8abnqGewchVN7mJS9FAOzWIIac7C7Erh0d5z0vkRQI1xAhZ cCPw7W7pxnPvslD+cf/sNEUCdpqwtEY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836117; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QrAiykv9iUBDfBang+33s6+6HocOLLmKaPnqDkF+SbE=; b=WSB0nBA3ZwuutewEgIRSoypEt6Ix89j0Slnxq8TB/U8BlJ5Q9+GvG4dQ5HPM13msjoNlOr /N/CYIcHZVpq+hAQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 27/51] tests/qtest/migration: Fix misuse of listen_uri Date: Mon, 15 Dec 2025 19:00:13 -0300 Message-ID: <20251215220041.12657-28-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836195422154100 Content-Type: text/plain; charset="utf-8" The listen_uri parameter is supposed to be used for the incoming migration while connect_uri for the outgoing migration. This is well documented in the header file. However, due to -incoming "defer", some tests set listen-uri =3D "defer", which is fine. But then, being without another parameter to define the uri to be use in migrate_incoming, some tests have been misusing connect_uri. Add a separate flag to denote "defer" and spare the tests from passing the string. Change the usage of listen_uri to it's original purpose. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/compression-tests.c | 12 +++---- tests/qtest/migration/cpr-tests.c | 17 +++++++--- tests/qtest/migration/file-tests.c | 38 ++++++++++++++++------- tests/qtest/migration/framework.c | 12 +++---- tests/qtest/migration/framework.h | 7 +++++ tests/qtest/migration/misc-tests.c | 4 +-- tests/qtest/migration/precopy-tests.c | 26 ++++++++++------ tests/qtest/migration/tls-tests.c | 16 +++++----- 8 files changed, 85 insertions(+), 47 deletions(-) diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index 845e622cd5..eb0b7d6b4b 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -33,9 +33,9 @@ migrate_hook_start_precopy_tcp_multifd_zstd(QTestState *f= rom, =20 static void test_multifd_tcp_zstd(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -43,9 +43,9 @@ static void test_multifd_tcp_zstd(char *name, MigrateComm= on *args) =20 static void test_multifd_postcopy_tcp_zstd(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; =20 @@ -66,9 +66,9 @@ migrate_hook_start_precopy_tcp_multifd_qatzip(QTestState = *from, =20 static void test_multifd_tcp_qatzip(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qatzip; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -85,9 +85,9 @@ migrate_hook_start_precopy_tcp_multifd_qpl(QTestState *fr= om, =20 static void test_multifd_tcp_qpl(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qpl; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -104,9 +104,9 @@ migrate_hook_start_precopy_tcp_multifd_uadk(QTestState = *from, =20 static void test_multifd_tcp_uadk(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_uadk; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -156,9 +156,9 @@ migrate_hook_start_precopy_tcp_multifd_zlib(QTestState = *from, =20 static void test_multifd_tcp_zlib(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zlib; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 0d97b5b89f..7456337370 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -32,10 +32,11 @@ static void test_mode_reboot(char *name, MigrateCommon = *args) g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); =20 + args->listen_uri =3D uri; args->connect_uri =3D uri; - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_mode_reboot; =20 + args->start.incoming_defer =3D true; args->start.mem_type =3D MEM_TYPE_SHMEM; args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true; =20 @@ -53,7 +54,7 @@ static void *test_mode_transfer_start(QTestState *from, Q= TestState *to) * migration, and cannot connect synchronously to the monitor, so defer * the target connection. */ -static void test_mode_transfer_common(MigrateCommon *args, bool incoming_d= efer) +static void test_mode_transfer_common(MigrateCommon *args) { g_autofree char *cpr_path =3D g_strdup_printf("%s/cpr.sock", tmpfs); g_autofree char *mig_path =3D g_strdup_printf("%s/migsocket", tmpfs); @@ -84,7 +85,11 @@ static void test_mode_transfer_common(MigrateCommon *arg= s, bool incoming_defer) "addr.type=3Dfd,addr.str=3D%d %s", cpr_sockfd, opts); =20 - args->listen_uri =3D incoming_defer ? "defer" : uri; + /* + * The URI is used only for the deferred target connection when + * !incoming_defer. + */ + args->listen_uri =3D uri; args->connect_channels =3D connect_channels; args->cpr_channel =3D cpr_channel; args->start_hook =3D test_mode_transfer_start; @@ -102,12 +107,14 @@ static void test_mode_transfer_common(MigrateCommon *= args, bool incoming_defer) =20 static void test_mode_transfer(char *name, MigrateCommon *args) { - test_mode_transfer_common(args, false); + args->start.incoming_defer =3D false; + test_mode_transfer_common(args); } =20 static void test_mode_transfer_defer(char *name, MigrateCommon *args) { - test_mode_transfer_common(args, true); + args->start.incoming_defer =3D true; + test_mode_transfer_common(args); } =20 static void set_cpr_exec_args(QTestState *who, MigrateCommon *args) diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/fil= e-tests.c index 5f1159076c..57117b2496 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -25,7 +25,9 @@ static void test_precopy_file(char *name, MigrateCommon *= args) g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; + + args->start.incoming_defer =3D true; =20 test_file_common(args, true); } @@ -69,9 +71,11 @@ static void test_precopy_file_offset_fdset(char *name, M= igrateCommon *args) g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", FILE_TEST_OFFSET); args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; args->start_hook =3D migrate_hook_start_file_offset_fdset; =20 + args->start.incoming_defer =3D true; + test_file_common(args, false); } #endif @@ -83,7 +87,9 @@ static void test_precopy_file_offset(char *name, MigrateC= ommon *args) FILE_TEST_OFFSET); =20 args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; + + args->start.incoming_defer =3D true; =20 test_file_common(args, false); } @@ -95,9 +101,11 @@ static void test_precopy_file_offset_bad(char *name, Mi= grateCommon *args) tmpfs, FILE_TEST_FILENAME); =20 args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; args->result =3D MIG_TEST_QMP_ERROR; =20 + args->start.incoming_defer =3D true; + test_file_common(args, false); } =20 @@ -107,8 +115,9 @@ static void test_precopy_file_mapped_ram_live(char *nam= e, MigrateCommon *args) FILE_TEST_FILENAME); =20 args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; =20 test_file_common(args, false); @@ -120,8 +129,9 @@ static void test_precopy_file_mapped_ram(char *name, Mi= grateCommon *args) FILE_TEST_FILENAME); =20 args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; =20 test_file_common(args, true); @@ -132,8 +142,9 @@ static void test_multifd_file_mapped_ram_live(char *nam= e, MigrateCommon *args) g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; =20 @@ -146,8 +157,9 @@ static void test_multifd_file_mapped_ram(char *name, Mi= grateCommon *args) FILE_TEST_FILENAME); =20 args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; =20 @@ -168,9 +180,10 @@ static void test_multifd_file_mapped_ram_dio(char *nam= e, MigrateCommon *args) g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; args->start_hook =3D migrate_hook_start_multifd_mapped_ram_dio; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 @@ -240,10 +253,11 @@ static void test_multifd_file_mapped_ram_fdset(char *= name, MigrateCommon *args) FILE_TEST_OFFSET); =20 args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; args->start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset; args->end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 @@ -255,11 +269,13 @@ static void test_multifd_file_mapped_ram_fdset_dio(ch= ar *name, { g_autofree char *uri =3D g_strdup_printf("file:/dev/fdset/1,offset=3D%= d", FILE_TEST_OFFSET); + args->connect_uri =3D uri; - args->listen_uri =3D "defer"; + args->listen_uri =3D uri; args->start_hook =3D migrate_hook_start_multifd_mapped_ram_fdset_dio; args->end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index e35839c95f..e811945122 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -414,7 +414,8 @@ int migrate_args(char **from, char **to, const char *ur= i, MigrateStart *args) "%s %s %s %s", kvm_opts ? kvm_opts : "", machine, machine_opts, - memory_backend, tmpfs, uri, + memory_backend, tmpfs, + args->incoming_defer ? "defer" : uri, events, arch_opts ? arch_opts : "", args->opts_target ? args->opts_target : "= ", @@ -856,8 +857,7 @@ int test_precopy_common(MigrateCommon *args) * migrate-incoming channels. */ if (args->connect_channels) { - if (args->start.defer_target_connect && - !strcmp(args->listen_uri, "defer")) { + if (args->start.defer_target_connect && args->start.incoming_defer= ) { in_channels =3D qobject_from_json(args->connect_channels, &error_abort); } @@ -881,8 +881,8 @@ int test_precopy_common(MigrateCommon *args) if (args->start.defer_target_connect) { qtest_connect(to); qtest_qmp_handshake(to, NULL); - if (!strcmp(args->listen_uri, "defer")) { - migrate_incoming_qmp(to, args->connect_uri, in_channels, "{}"); + if (args->start.incoming_defer) { + migrate_incoming_qmp(to, NULL, in_channels, "{}"); } } =20 @@ -1031,7 +1031,7 @@ void test_file_common(MigrateCommon *args, bool stop_= src) * We need to wait for the source to finish before starting the * destination. */ - migrate_incoming_qmp(to, args->connect_uri, NULL, "{}"); + migrate_incoming_qmp(to, args->listen_uri, NULL, "{}"); wait_for_migration_complete(to); =20 if (stop_src) { diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index ed85ed502d..bf3492a59e 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -144,6 +144,13 @@ typedef struct { * migration_set_capabilities(). */ bool caps[MIGRATION_CAPABILITY__MAX]; + + /* + * Whether to use "defer" as the uri for the -incoming command + * line option. If set to true, MigrateCommon.listen_uri will be + * used for the deferred migrate_incoming call. + */ + bool incoming_defer; } MigrateStart; =20 typedef enum PostcopyRecoveryFailStage { diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 810e9e6549..61bdfda857 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -217,7 +217,6 @@ static void do_test_validate_uri_channel(MigrateCommon = *args) =20 static void test_validate_uri_channels_both_set(char *name, MigrateCommon = *args) { - args->listen_uri =3D "defer", args->connect_uri =3D "tcp:127.0.0.1:0", args->connect_channels =3D ("[ { ""'channel-type': 'main'," " 'addr': { 'transport': 'socket'," @@ -225,6 +224,7 @@ static void test_validate_uri_channels_both_set(char *n= ame, MigrateCommon *args) " 'host': '127.0.0.1'," " 'port': '0' } } ]"), =20 + args->start.incoming_defer =3D true; args->start.hide_stderr =3D true; =20 do_test_validate_uri_channel(args); @@ -232,8 +232,8 @@ static void test_validate_uri_channels_both_set(char *n= ame, MigrateCommon *args) =20 static void test_validate_uri_channels_none_set(char *name, MigrateCommon = *args) { - args->listen_uri =3D "defer"; args->start.hide_stderr =3D true; + args->start.incoming_defer =3D true; =20 do_test_validate_uri_channel(args); } diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index aca7ed51ef..d9c463dd0f 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -282,11 +282,12 @@ static void migrate_hook_end_fd(QTestState *from, =20 static void test_precopy_fd_socket(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->connect_uri =3D "fd:fd-mig"; args->start_hook =3D migrate_hook_start_fd; args->end_hook =3D migrate_hook_end_fd; =20 + args->start.incoming_defer =3D true; + test_precopy_common(args); } =20 @@ -321,11 +322,13 @@ static void *migrate_hook_start_precopy_fd_file(QTest= State *from, =20 static void test_precopy_fd_file(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; + args->listen_uri =3D "fd:fd-mig"; args->connect_uri =3D "fd:fd-mig"; args->start_hook =3D migrate_hook_start_precopy_fd_file; args->end_hook =3D migrate_hook_end_fd; =20 + args->start.incoming_defer =3D true; + test_file_common(args, true); } #endif /* _WIN32 */ @@ -474,7 +477,6 @@ migrate_hook_start_precopy_tcp_multifd_no_zero_page(QTe= stState *from, =20 static void test_multifd_tcp_uri_none(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd; /* * Multifd is more complicated than most of the features, it @@ -483,6 +485,7 @@ static void test_multifd_tcp_uri_none(char *name, Migra= teCommon *args) */ args->live =3D true; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -490,7 +493,6 @@ static void test_multifd_tcp_uri_none(char *name, Migra= teCommon *args) =20 static void test_multifd_tcp_zero_page_legacy(char *name, MigrateCommon *a= rgs) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zero_page_= legacy; /* * Multifd is more complicated than most of the features, it @@ -499,6 +501,7 @@ static void test_multifd_tcp_zero_page_legacy(char *nam= e, MigrateCommon *args) */ args->live =3D true; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -506,7 +509,6 @@ static void test_multifd_tcp_zero_page_legacy(char *nam= e, MigrateCommon *args) =20 static void test_multifd_tcp_no_zero_page(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_no_zero_pa= ge; /* * Multifd is more complicated than most of the features, it @@ -515,6 +517,7 @@ static void test_multifd_tcp_no_zero_page(char *name, M= igrateCommon *args) */ args->live =3D true; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -522,15 +525,15 @@ static void test_multifd_tcp_no_zero_page(char *name,= MigrateCommon *args) =20 static void test_multifd_tcp_channels_none(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd; args->live =3D true; args->connect_channels =3D ("[ { 'channel-type': 'main'," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," " 'port': '0' } } ]"); =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -552,6 +555,7 @@ static void test_multifd_tcp_cancel(MigrateCommon *args= , bool postcopy_ram) QTestState *from, *to, *to2; =20 args->start.hide_stderr =3D true; + args->start.incoming_defer =3D true; =20 if (migrate_start(&from, &to, "defer", &args->start)) { return; @@ -599,6 +603,9 @@ static void test_multifd_tcp_cancel(MigrateCommon *args= , bool postcopy_ram) wait_for_migration_status(from, "cancelled", NULL); =20 args->start.only_target =3D true; + args->start.incoming_defer =3D true; + + /* reusing the same config for to2 */ =20 if (migrate_start(&from, &to2, "defer", &args->start)) { return; @@ -773,6 +780,7 @@ static void test_cancel_src_after_status(char *test_pat= h, MigrateCommon *args) QTestState *from, *to; =20 args->start.hide_stderr =3D true; + args->start.incoming_defer =3D true; =20 if (migrate_start(&from, &to, "defer", &args->start)) { return; diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 6a20c65104..166f27f478 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -675,10 +675,10 @@ migrate_hook_start_multifd_tls_x509_reject_anon_clien= t(QTestState *from, =20 static void test_multifd_tcp_tls_psk_match(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -686,12 +686,12 @@ static void test_multifd_tcp_tls_psk_match(char *name= , MigrateCommon *args) =20 static void test_multifd_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch; args->end_hook =3D migrate_hook_end_tls_psk; args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -700,10 +700,10 @@ static void test_multifd_tcp_tls_psk_mismatch(char *n= ame, MigrateCommon *args) static void test_multifd_postcopy_tcp_tls_psk_match(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; =20 @@ -714,10 +714,10 @@ static void test_multifd_postcopy_tcp_tls_psk_match(c= har *name, static void test_multifd_tcp_tls_x509_default_host(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_multifd_tls_x509_default_host; args->end_hook =3D migrate_hook_end_tls_x509; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -726,10 +726,10 @@ static void test_multifd_tcp_tls_x509_default_host(ch= ar *name, static void test_multifd_tcp_tls_x509_override_host(char *name, MigrateCommon *args) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_multifd_tls_x509_override_host; args->end_hook =3D migrate_hook_end_tls_x509; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -751,11 +751,11 @@ static void test_multifd_tcp_tls_x509_mismatch_host(c= har *name, * to load migration state, and thus just aborts the migration * without exiting. */ - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host; args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; =20 + args->start.incoming_defer =3D true; args->start.hide_stderr =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 @@ -765,10 +765,10 @@ static void test_multifd_tcp_tls_x509_mismatch_host(c= har *name, static void test_multifd_tcp_tls_x509_allow_anon_client(char *name, MigrateCommon *arg= s) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cl= ient; args->end_hook =3D migrate_hook_end_tls_x509; =20 + args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 test_precopy_common(args); @@ -777,11 +777,11 @@ static void test_multifd_tcp_tls_x509_allow_anon_clie= nt(char *name, static void test_multifd_tcp_tls_x509_reject_anon_client(char *name, MigrateCommon *ar= gs) { - args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_c= lient; args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; =20 + args->start.incoming_defer =3D true; args->start.hide_stderr =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836191; cv=none; d=zohomail.com; s=zohoarc; b=flnJWBHHr3TdxqJyaBEvRI1a6x0C9p+4c9mt19LG88vt92uvKNWNg4sxKFD59FgeMIz4rXfZlQYZLEBTJDaLvKSzKXjL6CLmQiBjUr6TdKIX7R3ZgbVbG4jujrTcN1gsB3c+esfSBhxl73GdGNiOiQDhPK9NBmt+NFeXtSB8T7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836191; 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=rdixMlj90AdyJ9tT9OWwan6oz2SIpuQi3hevm35iFow=; b=EAORKa9rziqMXR9FSyotr8gXga+jHvoAMIp2k+Vlm6Tay8d3B5K/tyi5n/Zc9jGYc7TCqlz/fqv2mAPizbA2PUJHdvwDHpW8hxaBqWC5XsRtOhqv7ed/quA294uoKqbm3CcqQAHNRid+SWXIrrds5qKLxI9i7wt3VZc2jxTmWD4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836191724723.2177938939246; Mon, 15 Dec 2025 14:03:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGeE-0004rN-L7; Mon, 15 Dec 2025 17:02:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGe9-0004cH-KD for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:25 -0500 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 1vVGe6-0002rO-69 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:25 -0500 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 AEF9333703; Mon, 15 Dec 2025 22:01:59 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A6CF13EA63; Mon, 15 Dec 2025 22:01:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qGD2GVWFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:01:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836119; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rdixMlj90AdyJ9tT9OWwan6oz2SIpuQi3hevm35iFow=; b=ukHPY+Au+Y/vYQv0QNkiaZpu9hXoRfTANMHfjo1m2sE0gJkia3EIUDEDMZlYU2zxTpb7zZ HPqDAaNpFsmmJHU5J7hICkQ4usQaw0zSuWZpONHCvamd+w38Ao8EQiwQkTlBSKL4inkB0Q QDiYSnSu6HiHM1FnOv2tMtlqNjZDipw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836119; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rdixMlj90AdyJ9tT9OWwan6oz2SIpuQi3hevm35iFow=; b=wjnclOgU8ql9SWpmPWHcnkpM44OJw3wQxXyHqv2bHH4D3RQlUY3+b4CfOWtFaO44tpLKzs 9YTU421ZT/Hqo4BQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836119; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rdixMlj90AdyJ9tT9OWwan6oz2SIpuQi3hevm35iFow=; b=ukHPY+Au+Y/vYQv0QNkiaZpu9hXoRfTANMHfjo1m2sE0gJkia3EIUDEDMZlYU2zxTpb7zZ HPqDAaNpFsmmJHU5J7hICkQ4usQaw0zSuWZpONHCvamd+w38Ao8EQiwQkTlBSKL4inkB0Q QDiYSnSu6HiHM1FnOv2tMtlqNjZDipw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836119; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rdixMlj90AdyJ9tT9OWwan6oz2SIpuQi3hevm35iFow=; b=wjnclOgU8ql9SWpmPWHcnkpM44OJw3wQxXyHqv2bHH4D3RQlUY3+b4CfOWtFaO44tpLKzs 9YTU421ZT/Hqo4BQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 28/51] tests/qtest/migration: Stop invoking migrate_incoming from hooks Date: Mon, 15 Dec 2025 19:00:14 -0300 Message-ID: <20251215220041.12657-29-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-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.989]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email, suse.de:mid, imap1.dmz-prg2.suse.org:helo] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836192388158500 Content-Type: text/plain; charset="utf-8" Now that the listen_uri is being properly used, tests can stop calling migrate_incoming from their hooks. The _common functions and migrate_start should take care of that. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/compression-tests.c | 6 ++++++ tests/qtest/migration/framework.c | 14 +++++++++++--- tests/qtest/migration/precopy-tests.c | 7 ++++--- tests/qtest/migration/tls-tests.c | 8 ++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index eb0b7d6b4b..bed39dece0 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -33,6 +33,7 @@ migrate_hook_start_precopy_tcp_multifd_zstd(QTestState *f= rom, =20 static void test_multifd_tcp_zstd(char *name, MigrateCommon *args) { + args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd; =20 args->start.incoming_defer =3D true; @@ -43,6 +44,7 @@ static void test_multifd_tcp_zstd(char *name, MigrateComm= on *args) =20 static void test_multifd_postcopy_tcp_zstd(char *name, MigrateCommon *args) { + args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, =20 args->start.incoming_defer =3D true; @@ -66,6 +68,7 @@ migrate_hook_start_precopy_tcp_multifd_qatzip(QTestState = *from, =20 static void test_multifd_tcp_qatzip(char *name, MigrateCommon *args) { + args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qatzip; =20 args->start.incoming_defer =3D true; @@ -85,6 +88,7 @@ migrate_hook_start_precopy_tcp_multifd_qpl(QTestState *fr= om, =20 static void test_multifd_tcp_qpl(char *name, MigrateCommon *args) { + args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qpl; =20 args->start.incoming_defer =3D true; @@ -104,6 +108,7 @@ migrate_hook_start_precopy_tcp_multifd_uadk(QTestState = *from, =20 static void test_multifd_tcp_uadk(char *name, MigrateCommon *args) { + args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_uadk; =20 args->start.incoming_defer =3D true; @@ -156,6 +161,7 @@ migrate_hook_start_precopy_tcp_multifd_zlib(QTestState = *from, =20 static void test_multifd_tcp_zlib(char *name, MigrateCommon *args) { + args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zlib; =20 args->start.incoming_defer =3D true; diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index e811945122..199e439263 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -820,6 +820,9 @@ int test_precopy_common(MigrateCommon *args) QObject *out_channels =3D NULL; =20 g_assert(!args->cpr_channel || args->connect_channels); + if (args->start.incoming_defer) { + g_assert(args->listen_uri || args->connect_channels); + } =20 if (migrate_start(&from, &to, args->listen_uri, &args->start)) { return -1; @@ -829,6 +832,14 @@ int test_precopy_common(MigrateCommon *args) data_hook =3D args->start_hook(from, to); } =20 + if (args->start.incoming_defer && !args->start.defer_target_connect) { + if (args->connect_channels) { + in_channels =3D qobject_from_json(args->connect_channels, + &error_abort); + } + migrate_incoming_qmp(to, args->listen_uri, in_channels, "{}"); + } + /* Wait for the first serial output from the source */ if (args->result =3D=3D MIG_TEST_SUCCEED) { wait_for_serial("src_serial"); @@ -1060,9 +1071,6 @@ void *migrate_hook_start_precopy_tcp_multifd_common(Q= TestState *from, migrate_set_parameter_str(from, "multifd-compression", method); migrate_set_parameter_str(to, "multifd-compression", method); =20 - /* Start incoming migration from the 1st socket */ - migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}"); - return NULL; } =20 diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index d9c463dd0f..ab5789717f 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -239,9 +239,6 @@ static void *migrate_hook_start_fd(QTestState *from, " 'arguments': { 'fdname': 'fd-mig' }}"); close(pair[0]); =20 - /* Start incoming migration from the 1st socket */ - migrate_incoming_qmp(to, "fd:fd-mig", NULL, "{}"); - /* Send the 2nd socket to the target */ qtest_qmp_fds_assert_success(from, &pair[1], 1, "{ 'execute': 'getfd'," @@ -283,6 +280,7 @@ static void migrate_hook_end_fd(QTestState *from, static void test_precopy_fd_socket(char *name, MigrateCommon *args) { args->connect_uri =3D "fd:fd-mig"; + args->listen_uri =3D "fd:fd-mig"; args->start_hook =3D migrate_hook_start_fd; args->end_hook =3D migrate_hook_end_fd; =20 @@ -484,6 +482,7 @@ static void test_multifd_tcp_uri_none(char *name, Migra= teCommon *args) * everything will work alright even if guest page is changing. */ args->live =3D true; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -500,6 +499,7 @@ static void test_multifd_tcp_zero_page_legacy(char *nam= e, MigrateCommon *args) * everything will work alright even if guest page is changing. */ args->live =3D true; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -516,6 +516,7 @@ static void test_multifd_tcp_no_zero_page(char *name, M= igrateCommon *args) * everything will work alright even if guest page is changing. */ args->live =3D true; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 166f27f478..f63f37132a 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -677,6 +677,7 @@ static void test_multifd_tcp_tls_psk_match(char *name, = MigrateCommon *args) { args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -689,6 +690,7 @@ static void test_multifd_tcp_tls_psk_mismatch(char *nam= e, MigrateCommon *args) args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch; args->end_hook =3D migrate_hook_end_tls_psk; args->result =3D MIG_TEST_FAIL; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.hide_stderr =3D true; args->start.incoming_defer =3D true; @@ -702,6 +704,7 @@ static void test_multifd_postcopy_tcp_tls_psk_match(cha= r *name, { args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -716,6 +719,7 @@ static void test_multifd_tcp_tls_x509_default_host(char= *name, { args->start_hook =3D migrate_hook_start_multifd_tls_x509_default_host; args->end_hook =3D migrate_hook_end_tls_x509; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -728,6 +732,7 @@ static void test_multifd_tcp_tls_x509_override_host(cha= r *name, { args->start_hook =3D migrate_hook_start_multifd_tls_x509_override_host; args->end_hook =3D migrate_hook_end_tls_x509; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -754,6 +759,7 @@ static void test_multifd_tcp_tls_x509_mismatch_host(cha= r *name, args->start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host; args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.hide_stderr =3D true; @@ -767,6 +773,7 @@ static void test_multifd_tcp_tls_x509_allow_anon_client= (char *name, { args->start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cl= ient; args->end_hook =3D migrate_hook_end_tls_x509; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -780,6 +787,7 @@ static void test_multifd_tcp_tls_x509_reject_anon_clien= t(char *name, args->start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_c= lient; args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; + args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.hide_stderr =3D true; --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836203; cv=none; d=zohomail.com; s=zohoarc; b=JHN18B6Ih00suXRqb8FqsaVYD2oO8MDecOdu9PkOqkjt2Vi+T5Q9EzfTH+/DZYhrAXYpj2rA3QpKm6kRVU0y/8UBLsJ6JyOBDgAseVeloYZATTfMr0AahOHlnMYhUzx7Y85hVFdcx1hbfvIbwTuGUa2X/kHMPSZxfoEYe0sLSfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836203; 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=Ejj8SHFCwe9/p1P7ixjeMELwlONdZ6cwRRvSelZ/Kp8=; b=XWAle9yfdwyzNzwgQ0jnjkMvmHZFRba3sv0uIDLY7aC2KD4fY8Oj7nQNTl9PkU0o5fwRFwYF2AdqZ/SCxurLkDn+MntSMBcfDeo4ixRsRsE1iJDp4aHEti6tAh4Tr8p1xEV6KyA7wlC+bdf81P702Jie1Fa7Cg07VzAK4epQEds= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836203731474.3730246322799; Mon, 15 Dec 2025 14:03:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGeh-0005nc-CX; Mon, 15 Dec 2025 17:03:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGeI-00050p-Qr for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:36 -0500 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 1vVGeD-0002tH-EL for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:32 -0500 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 4E8C93378B; Mon, 15 Dec 2025 22:02:02 +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 454F23EA63; Mon, 15 Dec 2025 22:02:00 +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 YFbjAViFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ejj8SHFCwe9/p1P7ixjeMELwlONdZ6cwRRvSelZ/Kp8=; b=vjkqTvTwlLGR322fM9DpyrulHPP/yvdZRbF14nYl6OHb5bf2PIN9hDpisE30kdvK1r+Rfm j82NqIkddsp8++sR7mLsU7ZVZRn7AQ8fN6dtVQviih9FaPV6W+qbYwErF/1g2PLfvbIJLO BmzPqHUHPFw1PdXFXyS5UJDfAjrz6DQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ejj8SHFCwe9/p1P7ixjeMELwlONdZ6cwRRvSelZ/Kp8=; b=6mDCHHUZA/Xgm5cRMjCwrTW5c2+gy/NOpchLuoMY2DTJJHAzSUrU4HZxtKkDSCf6ghmeOZ VmrMR9R1R79x3VDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ejj8SHFCwe9/p1P7ixjeMELwlONdZ6cwRRvSelZ/Kp8=; b=vjkqTvTwlLGR322fM9DpyrulHPP/yvdZRbF14nYl6OHb5bf2PIN9hDpisE30kdvK1r+Rfm j82NqIkddsp8++sR7mLsU7ZVZRn7AQ8fN6dtVQviih9FaPV6W+qbYwErF/1g2PLfvbIJLO BmzPqHUHPFw1PdXFXyS5UJDfAjrz6DQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ejj8SHFCwe9/p1P7ixjeMELwlONdZ6cwRRvSelZ/Kp8=; b=6mDCHHUZA/Xgm5cRMjCwrTW5c2+gy/NOpchLuoMY2DTJJHAzSUrU4HZxtKkDSCf6ghmeOZ VmrMR9R1R79x3VDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 29/51] tests/qtest/migration: Add config QDict Date: Mon, 15 Dec 2025 19:00:15 -0300 Message-ID: <20251215220041.12657-30-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-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.987]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email, suse.de:mid, imap1.dmz-prg2.suse.org:helo] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836204150158500 Content-Type: text/plain; charset="utf-8" Add the config object to the MigrateCommon structure and allocate/free it in the wrappers that are used when dispatched every migration test. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/framework.h | 2 ++ tests/qtest/migration/migration-util.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index bf3492a59e..65c656e0d3 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -151,6 +151,8 @@ typedef struct { * used for the deferred migrate_incoming call. */ bool incoming_defer; + + QDict *config; } MigrateStart; =20 typedef enum PostcopyRecoveryFailStage { diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration= /migration-util.c index c2462306a1..416dd10ef8 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -243,6 +243,7 @@ static void migration_test_destroy(gpointer data) { MigrationTest *test =3D (MigrationTest *)data; =20 + qdict_unref(test->data->start.config); g_free(test->data); g_free(test->name); g_free(test); @@ -253,6 +254,7 @@ static void migration_test_wrapper(const void *data) MigrationTest *test =3D (MigrationTest *)data; =20 test->data =3D g_new0(MigrateCommon, 1); + test->data->start.config =3D qdict_new(); =20 g_test_message("Running /%s%s", qtest_get_arch(), test->name); test->func(test->name, test->data); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836235; cv=none; d=zohomail.com; s=zohoarc; b=YWsTaNSFFLf8V5IgeAdOo/SmP51EkNssH+SUWfYBeCLR0VLspkmyuFNwTQ1yyOuZE2BlxK7/YzyiihWMWtrTHgCJcq/XdNpR/qeyUYdcw+pktuDlPiot+bUar/VNr+4r06+HAFJ/ZVYQdbjtffSw/OS8AIQmuYCKDrVhpuEK7o0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836235; 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=p/nBXOIo2ZcXdwbvi4S1iTXg0TqbIwOv4w9aq2LbXy8=; b=PO4bf1fXB8QhoEXlOu7NClOR4LEhaH+mJo5iWfpQOKKOuDFH8P8FJOaNWOguEIM1osTXCeJCTnaeI5XUJYhIe0i8oBAaE0Fxa6gHcW+Qj/9thsnT5vIXVUEYP9oMK6eQOug6NOmlglusEvuLqAon3sT3/nfZ0u9JhiakwQQkMso= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836235136973.1827613068633; Mon, 15 Dec 2025 14:03:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGen-000653-Fx; Mon, 15 Dec 2025 17:03:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGeO-0005Fe-Hm for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:40 -0500 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 1vVGeM-0002vV-PR for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:40 -0500 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 E4EE25BD2A; Mon, 15 Dec 2025 22:02:04 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DA3243EA63; Mon, 15 Dec 2025 22:02:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2A5hJlqFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836125; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p/nBXOIo2ZcXdwbvi4S1iTXg0TqbIwOv4w9aq2LbXy8=; b=O2fh1C9kaAbYwuxW07erkF3+f7YSu9tjhUHP6vX+OD+0+QD/uJ7KlMYk3tmm+UfPQohF2a 8/4cvTsWeVMMlxr/Mk6sbVF1G7zQNtuugjO/6nR5VhB5TD5BwuYmIDO4kzaFxHiiAAP8BY R/uPMf9Pw8Co2aMo+mJ40rMed7mcYB0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836125; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p/nBXOIo2ZcXdwbvi4S1iTXg0TqbIwOv4w9aq2LbXy8=; b=J2TNU8sFFw4HW+mR++FznoKXBdNo3wdnU7dt2hQTm0c24APcHpeiMfguLmOiyfi8c/uMg6 4BbBptXSjg7+zoBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=MsOKkzsy; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=D0gMhVvE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836124; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p/nBXOIo2ZcXdwbvi4S1iTXg0TqbIwOv4w9aq2LbXy8=; b=MsOKkzsyE3h1I9/6zlZ7IBBE1PyMPYu/Y8KfGYFvmzZa0/K1hgkMltF0ue5chTnD+hYewT P5QmWyWVp1QlPzGvtep604CXgdAxpSzt+6BHa1Msl0jprBgCTMPQN7L8P+paqc4ffz48OI NJ05/MCAtduZj+vjaTK3u16F34pZwkM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836124; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p/nBXOIo2ZcXdwbvi4S1iTXg0TqbIwOv4w9aq2LbXy8=; b=D0gMhVvEh38RWJD07wkCwi6HEEkQ6twSSef6SHMpGe/km6jaX4n+zl6wSObr9xEGFcU8pQ elXZrvtWkFX3CkDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 30/51] tests/qtest/migration: Add temporary code to toggle usage of config Date: Mon, 15 Dec 2025 19:00:16 -0300 Message-ID: <20251215220041.12657-31-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: E4EE25BD2A X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1765836237887154100 Content-Type: text/plain; charset="utf-8" The tests are being refactored to pass migration options to QEMU using the new API of passing a JSON object as argument the migration commands instead of using several calls to the migrate_set_capabilities|parameters commands. Since multiple tests share common infrastructure (framework.c, migration-utils.c, migration-qmp.c), it's cumbersome to convert tests in small chunks, which would require changes to every common function to accept both the new and old ways. After some tinkering, an easier way to do this transition is to allow the tests to set a key in the config dict itself telling whether the config is supported. With this, the common functions can be fully altered to support the config object, as long as they check this temporary key and do the right thing. QEMU doesn't know about this hack, so some code is needed to hide it when issuing QMP commands with the config object. This will all be removed once tests are fully converted. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/migration-qmp.h | 1 - tests/qtest/migration/migration-util.c | 1 + tests/qtest/migration/migration-util.h | 34 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/= migration-qmp.h index 940ffd5950..9a36a677ba 100644 --- a/tests/qtest/migration/migration-qmp.h +++ b/tests/qtest/migration/migration-qmp.h @@ -47,5 +47,4 @@ void migrate_recover(QTestState *who, const char *uri); void migrate_cancel(QTestState *who); void migrate_postcopy_start(QTestState *from, QTestState *to, QTestMigrationState *src_state); - #endif /* MIGRATION_QMP_H */ diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration= /migration-util.c index 416dd10ef8..e702f00896 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -255,6 +255,7 @@ static void migration_test_wrapper(const void *data) =20 test->data =3D g_new0(MigrateCommon, 1); test->data->start.config =3D qdict_new(); + qdict_put_bool(test->data->start.config, "use-config", false); =20 g_test_message("Running /%s%s", qtest_get_arch(), test->name); test->func(test->name, test->data); diff --git a/tests/qtest/migration/migration-util.h b/tests/qtest/migration= /migration-util.h index e73d69bab0..3c3b5a8777 100644 --- a/tests/qtest/migration/migration-util.h +++ b/tests/qtest/migration/migration-util.h @@ -60,4 +60,38 @@ void migration_test_add_suffix(const char *path, const c= har *suffix, char *migrate_get_connect_uri(QTestState *who); void migrate_set_ports(QTestState *to, QList *channel_list); =20 +/* + * Scaffolding to allow the framework _common functions and _qmp + * functions to use the config object while some tests are still using + * migrate_set_*. Tests that have been converted will set use-config =3D + * true on the config dict. + */ +static bool has_key; +static bool use_config; +static inline QDict *config_load(QDict *config) +{ + if (!config) { + return NULL; + } + + has_key =3D qdict_haskey(config, "use-config"); + if (has_key) { + use_config =3D qdict_get_try_bool(config, "use-config", false); + qdict_del(config, "use-config"); + } + + if (use_config) { + return config; + } + + return NULL; +} + +static inline void config_put(QDict *config) +{ + if (config && has_key) { + qdict_put_bool(config, "use-config", use_config); + } +} + #endif /* MIGRATION_UTIL_H */ --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836358; cv=none; d=zohomail.com; s=zohoarc; b=ZmdcnvuR6Qqsm35IBuPjt9gXZKoZAAka/OXRydnHlSTFIdpW6+TnDZ1gPRIqlvCeGOTGnsU65hIS0onh+yo21JRWzbg/tv2aJa05MVhPlbnpnTa7AqH2NufhUCutjJvkT31uwXz/ntSUJVm/oxn5Up5IJ7xFA3fxBzVvmB/3I6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836358; 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=4VHX99czqerAcRVZgW4IwCkI23zmvzGHHlg4r4w9VZA=; b=kqA55XVg6sO/dB4T0yOXK6em09z8fdAUeCRwGeBGWxLWLa+oYfeL8PoQwNEFCH7hA5F1wXd6ril1XhHpDCAhJw4zIyQ02EDohx0HfzndUeaJicFcbmMWwr1GUnwIW3Y35a0W4zLWXJ09CAb4uYwQnqT04Byw6u3h8AWxGI/DleI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176583635858921.90024080075898; Mon, 15 Dec 2025 14:05:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGeo-0006BG-Ff; Mon, 15 Dec 2025 17:03:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGeU-0005YQ-Us for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:48 -0500 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 1vVGeS-0002wX-3C for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:46 -0500 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 770995BDDD; Mon, 15 Dec 2025 22:02:07 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 733623EA63; Mon, 15 Dec 2025 22:02:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id CEAyDV2FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836127; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4VHX99czqerAcRVZgW4IwCkI23zmvzGHHlg4r4w9VZA=; b=1nH5jPWqOH4x/f4cE3P7VmRm2ijv0Kaao5Ccu3OyaYwksoDpl0bjJwfORLyjVspw3WmOu1 9ZUaUD5hTvR/F91rW13AtevW3V3g1WiLt6UR4zCM3GosoSqq8k4IfRnJtkpKOr9miKD9a6 bHEVFBMskhYm72qqOSUg0UPZoz9EHTQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836127; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4VHX99czqerAcRVZgW4IwCkI23zmvzGHHlg4r4w9VZA=; b=TLMLSqhSICekTFxXJ032RFBUEFndzrsaEbQEmZzyShlDn0b07IGPGE8vFKFgvXDTIkkGl6 nj8G0iGTb8sKcDCQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836127; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4VHX99czqerAcRVZgW4IwCkI23zmvzGHHlg4r4w9VZA=; b=1nH5jPWqOH4x/f4cE3P7VmRm2ijv0Kaao5Ccu3OyaYwksoDpl0bjJwfORLyjVspw3WmOu1 9ZUaUD5hTvR/F91rW13AtevW3V3g1WiLt6UR4zCM3GosoSqq8k4IfRnJtkpKOr9miKD9a6 bHEVFBMskhYm72qqOSUg0UPZoz9EHTQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836127; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4VHX99czqerAcRVZgW4IwCkI23zmvzGHHlg4r4w9VZA=; b=TLMLSqhSICekTFxXJ032RFBUEFndzrsaEbQEmZzyShlDn0b07IGPGE8vFKFgvXDTIkkGl6 nj8G0iGTb8sKcDCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 31/51] tests/qtest/migration: Add a function for default capabilities Date: Mon, 15 Dec 2025 19:00:17 -0300 Message-ID: <20251215220041.12657-32-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-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.990]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email, suse.de:mid, imap1.dmz-prg2.suse.org:helo] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836358965158500 Content-Type: text/plain; charset="utf-8" Add a helper to set the config object with default capabilities such as 'events' which are needed by the tests. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 199e439263..fd15bd832e 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -208,6 +208,29 @@ static QList *migrate_start_get_qmp_capabilities(const= MigrateStart *args) return capabilities; } =20 +static void migrate_start_set_default_options(MigrateStart *args) +{ + if (args->config && qdict_get_bool(args->config, "use-config")) { + /* + * Always enable migration events. Libvirt always uses it, + * let's mimic that. + */ + qdict_put_bool(args->config, "events", true); + + /* + * Default number of channels should be fine for most + * tests. Individual tests can override by calling + * migrate_set_parameter() directly. + */ + if (qdict_get_try_bool(args->config, "multifd", false)) { + qdict_put_int(args->config, "multifd-channels", + MULTIFD_TEST_CHANNELS); + } + + return; + } +} + static void migrate_start_set_capabilities(QTestState *from, QTestState *t= o, MigrateStart *args) { @@ -469,6 +492,8 @@ int migrate_start(QTestState **from, QTestState **to, c= onst char *uri, g_autofree gchar *cmd_target =3D NULL; g_autoptr(QList) capabilities =3D migrate_start_get_qmp_capabilities(a= rgs); =20 + migrate_start_set_default_options(args); + if (!migrate_mem_type_prepare(args->mem_type)) { return -1; } --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836401; cv=none; d=zohomail.com; s=zohoarc; b=LZR55gR4JhB0326BIukQrulpZFf3r5IvtLYpHySZLncuDvPDmvsNRLiUhTbYtOTGxeiHUWCOMd4p/WOPkjwsfrfQYxHK8jG4j1NvjY7Y+IddlGKQHu4t63Qo5f+9ge/AE3miUAzt8T508fh6W1gi2L5NHqMfqBe4Gb8LmMxSMtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836401; 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=aRWqTnAE7it0GUM5I0KBnogUWKEuhBCSO7OZNyfngIg=; b=VaJyMLF+QuXp4E0QvqcIvb0/WDlUsq6KR4ViLESq+dNueIZ22dYA5ISVK6rl2nEhrOwQ7q+MvLUldiYGNcgc8UECahKvdXf+Hj/zFJ163yOWoYwbq2ryP1v2y9wIt45rVwdnM34ofRAJE2hvJHM+Uws83Ej42tQb7BRpNNfuWd4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836401923635.6047991947772; Mon, 15 Dec 2025 14:06:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGet-0006x2-39; Mon, 15 Dec 2025 17:03:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGeb-0005k4-0u for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:58 -0500 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 1vVGeY-0002xy-Ji for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:52 -0500 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 3CF495BDE8; Mon, 15 Dec 2025 22:02:10 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 15ADF3EA63; Mon, 15 Dec 2025 22:02:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4BZVMV+FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836131; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aRWqTnAE7it0GUM5I0KBnogUWKEuhBCSO7OZNyfngIg=; b=seTVREg9j5T6uzy3baz9AnuZ4UKDoXG438aYh9rbAPC91ZM8qdjF8ak4xcUXGt8rxGn3qL lacuaTwlP2Z46I2lo5Qrsic8eVbEtPuV0/2DHdvqT86xVXkZMU6Ah7m59cOF+HgjAmrDgT QDghwYeIWP+PP44/yy0Gj6g3BkPa+dk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836131; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aRWqTnAE7it0GUM5I0KBnogUWKEuhBCSO7OZNyfngIg=; b=8rxzPKQIdQrqU3eOWZVrLgUYoh4BVrn8LQ8IcMi6LtzLPlSAxYvRpNeFSRbUhgjnbg9X6y JX32loboXxRKsXCA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=uA+B539S; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=RzmNTRH3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836130; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aRWqTnAE7it0GUM5I0KBnogUWKEuhBCSO7OZNyfngIg=; b=uA+B539SluDJ33PyQka5uznaVaXNyyOfKUJB+oSv9oMsnUwjRYgtu+U18e4KlzDaDDv6QL 5386MinkAOni7saUZONHq9dv8C6ICAAPU6NIZeyIk2R0P8chqnbsd7NHLJd38shASehXR2 kKECb2oPjR9LbS5TlVmASMdrQ6OjDHE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836130; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aRWqTnAE7it0GUM5I0KBnogUWKEuhBCSO7OZNyfngIg=; b=RzmNTRH3caFKObHPehYm5g3eIt52pnOdWJ9PRg3OK98z63PJdPABIUK0I+S7SZrBarL6ut NRVdSBRd0L6hgtCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 32/51] tests/qtest/migration: Adapt convergence routines to config Date: Mon, 15 Dec 2025 19:00:18 -0300 Message-ID: <20251215220041.12657-33-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 3CF495BDE8 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1765836404332154100 Content-Type: text/plain; charset="utf-8" Adapt the convergence routines migrate_ensure_[non_]converge to set the convergence parameters in the config dict it instead of using migrate-set-parameters. Some tests need to change the convergence parameters during the migration. The config object method is specific to configuration prior to starting a migration, so by design it's not suitable to effect migration-runtime changes. The existing routines will be kept for this purpose (renamed with 'ongoing' for clarity). Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 10 ++++----- tests/qtest/migration/migration-qmp.c | 32 +++++++++++++++++++++++++-- tests/qtest/migration/migration-qmp.h | 6 +++-- tests/qtest/migration/misc-tests.c | 4 ++-- tests/qtest/migration/precopy-tests.c | 26 +++++++++------------- 5 files changed, 52 insertions(+), 26 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index fd15bd832e..df42a8a2c6 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -583,7 +583,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, args->postcopy_data =3D args->start_hook(from, to); } =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," " 'arguments': { " @@ -872,7 +872,7 @@ int test_precopy_common(MigrateCommon *args) } =20 if (args->live) { - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); } else { /* @@ -884,7 +884,7 @@ int test_precopy_common(MigrateCommon *args) if (args->result =3D=3D MIG_TEST_SUCCEED) { qtest_qmp_assert_success(from, "{ 'execute' : 'stop'}"); wait_for_stop(from, &src_state); - migrate_ensure_converge(from); + migrate_ongoing_ensure_converge(from); } } =20 @@ -942,7 +942,7 @@ int test_precopy_common(MigrateCommon *args) } migrate_wait_for_dirty_mem(from, to); =20 - migrate_ensure_converge(from); + migrate_ongoing_ensure_converge(from); =20 /* * We do this first, as it has a timeout to stop us @@ -1047,7 +1047,7 @@ void test_file_common(MigrateCommon *args, bool stop_= src) data_hook =3D args->start_hook(from, to); } =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->start.config); wait_for_serial("src_serial"); =20 if (stop_src) { diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/= migration-qmp.c index 5c46ceb3e6..7fe47a5793 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -499,20 +499,48 @@ void migrate_set_parameter_bool(QTestState *who, cons= t char *parameter, migrate_check_parameter_bool(who, parameter, value); } =20 -void migrate_ensure_non_converge(QTestState *who) +void migrate_ongoing_ensure_non_converge(QTestState *who) { /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */ migrate_set_parameter_int(who, "max-bandwidth", 3 * 1000 * 1000); migrate_set_parameter_int(who, "downtime-limit", 1); } =20 -void migrate_ensure_converge(QTestState *who) +void migrate_ongoing_ensure_converge(QTestState *who) { /* Should converge with 30s downtime + 1 gbs bandwidth limit */ migrate_set_parameter_int(who, "max-bandwidth", 1 * 1000 * 1000 * 1000= ); migrate_set_parameter_int(who, "downtime-limit", 30 * 1000); } =20 +void migrate_ensure_non_converge(QTestState *who, QDict *config) +{ + config =3D config_load(config); + if (config) { + /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */ + qdict_put_int(config, "max-bandwidth", 3 * 1000 * 1000); + qdict_put_int(config, "downtime-limit", 1); + } else { + assert(who); + migrate_ongoing_ensure_non_converge(who); + } + config_put(config); +} + +void migrate_ensure_converge(QTestState *who, QDict *config) +{ + config =3D config_load(config); + /* Should converge with 30s downtime + 1 gbs bandwidth limit */ + if (config) { + qdict_put_int(config, "max-bandwidth", 1 * 1000 * 1000 * 1000); + qdict_put_int(config, "downtime-limit", 30 * 1000); + } else { + assert(who); + migrate_ongoing_ensure_converge(who); + } + config_put(config); +} + void migrate_pause(QTestState *who) { qtest_qmp_assert_success(who, "{ 'execute': 'migrate-pause' }"); diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/= migration-qmp.h index 9a36a677ba..e465c69094 100644 --- a/tests/qtest/migration/migration-qmp.h +++ b/tests/qtest/migration/migration-qmp.h @@ -39,8 +39,10 @@ void migrate_set_parameter_strv(QTestState *who, const c= har *parameter, void migrate_set_parameter_null(QTestState *who, const char *parameter); void migrate_set_parameter_bool(QTestState *who, const char *parameter, int value); -void migrate_ensure_non_converge(QTestState *who); -void migrate_ensure_converge(QTestState *who); +void migrate_ongoing_ensure_non_converge(QTestState *who); +void migrate_ongoing_ensure_converge(QTestState *who); +void migrate_ensure_non_converge(QTestState *who, QDict *config); +void migrate_ensure_converge(QTestState *who, QDict *config); void migrate_pause(QTestState *who); void migrate_continue(QTestState *who, const char *state); void migrate_recover(QTestState *who, const char *uri); diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 61bdfda857..0a737cb54f 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -68,7 +68,7 @@ static void test_analyze_script(char *name, MigrateCommon= *args) file =3D g_strdup_printf("%s/migfile", tmpfs); uri =3D g_strdup_printf("exec:cat > %s", file); =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->start.config); migrate_qmp(from, to, uri, NULL, "{}"); wait_for_migration_complete(from); =20 @@ -102,7 +102,7 @@ static void test_ignore_shared(char *name, MigrateCommo= n *args) return; } =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); =20 /* Wait for the first serial output from the source */ diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index ab5789717f..eabbbf39c3 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -374,7 +374,7 @@ static void test_auto_converge(char *name, MigrateCommo= n *args) * Set the initial parameters so that the migration could not converge * without throttling. */ - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); =20 /* To check remaining size after precopy */ migrate_set_capability(from, "pause-before-switchover", true); @@ -427,7 +427,7 @@ static void test_auto_converge(char *name, MigrateCommo= n *args) g_assert_cmpint(hit, =3D=3D, 1); =20 /* Now, when we tested that throttling works, let it converge */ - migrate_ensure_converge(from); + migrate_ongoing_ensure_converge(from); =20 /* * Wait for pre-switchover status to check last throttle percentage @@ -562,7 +562,7 @@ static void test_multifd_tcp_cancel(MigrateCommon *args= , bool postcopy_ram) return; } =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); =20 if (postcopy_ram) { @@ -623,14 +623,12 @@ static void test_multifd_tcp_cancel(MigrateCommon *ar= gs, bool postcopy_ram) /* Start incoming migration from the 1st socket */ migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, "{}"); =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from, args->start.config); =20 migrate_qmp(from, to2, NULL, NULL, "{}"); =20 migrate_wait_for_dirty_mem(from, to2); - - migrate_ensure_converge(from); - + migrate_ongoing_ensure_converge(from); wait_for_stop(from, get_src()); qtest_qmp_eventwait(to2, "RESUME"); =20 @@ -659,7 +657,7 @@ static void test_cancel_src_after_failed(QTestState *fr= om, QTestState *to, */ =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->config); =20 migrate_qmp(from, to, uri, NULL, "{}"); =20 @@ -684,7 +682,7 @@ static void test_cancel_src_after_cancelled(QTestState = *from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->config); =20 migrate_qmp(from, to, uri, NULL, "{}"); =20 @@ -709,7 +707,7 @@ static void test_cancel_src_after_complete(QTestState *= from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->config); =20 migrate_qmp(from, to, uri, NULL, "{}"); =20 @@ -739,7 +737,7 @@ static void test_cancel_src_after_none(QTestState *from= , QTestState *to, =20 migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->config); migrate_qmp(from, to, uri, NULL, "{}"); =20 wait_for_migration_complete(from); @@ -759,7 +757,7 @@ static void test_cancel_src_pre_switchover(QTestState *= from, QTestState *to, migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from); + migrate_ensure_converge(from, args->config); =20 migrate_qmp(from, to, uri, NULL, "{}"); =20 @@ -1066,9 +1064,6 @@ static void migrate_dirty_limit_wait_showup(QTestStat= e *from, migrate_set_parameter_int(from, "x-vcpu-dirty-limit-period", period); migrate_set_parameter_int(from, "vcpu-dirty-limit", value); =20 - /* Make sure migrate can't converge */ - migrate_ensure_non_converge(from); - /* To check limit rate after precopy */ migrate_set_capability(from, "pause-before-switchover", true); =20 @@ -1128,6 +1123,7 @@ static void test_dirty_limit(char *name, MigrateCommo= n *args) } =20 /* Prepare for dirty limit migration and wait src vm show up */ + migrate_ensure_non_converge(from, args->start.config); migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_va= lue); =20 /* Start migrate */ --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836336; cv=none; d=zohomail.com; s=zohoarc; b=Dp/I/BYgazZKkAOR7ZmFJwTanaElkhc6G45ObC9I+M2lmx7hB0ZxPJSKOX9aKdaNOm4CFIhvYpnhhoBzHp1Jv6Zr1qtiWYle29uAFVvOLk5RaF632xM0cwsdtLsNQOoKa2BWnDgxLWCwnWvreHYpkKkfK/D+96YH+3GI7RrP74I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836336; 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=gGtMleKybG0aL/ZIRF6KJDcnH5VwbKFjmAT93TCm7Jk=; b=Nd1eluzuXlvQwjujwRwY2ZVW+PCTaZATbDaZSk2gXpWzetbV908mDnaedyggvZNGRCgViYVZeaS6gppkId6+3oW+f3UGc572rZWKPRFcOd4I3C8cmoFG/FOgRDFCHezzpyZsSbRWtwBmZ2AskiYHq1mWmis1XmiUjx3BWn9ZHMw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836336205549.9033765630669; Mon, 15 Dec 2025 14:05:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGeo-00068t-9N; Mon, 15 Dec 2025 17:03:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGeO-0005EF-4g for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:40 -0500 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 1vVGeM-0002vR-E2 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:39 -0500 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 3154833742; Mon, 15 Dec 2025 22:02:13 +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 E21063EA65; Mon, 15 Dec 2025 22:02:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iOO4IWKFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836133; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gGtMleKybG0aL/ZIRF6KJDcnH5VwbKFjmAT93TCm7Jk=; b=pHrL77m60SoJag4CsWPea0RcLa0U05NOvjRLh7z/a1mG4DVuk5YraDXdkt86cERjxmtZ5d 7lhpniCbBy1YjuLIdeqZS8i+6MggSKwehxMX1fvnbqF97pRuTA3PyIkypbESwpG2yTWDxe Q/HQyCjL+Psg7pzQTjZZW4iGf/8fEzU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836133; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gGtMleKybG0aL/ZIRF6KJDcnH5VwbKFjmAT93TCm7Jk=; b=scb1jzfH740qFn5LjoVknoVS2peo6cMVbbPVV2w6vvGsbQV4lWlt1XVx343/VDFjJERcSQ Ti+0mzVL/bofezDA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=pHrL77m6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=scb1jzfH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836133; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gGtMleKybG0aL/ZIRF6KJDcnH5VwbKFjmAT93TCm7Jk=; b=pHrL77m60SoJag4CsWPea0RcLa0U05NOvjRLh7z/a1mG4DVuk5YraDXdkt86cERjxmtZ5d 7lhpniCbBy1YjuLIdeqZS8i+6MggSKwehxMX1fvnbqF97pRuTA3PyIkypbESwpG2yTWDxe Q/HQyCjL+Psg7pzQTjZZW4iGf/8fEzU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836133; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gGtMleKybG0aL/ZIRF6KJDcnH5VwbKFjmAT93TCm7Jk=; b=scb1jzfH740qFn5LjoVknoVS2peo6cMVbbPVV2w6vvGsbQV4lWlt1XVx343/VDFjJERcSQ Ti+0mzVL/bofezDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 33/51] tests/qtest/migration: Adapt the incoming cmdline for config passing Date: Mon, 15 Dec 2025 19:00:19 -0300 Message-ID: <20251215220041.12657-34-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 3154833742 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836336838158500 Content-Type: text/plain; charset="utf-8" Allow the -incoming command line option to pass the config object in json format. Regardless of whether config passing via -incoming will be a supported interface, we need for some tests to work with the config. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index df42a8a2c6..ebd41d3c9f 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -324,6 +324,7 @@ int migrate_args(char **from, char **to, const char *ur= i, MigrateStart *args) g_autofree gchar *arch_opts =3D NULL; gchar *cmd_source =3D NULL; gchar *cmd_target =3D NULL; + g_autofree gchar *config_opts =3D NULL; const gchar *ignore_stderr; g_autofree char *mem_object =3D NULL; const char *kvm_opts =3D NULL; @@ -428,17 +429,23 @@ int migrate_args(char **from, char **to, const char *= uri, MigrateStart *args) */ events =3D args->defer_target_connect ? "-global migration.x-events=3D= on" : ""; =20 + if (args->config) { + GString *json =3D qobject_to_json(QOBJECT(args->config)); + config_opts =3D g_strdup_printf("-incoming '%s'", json->str); + } + cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " "-machine %s,%s " "-name target,debug-threads=3Don " "%s " "-serial file:%s/dest_serial " "-incoming %s " - "%s %s %s %s", + "%s %s %s %s %s", kvm_opts ? kvm_opts : "", machine, machine_opts, memory_backend, tmpfs, args->incoming_defer ? "defer" : uri, + config_opts ? config_opts : "", events, arch_opts ? arch_opts : "", args->opts_target ? args->opts_target : "= ", @@ -503,9 +510,11 @@ int migrate_start(QTestState **from, QTestState **to, = const char *uri, bootfile_create(qtest_get_arch(), tmpfs, args->suspend_me); src_state.suspend_me =3D args->suspend_me; =20 + args->config =3D config_load(args->config); if (migrate_args(&cmd_source, &cmd_target, uri, args)) { return -1; } + config_put(args->config); =20 if (!args->only_target) { *from =3D qtest_init_ext(QEMU_ENV_SRC, cmd_source, capabilities, t= rue); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836386; cv=none; d=zohomail.com; s=zohoarc; b=TCeMlmW1kkXzjumtWvjYRANxfwgKS+C7m5snYGmBAgYVAdo9IaYOJJQTcMpu61WAhQsNCuiXriuE3QFPKq8yeIjzMHj9uuBZ8SmB7YR3RQfgP4uP9hhiKiFpV/6jDnbpI5r/qgJdpdNL4yxDXW9zo6cqdK4fURB+ktiogx+x8Xo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836386; 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=VelK7fLHQ6eX0P1c1YVlPHhMUBXgA0swSVzuX7SCq/A=; b=FJ4bjt0YlaOi0pOKZQrc7VJeVk+oe8yMa+TwFDNTu+WoNihTxYvIfipIkOHPjsCx2NNzezzpgclTufT33PWf5fQ7dShiFQqOtxGn3OcSn0dfy660rfCUKU8OYW9iFoahXUtZ/jcMSkTaMyncm4FkBI2rUs9P2IB3/iEWT4u6Vlc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836386798930.0830802025076; Mon, 15 Dec 2025 14:06:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGen-00065T-Mm; Mon, 15 Dec 2025 17:03:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGeU-0005Xf-Np for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:48 -0500 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 1vVGeR-0002wM-4j for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:46 -0500 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 D30E133779; Mon, 15 Dec 2025 22:02:15 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CD1E83EA63; Mon, 15 Dec 2025 22:02:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cIoAI2WFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836135; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VelK7fLHQ6eX0P1c1YVlPHhMUBXgA0swSVzuX7SCq/A=; b=f2k8jSWTV2wuTic2QVCeJHQOgSN1hfnGhdqiepzoEzqZWrRl17OzOGRTqmBPLbtOTOPfbl O4wTG8llsCpyxMY4aM2ApQyXL+fR0ldlEEr7SiS04F1kwJncjt0ypnTxhVraHyDO8ZalOJ Nl4+qaUAVB/YzwBGzjIRu234c4ouNew= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836135; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VelK7fLHQ6eX0P1c1YVlPHhMUBXgA0swSVzuX7SCq/A=; b=UEa6YAb1TAPaXsNs1Z6jQ2mPAd2ITBpKx1qyiJtZi+hyfFMWsjGg2/waymzrUdHqle4G9q bCSNF+y7MWdtrSCw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=f2k8jSWT; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UEa6YAb1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836135; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VelK7fLHQ6eX0P1c1YVlPHhMUBXgA0swSVzuX7SCq/A=; b=f2k8jSWTV2wuTic2QVCeJHQOgSN1hfnGhdqiepzoEzqZWrRl17OzOGRTqmBPLbtOTOPfbl O4wTG8llsCpyxMY4aM2ApQyXL+fR0ldlEEr7SiS04F1kwJncjt0ypnTxhVraHyDO8ZalOJ Nl4+qaUAVB/YzwBGzjIRu234c4ouNew= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836135; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VelK7fLHQ6eX0P1c1YVlPHhMUBXgA0swSVzuX7SCq/A=; b=UEa6YAb1TAPaXsNs1Z6jQ2mPAd2ITBpKx1qyiJtZi+hyfFMWsjGg2/waymzrUdHqle4G9q bCSNF+y7MWdtrSCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 34/51] tests/qtest/migration: Use migrate_incoming_qmp where possible Date: Mon, 15 Dec 2025 19:00:20 -0300 Message-ID: <20251215220041.12657-35-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: D30E133779 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836388009154100 Content-Type: text/plain; charset="utf-8" Always use the proper function for starting the incoming migration, there's no need to call QMP directly from the tests. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/cpr-tests.c | 19 ++++++++++++------- tests/qtest/migration/framework.c | 16 +++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 7456337370..280e671e4b 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -15,6 +15,8 @@ #include "migration/framework.h" #include "migration/migration-qmp.h" #include "migration/migration-util.h" +#include "qapi/error.h" +#include "qobject/qjson.h" =20 =20 static char *tmpfs; @@ -183,6 +185,7 @@ static void test_cpr_exec(MigrateCommon *args) g_autofree char *connect_uri =3D g_strdup(args->connect_uri); g_autofree char *filename =3D g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FILENAME); + g_autofree char *channels =3D NULL; =20 if (migrate_start(&from, NULL, args->listen_uri, &args->start)) { return; @@ -203,13 +206,15 @@ static void test_cpr_exec(MigrateCommon *args) =20 to =3D qtest_init_after_exec(from); =20 - qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," - " 'arguments': { " - " 'channels': [ { 'channel-type': 'main'= ," - " 'addr': { 'transport': 'file'," - " 'filename': %s," - " 'offset': 0 } } ] } }", - filename); + channels =3D g_strdup_printf("[ { 'channel-type': 'main'," + " 'addr': { 'transport': 'file'," + " 'filename': '%s'," + " 'offset': 0 } } ]", + filename); + + migrate_incoming_qmp(to, NULL, + qobject_from_json(channels, &error_abort), + "{}"); wait_for_migration_complete(to); =20 wait_for_resume(to, get_dst()); diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index ebd41d3c9f..227bc39303 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -579,6 +579,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, MigrateCommon *args) { QTestState *from, *to; + QObject *channels; =20 /* set postcopy capabilities */ args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME] =3D true; @@ -594,13 +595,14 @@ static int migrate_postcopy_prepare(QTestState **from= _ptr, =20 migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); - qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," - " 'arguments': { " - " 'channels': [ { 'channel-type': 'main'= ," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," - " 'port': '0' } } ] } }"); + + channels =3D qobject_from_json("[ { 'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]", + &error_abort); + migrate_incoming_qmp(to, NULL, channels, "{}"); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836238; cv=none; d=zohomail.com; s=zohoarc; b=aDgxyCtvgp3/a3kmeo7zgFoVDNsfrl348Nsy2NmhhIPBEubC4jAUzTSJ5fU5sFBwXGp8EPfTAOZbm+WM512vFbALnHUDJVUbrxiUh/rfEVQVoh79XxGQrEHzh9g8C4HBGG7qs+IkM/hHpU5Zm7MBhG1mmoiUltf32Xk+f3kO+v8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836238; 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=IqI0X7oXn5B9kGsqSF6ZqoV37V/bdDXnVUVjvBEXCqM=; b=dK6iQIlDP8feO4Kqu91aFkn8KSmx9wfH1rJlIfmbxFKmo/dAUKnCdFrtdZHVqxvtdgGcVK/9E8lzeAFJyClsTG8cE4inwisZ0ZDOhMpOZGhQGpCFFc0J91zDJoUQcv/hSttjoXb/JyKES3bQpW9u1eWe+tFxY2hZB81S6mOoCLY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176583623883955.19559825991155; Mon, 15 Dec 2025 14:03:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGes-0006th-7a; Mon, 15 Dec 2025 17:03:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGeb-0005lO-9e for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:59 -0500 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 1vVGeY-0002y0-Jj for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:02:52 -0500 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 7BAA133748; Mon, 15 Dec 2025 22:02:18 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 772403EA63; Mon, 15 Dec 2025 22:02:16 +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 +KEqDmiFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836138; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IqI0X7oXn5B9kGsqSF6ZqoV37V/bdDXnVUVjvBEXCqM=; b=dWmYDWrFfCcXvgef9DRDAd8MvZCRhC/21O2jUOK1hb9LfX/KObE6+jv+qK3uBkQwqUECHk cu/PrtUwE+gVtrpWNsOnbKBHCIZX+Qv936XM0FFc6EyZuaS1+YXQLUAp76VOZ4HZu37d6y iX8yIn1Oww++2UpdmGI5N1m+heafyOs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836138; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IqI0X7oXn5B9kGsqSF6ZqoV37V/bdDXnVUVjvBEXCqM=; b=cxeelZb+8lyb3qdFbj7s/PGloRcTLRG4j+Kuz7OLvgF8TCl+SttDPpQKiKM8NIWqa4yPQd tPPoCMIZanrUFZAw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836138; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IqI0X7oXn5B9kGsqSF6ZqoV37V/bdDXnVUVjvBEXCqM=; b=dWmYDWrFfCcXvgef9DRDAd8MvZCRhC/21O2jUOK1hb9LfX/KObE6+jv+qK3uBkQwqUECHk cu/PrtUwE+gVtrpWNsOnbKBHCIZX+Qv936XM0FFc6EyZuaS1+YXQLUAp76VOZ4HZu37d6y iX8yIn1Oww++2UpdmGI5N1m+heafyOs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836138; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IqI0X7oXn5B9kGsqSF6ZqoV37V/bdDXnVUVjvBEXCqM=; b=cxeelZb+8lyb3qdFbj7s/PGloRcTLRG4j+Kuz7OLvgF8TCl+SttDPpQKiKM8NIWqa4yPQd tPPoCMIZanrUFZAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 35/51] tests/qtest/migration: Add a config parameter to migrate_qmp functions Date: Mon, 15 Dec 2025 19:00:21 -0300 Message-ID: <20251215220041.12657-36-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836240450158500 Content-Type: text/plain; charset="utf-8" Add a config parameter to all migrate_qmp functions. All tests will be converted in the next patches to use the config instead of calling migrate_set_*. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/cpr-tests.c | 3 ++- tests/qtest/migration/framework.c | 33 ++++++++++++++---------- tests/qtest/migration/migration-qmp.c | 27 ++++++++++++++++--- tests/qtest/migration/migration-qmp.h | 13 +++++----- tests/qtest/migration/misc-tests.c | 11 ++++---- tests/qtest/migration/precopy-tests.c | 37 +++++++++++++++------------ tests/qtest/virtio-net-failover.c | 24 +++++++++++------ 7 files changed, 96 insertions(+), 52 deletions(-) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 280e671e4b..9883616cb5 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -201,7 +201,7 @@ static void test_cpr_exec(MigrateCommon *args) wait_for_serial("src_serial"); set_cpr_exec_args(from, args); migrate_set_capability(from, "events", true); - migrate_qmp(from, NULL, connect_uri, NULL, "{}"); + migrate_qmp(from, NULL, connect_uri, NULL, args->start.config, "{}"); wait_for_migration_event(from, "completed"); =20 to =3D qtest_init_after_exec(from); @@ -214,6 +214,7 @@ static void test_cpr_exec(MigrateCommon *args) =20 migrate_incoming_qmp(to, NULL, qobject_from_json(channels, &error_abort), + args->start.config, "{}"); wait_for_migration_complete(to); =20 diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 227bc39303..f740228cf2 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -602,13 +602,13 @@ static int migrate_postcopy_prepare(QTestState **from= _ptr, " 'host': '127.0.0.1'," " 'port': '0' } } ]", &error_abort); - migrate_incoming_qmp(to, NULL, channels, "{}"); + migrate_incoming_qmp(to, NULL, channels, args->start.config, "{}"); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); wait_for_suspend(from, &src_state); =20 - migrate_qmp(from, to, NULL, NULL, "{}"); + migrate_qmp(from, to, NULL, NULL, args->start.config, "{}"); =20 migrate_wait_for_dirty_mem(from, to); =20 @@ -666,9 +666,10 @@ static void wait_for_postcopy_status(QTestState *one, = const char *status) } =20 static void postcopy_recover_fail(QTestState *from, QTestState *to, - PostcopyRecoveryFailStage stage) + MigrateCommon *args) { #ifndef _WIN32 + PostcopyRecoveryFailStage stage =3D args->postcopy_recovery_fail_stage; bool fail_early =3D (stage =3D=3D POSTCOPY_FAIL_CHANNEL_ESTABLISH); int ret, pair1[2], pair2[2]; char c; @@ -717,7 +718,8 @@ static void postcopy_recover_fail(QTestState *from, QTe= stState *to, } =20 migrate_recover(to, "fd:fd-mig"); - migrate_qmp(from, to, "fd:fd-mig", NULL, "{'resume': true}"); + migrate_qmp(from, to, "fd:fd-mig", NULL, args->start.config, + "{'resume': true}"); =20 /* * Source QEMU has an extra RECOVER_SETUP phase, dest doesn't have it. @@ -824,7 +826,7 @@ void test_postcopy_recovery_common(MigrateCommon *args) * Test when a wrong socket specified for recover, and then the * ability to kick it out, and continue with a correct socket. */ - postcopy_recover_fail(from, to, args->postcopy_recovery_fail_stage= ); + postcopy_recover_fail(from, to, args); /* continue with a good recovery */ } =20 @@ -840,7 +842,7 @@ void test_postcopy_recovery_common(MigrateCommon *args) * Try to rebuild the migration channel using the resume flag and * the newly created channel */ - migrate_qmp(from, to, uri, NULL, "{'resume': true}"); + migrate_qmp(from, to, uri, NULL, args->start.config, "{'resume': true}= "); =20 /* Restore the postcopy bandwidth to unlimited */ migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); @@ -873,7 +875,8 @@ int test_precopy_common(MigrateCommon *args) in_channels =3D qobject_from_json(args->connect_channels, &error_abort); } - migrate_incoming_qmp(to, args->listen_uri, in_channels, "{}"); + migrate_incoming_qmp(to, args->listen_uri, in_channels, + args->start.config, "{}"); } =20 /* Wait for the first serial output from the source */ @@ -919,17 +922,20 @@ int test_precopy_common(MigrateCommon *args) } =20 if (args->result =3D=3D MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, args->connect_uri, out_channels, "{}"); + migrate_qmp_fail(from, args->connect_uri, out_channels, + args->start.config, "{}"); goto finish; } =20 - migrate_qmp(from, to, args->connect_uri, out_channels, "{}"); + migrate_qmp(from, to, args->connect_uri, out_channels, + args->start.config, "{}"); =20 if (args->start.defer_target_connect) { qtest_connect(to); qtest_qmp_handshake(to, NULL); if (args->start.incoming_defer) { - migrate_incoming_qmp(to, NULL, in_channels, "{}"); + migrate_incoming_qmp(to, args->connect_uri, in_channels, + args->start.config, "{}"); } } =20 @@ -1067,18 +1073,19 @@ void test_file_common(MigrateCommon *args, bool sto= p_src) } =20 if (args->result =3D=3D MIG_TEST_QMP_ERROR) { - migrate_qmp_fail(from, args->connect_uri, NULL, "{}"); + migrate_qmp_fail(from, args->connect_uri, NULL, + args->start.config, "{}"); goto finish; } =20 - migrate_qmp(from, to, args->connect_uri, NULL, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, args->start.config, "{}= "); wait_for_migration_complete(from); =20 /* * We need to wait for the source to finish before starting the * destination. */ - migrate_incoming_qmp(to, args->listen_uri, NULL, "{}"); + migrate_incoming_qmp(to, args->listen_uri, NULL, args->start.config, "= {}"); wait_for_migration_complete(to); =20 if (stop_src) { diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/= migration-qmp.c index 7fe47a5793..a4dde029ee 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -77,7 +77,7 @@ QObject *migrate_str_to_channel(const char *str) } =20 void migrate_qmp_fail(QTestState *who, const char *uri, - QObject *channels, const char *fmt, ...) + QObject *channels, QDict *config, const char *fmt, .= ..) { va_list ap; QDict *args, *err; @@ -96,12 +96,19 @@ void migrate_qmp_fail(QTestState *who, const char *uri, qdict_put_obj(args, "channels", channels); } =20 + config =3D config_load(config); + if (config) { + qdict_put_obj(args, "config", QOBJECT(config)); + qobject_ref(config); + } + err =3D qtest_qmp_assert_failure_ref( who, "{ 'execute': 'migrate', 'arguments': %p}", args); =20 g_assert(qdict_haskey(err, "desc")); =20 qobject_unref(err); + config_put(config); } =20 /* @@ -110,7 +117,7 @@ void migrate_qmp_fail(QTestState *who, const char *uri, * qobject_from_jsonf_nofail()) with "uri": @uri spliced in. */ void migrate_qmp(QTestState *who, QTestState *to, const char *uri, - QObject *channels, const char *fmt, ...) + QObject *channels, QDict *config, const char *fmt, ...) { va_list ap; QDict *args; @@ -135,8 +142,15 @@ void migrate_qmp(QTestState *who, QTestState *to, cons= t char *uri, qdict_put_obj(args, "channels", channels); } =20 + config =3D config_load(config); + if (config) { + qdict_put_obj(args, "config", QOBJECT(config)); + qobject_ref(config); + } + qtest_qmp_assert_success(who, "{ 'execute': 'migrate', 'arguments': %p}", a= rgs); + config_put(config); } =20 void migrate_set_capability(QTestState *who, const char *capability, @@ -151,7 +165,7 @@ void migrate_set_capability(QTestState *who, const char= *capability, } =20 void migrate_incoming_qmp(QTestState *to, const char *uri, QObject *channe= ls, - const char *fmt, ...) + QDict *config, const char *fmt, ...) { va_list ap; QDict *args, *rsp; @@ -173,6 +187,12 @@ void migrate_incoming_qmp(QTestState *to, const char *= uri, QObject *channels, /* This function relies on the event to work, make sure it's enabled */ migrate_set_capability(to, "events", true); =20 + config =3D config_load(config); + if (config) { + qdict_put_obj(args, "config", QOBJECT(config)); + qobject_ref(config); + } + rsp =3D qtest_qmp(to, "{ 'execute': 'migrate-incoming', 'arguments': %= p}", args); =20 @@ -185,6 +205,7 @@ void migrate_incoming_qmp(QTestState *to, const char *u= ri, QObject *channels, qobject_unref(rsp); =20 migration_event_wait(to, "setup"); + config_put(config); } =20 static bool check_migration_status(QTestState *who, const char *goal, diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/= migration-qmp.h index e465c69094..7daeb913fa 100644 --- a/tests/qtest/migration/migration-qmp.h +++ b/tests/qtest/migration/migration-qmp.h @@ -6,17 +6,18 @@ =20 QObject *migrate_str_to_channel(const char *str); =20 -G_GNUC_PRINTF(4, 5) +G_GNUC_PRINTF(5, 6) void migrate_qmp_fail(QTestState *who, const char *uri, - QObject *channels, const char *fmt, ...); + QObject *channels, QDict *config, const char *fmt, .= ..); =20 -G_GNUC_PRINTF(5, 6) +G_GNUC_PRINTF(6, 7) void migrate_qmp(QTestState *who, QTestState *to, const char *uri, - QObject *channels, const char *fmt, ...); + QObject *channels, QDict *config, const char *fmt, ...); =20 -G_GNUC_PRINTF(4, 5) +G_GNUC_PRINTF(5, 6) void migrate_incoming_qmp(QTestState *who, const char *uri, - QObject *channels, const char *fmt, ...); + QObject *channels, QDict *config, + const char *fmt, ...); =20 void migration_event_wait(QTestState *s, const char *target); void migrate_set_capability(QTestState *who, const char *capability, diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 0a737cb54f..c62fd1e3f9 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -31,7 +31,7 @@ static void test_baddest(char *name, MigrateCommon *args) if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; } - migrate_qmp(from, to, "tcp:127.0.0.1:0", NULL, "{}"); + migrate_qmp(from, to, "tcp:127.0.0.1:0", NULL, args->start.config, "{}= "); wait_for_migration_fail(from, false); migrate_end(from, to, false); } @@ -69,7 +69,7 @@ static void test_analyze_script(char *name, MigrateCommon= *args) uri =3D g_strdup_printf("exec:cat > %s", file); =20 migrate_ensure_converge(from, args->start.config); - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->start.config, "{}"); wait_for_migration_complete(from); =20 pid =3D fork(); @@ -108,7 +108,7 @@ static void test_ignore_shared(char *name, MigrateCommo= n *args) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->start.config, "{}"); =20 migrate_wait_for_dirty_mem(from, to); =20 @@ -146,7 +146,7 @@ static void do_test_validate_uuid(MigrateStart *args, b= ool should_fail) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 if (should_fail) { qtest_set_expected_status(to, EXIT_FAILURE); @@ -210,7 +210,8 @@ static void do_test_validate_uri_channel(MigrateCommon = *args) channels =3D args->connect_channels ? qobject_from_json(args->connect_channels, &error_abort) : NULL; - migrate_qmp_fail(from, args->connect_uri, channels, "{}"); + migrate_qmp_fail(from, args->connect_uri, channels, + args->start.config, "{}"); =20 migrate_end(from, to, false); } diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index eabbbf39c3..0b0f04bf19 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -382,7 +382,7 @@ static void test_auto_converge(char *name, MigrateCommo= n *args) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->start.config, "{}"); =20 /* Wait for throttling begins */ percentage =3D 0; @@ -577,12 +577,12 @@ static void test_multifd_tcp_cancel(MigrateCommon *ar= gs, bool postcopy_ram) migrate_set_capability(to, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, "{}"); + migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, args->start.config, = "{}"); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, to, NULL, NULL, "{}"); + migrate_qmp(from, to, NULL, NULL, args->start.config, "{}"); =20 migrate_wait_for_dirty_mem(from, to); =20 @@ -621,11 +621,12 @@ static void test_multifd_tcp_cancel(MigrateCommon *ar= gs, bool postcopy_ram) migrate_set_capability(to2, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, "{}"); + migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, args->start.config, + "{}"); =20 migrate_ensure_non_converge(from, args->start.config); =20 - migrate_qmp(from, to2, NULL, NULL, "{}"); + migrate_qmp(from, to2, NULL, NULL, args->start.config, "{}"); =20 migrate_wait_for_dirty_mem(from, to2); migrate_ongoing_ensure_converge(from); @@ -659,7 +660,7 @@ static void test_cancel_src_after_failed(QTestState *fr= om, QTestState *to, wait_for_serial("src_serial"); migrate_ensure_converge(from, args->config); =20 - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 migration_event_wait(from, phase); migrate_cancel(from); @@ -679,12 +680,13 @@ static void test_cancel_src_after_cancelled(QTestStat= e *from, QTestState *to, const char *uri, const char *p= hase, MigrateStart *args) { - migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); + migrate_incoming_qmp(to, uri, NULL, args->config, + "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); migrate_ensure_converge(from, args->config); =20 - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 /* To move to cancelled/cancelling */ migrate_cancel(from); @@ -704,12 +706,13 @@ static void test_cancel_src_after_complete(QTestState= *from, QTestState *to, const char *uri, const char *ph= ase, MigrateStart *args) { - migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); + migrate_incoming_qmp(to, uri, NULL, args->config, + "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); migrate_ensure_converge(from, args->config); =20 - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 migration_event_wait(from, phase); migrate_cancel(from); @@ -735,10 +738,11 @@ static void test_cancel_src_after_none(QTestState *fr= om, QTestState *to, wait_for_serial("src_serial"); migrate_cancel(from); =20 - migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); + migrate_incoming_qmp(to, uri, NULL, args->config, + "{ 'exit-on-error': false }"); =20 migrate_ensure_converge(from, args->config); - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 wait_for_migration_complete(from); wait_for_migration_complete(to); @@ -754,12 +758,13 @@ static void test_cancel_src_pre_switchover(QTestState= *from, QTestState *to, migrate_set_capability(from, "multifd", true); migrate_set_capability(to, "multifd", true); =20 - migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); + migrate_incoming_qmp(to, uri, NULL, args->config, + "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); migrate_ensure_converge(from, args->config); =20 - migrate_qmp(from, to, uri, NULL, "{}"); + migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 migration_event_wait(from, phase); migrate_cancel(from); @@ -1127,7 +1132,7 @@ static void test_dirty_limit(char *name, MigrateCommo= n *args) migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_va= lue); =20 /* Start migrate */ - migrate_qmp(from, to, args->connect_uri, NULL, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, args->start.config, "{}= "); =20 /* Wait for dirty limit throttle begin */ throttle_us_per_full =3D 0; @@ -1172,7 +1177,7 @@ static void test_dirty_limit(char *name, MigrateCommo= n *args) } =20 /* Start migrate */ - migrate_qmp(from, to, args->connect_uri, NULL, "{}"); + migrate_qmp(from, to, args->connect_uri, NULL, args->start.config, "{}= "); =20 /* Wait for dirty limit throttle begin */ throttle_us_per_full =3D 0; diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-fai= lover.c index 5baf81c3e6..e3edcfc9b7 100644 --- a/tests/qtest/virtio-net-failover.c +++ b/tests/qtest/virtio-net-failover.c @@ -741,7 +741,7 @@ static void test_migrate_out(gconstpointer opaque) static void test_migrate_in(gconstpointer opaque) { QTestState *qts; - QDict *resp, *ret; + QDict *resp, *ret, *config; g_autofree gchar *uri =3D g_strdup_printf("exec: cat %s", (gchar *)opa= que); =20 qts =3D machine_start(BASE_MACHINE @@ -773,7 +773,9 @@ static void test_migrate_in(gconstpointer opaque) check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, false, "primary0", MAC_PRIMARY0); =20 - migrate_incoming_qmp(qts, uri, NULL, "{}"); + config =3D qdict_new(); + migrate_incoming_qmp(qts, uri, NULL, config, "{}"); + qdict_unref(config); =20 resp =3D get_failover_negociated_event(qts); g_assert_cmpstr(qdict_get_str(resp, "device-id"), =3D=3D, "standby0"); @@ -863,7 +865,7 @@ static void test_off_migrate_out(gconstpointer opaque) static void test_off_migrate_in(gconstpointer opaque) { QTestState *qts; - QDict *ret; + QDict *ret, *config; g_autofree gchar *uri =3D g_strdup_printf("exec: cat %s", (gchar *)opa= que); =20 qts =3D machine_start(BASE_MACHINE @@ -895,7 +897,9 @@ static void test_off_migrate_in(gconstpointer opaque) check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, true, "primary0", MAC_PRIMARY0); =20 - migrate_incoming_qmp(qts, uri, NULL, "{}"); + config =3D qdict_new(); + migrate_incoming_qmp(qts, uri, NULL, config, "{}"); + qdict_unref(config); =20 check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, true, "primary0", MAC_PRIMARY0); @@ -990,7 +994,7 @@ static void test_guest_off_migrate_out(gconstpointer op= aque) static void test_guest_off_migrate_in(gconstpointer opaque) { QTestState *qts; - QDict *ret; + QDict *ret, *config; g_autofree gchar *uri =3D g_strdup_printf("exec: cat %s", (gchar *)opa= que); =20 qts =3D machine_start(BASE_MACHINE @@ -1022,7 +1026,9 @@ static void test_guest_off_migrate_in(gconstpointer o= paque) check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, false, "primary0", MAC_PRIMARY0); =20 - migrate_incoming_qmp(qts, uri, NULL, "{}"); + config =3D qdict_new(); + migrate_incoming_qmp(qts, uri, NULL, config, "{}"); + qdict_unref(config); =20 check_one_card(qts, true, "standby0", MAC_STANDBY0); check_one_card(qts, false, "primary0", MAC_PRIMARY0); @@ -1681,7 +1687,7 @@ static void test_multi_out(gconstpointer opaque) static void test_multi_in(gconstpointer opaque) { QTestState *qts; - QDict *resp, *ret; + QDict *resp, *ret, *config; g_autofree gchar *uri =3D g_strdup_printf("exec: cat %s", (gchar *)opa= que); =20 qts =3D machine_start(BASE_MACHINE @@ -1747,7 +1753,9 @@ static void test_multi_in(gconstpointer opaque) check_one_card(qts, true, "standby1", MAC_STANDBY1); check_one_card(qts, false, "primary1", MAC_PRIMARY1); =20 - migrate_incoming_qmp(qts, uri, NULL, "{}"); + config =3D qdict_new(); + migrate_incoming_qmp(qts, uri, NULL, config, "{}"); + qdict_unref(config); =20 resp =3D get_failover_negociated_event(qts); g_assert_cmpstr(qdict_get_str(resp, "device-id"), =3D=3D, "standby0"); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836389; cv=none; d=zohomail.com; s=zohoarc; b=AsvWDjQ/ZNMlN17QipAcBWoU4FcdAi+NYAI0X9fYrwxgCri4a82bLcZbIK/kUN5lHjOYfP44EdiVgdzSqJvYwtAnR9laKHPSnkE3ApErGbCOq/p/I8C1V0tw6Q7mWd0SZl3pO7Q3m+fliH87gpavvxdNoAp4nnK0ehwj3icFEmI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836389; 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=2jFdMS1Z2lRqRrJYTng2gKfXuEq0sp8Y5kW7KRGogFQ=; b=BVkHLeQSJyfQ0u9BOL4X9PS/ESCiAVY/xO11FU5faDpZ/+UGBAZ5vcAXOL8vv1gGFCmgbkUWW/u7tbYIki7okPFBJCOPZlj7WteJ/zVPo1WewmlUyLQCde2/kvY55PWUTaGytYMen6UVssbrcy+2d0AtYDsZljEHZEW3EI3m3KE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836389023111.74140729547617; Mon, 15 Dec 2025 14:06:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGer-0006eW-46; Mon, 15 Dec 2025 17:03:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGek-0005yO-U0 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:03 -0500 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 1vVGeh-0002zY-7p for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:01 -0500 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 0DD5C337B4; Mon, 15 Dec 2025 22:02:21 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 09ECA3EA63; Mon, 15 Dec 2025 22:02:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0LAsL2qFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836141; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2jFdMS1Z2lRqRrJYTng2gKfXuEq0sp8Y5kW7KRGogFQ=; b=1rpFtST9YwOZBdWtplud+Q5HjIJOHnSEX2CTkdvopF0KAuPVTItEcJmIWOqofoIuIhrwkC I9s4YkD32QApfjaIpXighP/TACn5zYTREJ1KD4zp4BIyeFJrJLqWM8OOpYvSRvStT1yLqx Pc+JN5g6wbyj8yKDDqm0M9qbtNNyT+Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836141; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2jFdMS1Z2lRqRrJYTng2gKfXuEq0sp8Y5kW7KRGogFQ=; b=1OUxg5uP3cu78Rm3/MiLk+tXgVfuVY5g2aZXMwO+o/bmPPdyJ4qEsj1TZZCaHVHNjz0ukd SrArRQJZ9CWpgODg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836141; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2jFdMS1Z2lRqRrJYTng2gKfXuEq0sp8Y5kW7KRGogFQ=; b=1rpFtST9YwOZBdWtplud+Q5HjIJOHnSEX2CTkdvopF0KAuPVTItEcJmIWOqofoIuIhrwkC I9s4YkD32QApfjaIpXighP/TACn5zYTREJ1KD4zp4BIyeFJrJLqWM8OOpYvSRvStT1yLqx Pc+JN5g6wbyj8yKDDqm0M9qbtNNyT+Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836141; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2jFdMS1Z2lRqRrJYTng2gKfXuEq0sp8Y5kW7KRGogFQ=; b=1OUxg5uP3cu78Rm3/MiLk+tXgVfuVY5g2aZXMwO+o/bmPPdyJ4qEsj1TZZCaHVHNjz0ukd SrArRQJZ9CWpgODg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 36/51] tests/qtest/migration: Move tls hook data out of specific hooks Date: Mon, 15 Dec 2025 19:00:22 -0300 Message-ID: <20251215220041.12657-37-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836390313154100 Content-Type: text/plain; charset="utf-8" The nesting of hooks in tls-tests.c is out of hand. It's quite unreadable and makes it a pain to solve git conflicts in that code. We're at this point moving away from setting migration parameters and capabilities with migrate_set_* in favor of the new config struct, which goes along with the migrate commmand. This means hooks will have to be reworked to allow some data to be accessed earlier than ->start_hook. Start cleaning up the tls-tests hooks to allow future patches to address both issues. This patch only deals with x509 code, while a later patch will appply the same changes to PSK. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/tls-tests.c | 155 ++++++++++++++++-------------- 1 file changed, 84 insertions(+), 71 deletions(-) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index f63f37132a..d50832573f 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -134,6 +134,76 @@ typedef struct { const char *certipaddr; } TestMigrateTLSX509; =20 +/* + * The normal case: match server's cert hostname against + * whatever host we were telling QEMU to connect to (if any) + */ +static TestMigrateTLSX509 tls_x509_default_host =3D { + .verifyclient =3D true, + .clientcert =3D true, + .certipaddr =3D "127.0.0.1" +}; + +/* + * The unusual case: the server's cert is different from + * the address we're telling QEMU to connect to (if any), + * so we must give QEMU an explicit hostname to validate + */ +static TestMigrateTLSX509 tls_x509_override_host =3D { + .verifyclient =3D true, + .clientcert =3D true, + .certhostname =3D "qemu.org", +}; + +/* + * The unusual case: the server's cert is different from + * the address we're telling QEMU to connect to, and so we + * expect the client to reject the server + */ +static TestMigrateTLSX509 tls_x509_mismatch_host =3D { + .verifyclient =3D true, + .clientcert =3D true, + .certipaddr =3D "10.0.0.1", +}; + +static TestMigrateTLSX509 x509_friendly_client =3D { + .verifyclient =3D true, + .clientcert =3D true, + .authzclient =3D true, + .certipaddr =3D "127.0.0.1", +}; + +static TestMigrateTLSX509 tls_x509_hostile_client =3D { + .verifyclient =3D true, + .clientcert =3D true, + .hostileclient =3D true, + .authzclient =3D true, + .certipaddr =3D "127.0.0.1", +}; + +/* + * The case with no client certificate presented, + * and no server verification + */ +static TestMigrateTLSX509 tls_x509_allow_anon_client =3D { + .certipaddr =3D "127.0.0.1", +}; + +/* + * The case with no client certificate presented, + * and server verification rejecting + */ +static TestMigrateTLSX509 tls_x509_reject_anon_client =3D { + .verifyclient =3D true, + .certipaddr =3D "127.0.0.1", +}; + +static TestMigrateTLSX509 tls_x509_no_host =3D { + .verifyclient =3D true, + .clientcert =3D true, + .authzclient =3D true, +}; + static void * migrate_hook_start_tls_x509_common(QTestState *from, QTestState *to, @@ -223,110 +293,58 @@ migrate_hook_start_tls_x509_common(QTestState *from, return data; } =20 -/* - * The normal case: match server's cert hostname against - * whatever host we were telling QEMU to connect to (if any) - */ static void * migrate_hook_start_tls_x509_default_host(QTestState *from, QTestState *to) { - TestMigrateTLSX509 args =3D { - .verifyclient =3D true, - .clientcert =3D true, - .certipaddr =3D "127.0.0.1" - }; - return migrate_hook_start_tls_x509_common(from, to, &args); + return migrate_hook_start_tls_x509_common(from, to, &tls_x509_default_= host); } =20 -/* - * The unusual case: the server's cert is different from - * the address we're telling QEMU to connect to (if any), - * so we must give QEMU an explicit hostname to validate - */ static void * migrate_hook_start_tls_x509_override_host(QTestState *from, QTestState *to) { - TestMigrateTLSX509 args =3D { - .verifyclient =3D true, - .clientcert =3D true, - .certhostname =3D "qemu.org", - }; - return migrate_hook_start_tls_x509_common(from, to, &args); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_override_host); } =20 -/* - * The unusual case: the server's cert is different from - * the address we're telling QEMU to connect to, and so we - * expect the client to reject the server - */ static void * migrate_hook_start_tls_x509_mismatch_host(QTestState *from, QTestState *to) { - TestMigrateTLSX509 args =3D { - .verifyclient =3D true, - .clientcert =3D true, - .certipaddr =3D "10.0.0.1", - }; - return migrate_hook_start_tls_x509_common(from, to, &args); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_mismatch_host); } =20 static void * migrate_hook_start_tls_x509_friendly_client(QTestState *from, QTestState *to) { - TestMigrateTLSX509 args =3D { - .verifyclient =3D true, - .clientcert =3D true, - .authzclient =3D true, - .certipaddr =3D "127.0.0.1", - }; - return migrate_hook_start_tls_x509_common(from, to, &args); + return migrate_hook_start_tls_x509_common(from, to, &x509_friendly_cli= ent); } =20 static void * migrate_hook_start_tls_x509_hostile_client(QTestState *from, QTestState *to) { - TestMigrateTLSX509 args =3D { - .verifyclient =3D true, - .clientcert =3D true, - .hostileclient =3D true, - .authzclient =3D true, - .certipaddr =3D "127.0.0.1", - }; - return migrate_hook_start_tls_x509_common(from, to, &args); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_hostile_client); } =20 -/* - * The case with no client certificate presented, - * and no server verification - */ static void * migrate_hook_start_tls_x509_allow_anon_client(QTestState *from, QTestState *to) { - TestMigrateTLSX509 args =3D { - .certipaddr =3D "127.0.0.1", - }; - return migrate_hook_start_tls_x509_common(from, to, &args); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_allow_anon_client); } =20 -/* - * The case with no client certificate presented, - * and server verification rejecting - */ static void * migrate_hook_start_tls_x509_reject_anon_client(QTestState *from, QTestState *to) { - TestMigrateTLSX509 args =3D { - .verifyclient =3D true, - .certipaddr =3D "127.0.0.1", - }; - return migrate_hook_start_tls_x509_common(from, to, &args); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_reject_anon_client= ); } =20 static void @@ -509,13 +527,8 @@ static void test_precopy_tcp_no_tls(char *name, Migrat= eCommon *args) static void * migrate_hook_start_tls_x509_no_host(QTestState *from, QTestState *to) { - TestMigrateTLSX509 args =3D { - .verifyclient =3D true, - .clientcert =3D true, - .authzclient =3D true, - }; - TestMigrateTLSX509Data *data =3D migrate_hook_start_tls_x509_common(fr= om, to, - &arg= s); + TestMigrateTLSX509Data *data =3D migrate_hook_start_tls_x509_common( + from, to, &tls_x509_no_host); migrate_set_parameter_null(from, "tls-hostname"); migrate_set_parameter_null(to, "tls-hostname"); =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836384; cv=none; d=zohomail.com; s=zohoarc; b=ZEUSubP07Otm/Ss/9asY5BvXXgLw9Fg7JoR0X3J48+cVJG6ympoL6WArZQ50hUiPk+BTztaNBhj2jmmbxKCfCCVDiV7bzAtTfzSn7bQzlaM7CihPW+NUYrLSFzas5w4UMqPz07TZfKpfVhlwRCx5eFs5VdEGF5qo2ON/r0MtgJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836384; 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=DumyBHiCFUhY6V6t2Mp/7FrVHpWBsR7MipuXJaxNuzk=; b=IeAk1jpiUHsmYVfgmmjCzim5KTUitbdGjhN4Rq5Z0d+k8g5zuiAPkU2lyeaqKaVmHiKtMsog7XhsBiWIQ0LPq34XpjLFx8R3y308VRDetIN/Qp9Fs985417AoIBVMwjTpHc6DcqYJHWUv5pT6YZplY81Qs4l51uc1jehjxhy+lA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836384516136.4596105546509; Mon, 15 Dec 2025 14:06:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGet-0006x1-2Y; Mon, 15 Dec 2025 17:03:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGej-0005xv-Ew for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:03 -0500 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 1vVGef-0002zP-Bh for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:00 -0500 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 9BEF95BDCA; Mon, 15 Dec 2025 22:02:23 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 957163EA63; Mon, 15 Dec 2025 22:02:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cBwTFW2FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836143; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DumyBHiCFUhY6V6t2Mp/7FrVHpWBsR7MipuXJaxNuzk=; b=1xIJyakG2sS1PEDB82t0LdUsbYBZguNlazNWpFlDezxm1VzBBKd8dPAGQ+EzxtaJ9ZRrA1 65nlrytj1sWxY288Sm0oUtEa6IOaChLW2F48agNhayVglQd1QX5ywjeFsg7LYGC2GRpgNI 7ZIZ1Akk5kbazHJ+yRCrRFc935JxtsE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836143; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DumyBHiCFUhY6V6t2Mp/7FrVHpWBsR7MipuXJaxNuzk=; b=3nkLzNmrtVshrtQL4wJTRlUhz+NFZw7FVHdoGfVcEZDbUN1FDRgRRO+ekzHP9ZgkgMjwlO kVjMQ6rUNH3x0UAA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=1xIJyakG; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=3nkLzNmr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836143; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DumyBHiCFUhY6V6t2Mp/7FrVHpWBsR7MipuXJaxNuzk=; b=1xIJyakG2sS1PEDB82t0LdUsbYBZguNlazNWpFlDezxm1VzBBKd8dPAGQ+EzxtaJ9ZRrA1 65nlrytj1sWxY288Sm0oUtEa6IOaChLW2F48agNhayVglQd1QX5ywjeFsg7LYGC2GRpgNI 7ZIZ1Akk5kbazHJ+yRCrRFc935JxtsE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836143; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DumyBHiCFUhY6V6t2Mp/7FrVHpWBsR7MipuXJaxNuzk=; b=3nkLzNmrtVshrtQL4wJTRlUhz+NFZw7FVHdoGfVcEZDbUN1FDRgRRO+ekzHP9ZgkgMjwlO kVjMQ6rUNH3x0UAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 37/51] tests/qtest/migration: Add new hook with data Date: Mon, 15 Dec 2025 19:00:23 -0300 Message-ID: <20251215220041.12657-38-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 9BEF95BDCA X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836385982154100 Content-Type: text/plain; charset="utf-8" Add a new start hook that takes an opaque pointer so the tests can stop having to nest hook calls. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/framework.c | 8 ++++++++ tests/qtest/migration/framework.h | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index f740228cf2..b9bbdca6a9 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -591,6 +591,9 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, =20 if (args->start_hook) { args->postcopy_data =3D args->start_hook(from, to); + } else if (args->start_hook_full) { + args->postcopy_data =3D args->start_hook_full(from, to, + args->start_hook_data); } =20 migrate_ensure_non_converge(from, args->start.config); @@ -868,6 +871,9 @@ int test_precopy_common(MigrateCommon *args) =20 if (args->start_hook) { data_hook =3D args->start_hook(from, to); + } else if (args->start_hook_full) { + data_hook =3D args->start_hook_full(from, to, + args->start_hook_data); } =20 if (args->start.incoming_defer && !args->start.defer_target_connect) { @@ -1062,6 +1068,8 @@ void test_file_common(MigrateCommon *args, bool stop_= src) =20 if (args->start_hook) { data_hook =3D args->start_hook(from, to); + } else if (args->start_hook_full) { + data_hook =3D args->start_hook_full(from, to, args->start_hook_dat= a); } =20 migrate_ensure_converge(from, args->start.config); diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 65c656e0d3..2584599f14 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -65,6 +65,19 @@ int migration_env_clean(MigrationTestEnv *env); typedef void * (*TestMigrateStartHook)(QTestState *from, QTestState *to); =20 + +/* + * A hook that runs after the src and dst QEMUs have been created, but + * before the migration is started. This can be used to run routines + * that require the QTestState object. + * + * Returns: NULL, or a pointer to opaque state to be + * later passed to the TestMigrateEndHook + */ +typedef void * (*TestMigrateStartHookFull)(QTestState *from, + QTestState *to, + void *opaque); + /* * A hook that runs after the migration has finished, * regardless of whether it succeeded or failed, but @@ -196,6 +209,9 @@ typedef struct { /* Optional: callback to run at finish to cleanup */ TestMigrateEndHook end_hook; =20 + TestMigrateStartHookFull start_hook_full; + void *start_hook_data; + /* * Optional: normally we expect the migration process to complete. * --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836318; cv=none; d=zohomail.com; s=zohoarc; b=SAmRDgby/WHUUwful4DPNO1Wegeil+3RLmqUucX7HBUm4JFyjLteZihcbOX8t97tq3B81jUQG7vSVhWPcBuGQzcamnbl1UofGmjHT2t3mJh4BUbmtE2bXLCSmh/BBfv5jnG8Ph3FAMvGHiXI8dw17rw13LhLlIK88QIbYMEmJ2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836318; 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=wfsR4cuI/tt0teFS9a0rpgqNCcAgFFOVh1mZjh5NV7s=; b=Ld4lMn5dMy20BZhN9j88Md49xsOf62N7lXpcisjxfTJylW9vw5tlNOM8YLfkiad7pixY0k6NDowqh/ea6UphEci+Ccj8DLfwDlJD8PrD/sAwHfJ3/S7Jh2Rl5UDWFTv9GvaAQrrIRjm3VAJokbHU/30uWW/YfxBu2YtCzNO9gxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836318879191.911191329767; Mon, 15 Dec 2025 14:05:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGev-0007Cj-BI; Mon, 15 Dec 2025 17:03:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGer-0006kt-9j for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:09 -0500 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 1vVGeo-00031Z-TC for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:08 -0500 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 3853833703; Mon, 15 Dec 2025 22:02:26 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2C2243EA63; Mon, 15 Dec 2025 22:02:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ABBUN2+FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836146; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wfsR4cuI/tt0teFS9a0rpgqNCcAgFFOVh1mZjh5NV7s=; b=ZClp95KJxd3ir4Fzaag/4GmGEQd4SKZVsxon1EoVcukJwcjK1WgcVTfO9S28fHODScN5z2 U6mZaFGSgZ3/Wy/78wPKG1v1+IFyXMbYsUqNbp19xQgi4UXpA7jBbkSNK0O0eXteQiKjRK R0OReAC/18kX5cyVguMqc11OPIjYDX4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836146; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wfsR4cuI/tt0teFS9a0rpgqNCcAgFFOVh1mZjh5NV7s=; b=BSb5g7f3IDYbuHODG5sl36FzyWhhJlKRkRYVlWF18uY4dI7P4xOtoJs1FqY6WCG7AstDO1 QIimCXlNhkt/OXCQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ZClp95KJ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BSb5g7f3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836146; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wfsR4cuI/tt0teFS9a0rpgqNCcAgFFOVh1mZjh5NV7s=; b=ZClp95KJxd3ir4Fzaag/4GmGEQd4SKZVsxon1EoVcukJwcjK1WgcVTfO9S28fHODScN5z2 U6mZaFGSgZ3/Wy/78wPKG1v1+IFyXMbYsUqNbp19xQgi4UXpA7jBbkSNK0O0eXteQiKjRK R0OReAC/18kX5cyVguMqc11OPIjYDX4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836146; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wfsR4cuI/tt0teFS9a0rpgqNCcAgFFOVh1mZjh5NV7s=; b=BSb5g7f3IDYbuHODG5sl36FzyWhhJlKRkRYVlWF18uY4dI7P4xOtoJs1FqY6WCG7AstDO1 QIimCXlNhkt/OXCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 38/51] tests/qtest/migration: TLS x509: Refactor to use full hook Date: Mon, 15 Dec 2025 19:00:24 -0300 Message-ID: <20251215220041.12657-39-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 3853833703 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836320863158500 Content-Type: text/plain; charset="utf-8" Refactor the TLS x509 hooks to use the _full variant which passes the hook data into the _common functions via MigrateCommon *args. This reduces the number of hooks and will allow further simplification of the TLS tests by setting a common hook at a centralized place in the next patches. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/tls-tests.c | 98 +++++++++---------------------- 1 file changed, 29 insertions(+), 69 deletions(-) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index d50832573f..8da95dc92a 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -207,8 +207,9 @@ static TestMigrateTLSX509 tls_x509_no_host =3D { static void * migrate_hook_start_tls_x509_common(QTestState *from, QTestState *to, - TestMigrateTLSX509 *args) + void *opaque) { + TestMigrateTLSX509 *args =3D opaque; TestMigrateTLSX509Data *data =3D g_new0(TestMigrateTLSX509Data, 1); =20 data->workdir =3D g_strdup_printf("%s/tlscredsx5090", tmpfs); @@ -293,60 +294,6 @@ migrate_hook_start_tls_x509_common(QTestState *from, return data; } =20 -static void * -migrate_hook_start_tls_x509_default_host(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_x509_common(from, to, &tls_x509_default_= host); -} - -static void * -migrate_hook_start_tls_x509_override_host(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_override_host); -} - -static void * -migrate_hook_start_tls_x509_mismatch_host(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_mismatch_host); -} - -static void * -migrate_hook_start_tls_x509_friendly_client(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_x509_common(from, to, &x509_friendly_cli= ent); -} - -static void * -migrate_hook_start_tls_x509_hostile_client(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_hostile_client); -} - -static void * -migrate_hook_start_tls_x509_allow_anon_client(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_allow_anon_client); -} - -static void * -migrate_hook_start_tls_x509_reject_anon_client(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_reject_anon_client= ); -} - static void migrate_hook_end_tls_x509(QTestState *from, QTestState *to, @@ -460,7 +407,8 @@ static void test_precopy_unix_tls_x509_default_host(cha= r *name, =20 args->connect_uri =3D uri; args->listen_uri =3D uri; - args->start_hook =3D migrate_hook_start_tls_x509_default_host; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_default_host; args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 @@ -476,7 +424,8 @@ static void test_precopy_unix_tls_x509_override_host(ch= ar *name, =20 args->connect_uri =3D uri; args->listen_uri =3D uri; - args->start_hook =3D migrate_hook_start_tls_x509_override_host; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_override_host; args->end_hook =3D migrate_hook_end_tls_x509; =20 test_precopy_common(args); @@ -552,7 +501,8 @@ static void test_precopy_tcp_tls_x509_default_host(char= *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_x509_default_host; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_default_host; args->end_hook =3D migrate_hook_end_tls_x509; =20 test_precopy_common(args); @@ -562,7 +512,8 @@ static void test_precopy_tcp_tls_x509_override_host(cha= r *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_x509_override_host; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_override_host; args->end_hook =3D migrate_hook_end_tls_x509; =20 test_precopy_common(args); @@ -572,7 +523,8 @@ static void test_precopy_tcp_tls_x509_mismatch_host(cha= r *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_x509_mismatch_host; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_mismatch_host; args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 @@ -585,7 +537,8 @@ static void test_precopy_tcp_tls_x509_friendly_client(c= har *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_x509_friendly_client; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &x509_friendly_client; args->end_hook =3D migrate_hook_end_tls_x509; =20 test_precopy_common(args); @@ -595,7 +548,8 @@ static void test_precopy_tcp_tls_x509_hostile_client(ch= ar *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_x509_hostile_client; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_hostile_client; args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; =20 @@ -608,7 +562,8 @@ static void test_precopy_tcp_tls_x509_allow_anon_client= (char *name, MigrateCommon *arg= s) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_x509_allow_anon_client; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_allow_anon_client; args->end_hook =3D migrate_hook_end_tls_x509; =20 test_precopy_common(args); @@ -618,7 +573,8 @@ static void test_precopy_tcp_tls_x509_reject_anon_clien= t(char *name, MigrateCommon *ar= gs) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_x509_reject_anon_client; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_reject_anon_client; args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; =20 @@ -650,7 +606,7 @@ migrate_hook_start_multifd_tls_x509_default_host(QTestS= tate *from, QTestState *to) { migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); - return migrate_hook_start_tls_x509_default_host(from, to); + return migrate_hook_start_tls_x509_common(from, to, &tls_x509_default_= host); } =20 static void * @@ -658,7 +614,8 @@ migrate_hook_start_multifd_tls_x509_override_host(QTest= State *from, QTestState *to) { migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); - return migrate_hook_start_tls_x509_override_host(from, to); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_override_host); } =20 static void * @@ -666,7 +623,8 @@ migrate_hook_start_multifd_tls_x509_mismatch_host(QTest= State *from, QTestState *to) { migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); - return migrate_hook_start_tls_x509_mismatch_host(from, to); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_mismatch_host); } =20 static void * @@ -674,7 +632,8 @@ migrate_hook_start_multifd_tls_x509_allow_anon_client(Q= TestState *from, QTestState *to) { migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); - return migrate_hook_start_tls_x509_allow_anon_client(from, to); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_allow_anon_client); } =20 static void * @@ -682,7 +641,8 @@ migrate_hook_start_multifd_tls_x509_reject_anon_client(= QTestState *from, QTestState *to) { migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); - return migrate_hook_start_tls_x509_reject_anon_client(from, to); + return migrate_hook_start_tls_x509_common(from, to, + &tls_x509_reject_anon_client= ); } #endif /* CONFIG_TASN1 */ =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836281; cv=none; d=zohomail.com; s=zohoarc; b=F5bTdBGKvzQe3vJUlw30d2RQVpZhclzEynVKgqYCTkYVEWKCudZKEnQ6obYOEWGeE8VdN4FyRA7N4iTuWeqLq4uXdiHTeShNli6EnaMxtpGqNLo5vkVF7BIvMY4G6z0E6WtDy5L6hCJqfymvaiuxuaOj5J+dph2hY4XM8eEmqAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836281; 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=FC6CX/jIGiLjvjNiNf8/2fb3OjzGYN4dvdc9R4+lUZc=; b=dZazAWIoJKr176SHtbM+okDEmruF51QGcKQZXEXsY1+ow4GbMhs/qW2QZSa+nWTv9SlIIUb9YXEXQYThcyaePX09nXwAh43vjIVqIFrp71L1WZe56Yo7xm6///xbL0iccxUlPG6knjPtnGma4I6kZeNbGGATjf2x2qhZml4wAwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836281536110.18467608136814; Mon, 15 Dec 2025 14:04:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGf1-00085j-B1; Mon, 15 Dec 2025 17:03:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGey-0007bP-B6 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:16 -0500 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 1vVGev-00033D-QA for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:15 -0500 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 BF53A337E0; Mon, 15 Dec 2025 22:02:28 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BAA013EA63; Mon, 15 Dec 2025 22:02:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iDR/HnKFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836148; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FC6CX/jIGiLjvjNiNf8/2fb3OjzGYN4dvdc9R4+lUZc=; b=zlFSqhVbiMObo5xr7qpW0LsLrzWfoymysU7APhKctikY1RAQW+T/kOCSBKBJcRqiDfsklw kZlRP5aoTu6v4iU10atKdyvQn6UhcUjmfggThZoLddbk2WlIo/NJNy2nuNHy67D01Lj0wu Qj0Dmue/5cJ6U1jsS2+sHjEGoYzaanc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836148; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FC6CX/jIGiLjvjNiNf8/2fb3OjzGYN4dvdc9R4+lUZc=; b=jIs8fzThYZNVTejZnUXbv5u7RFHttvVdEAgrv50BwiYu2LTqvGzUtbJjXfsBk2yBhHEHsG 6qUBplJY0wSxxWAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836148; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FC6CX/jIGiLjvjNiNf8/2fb3OjzGYN4dvdc9R4+lUZc=; b=zlFSqhVbiMObo5xr7qpW0LsLrzWfoymysU7APhKctikY1RAQW+T/kOCSBKBJcRqiDfsklw kZlRP5aoTu6v4iU10atKdyvQn6UhcUjmfggThZoLddbk2WlIo/NJNy2nuNHy67D01Lj0wu Qj0Dmue/5cJ6U1jsS2+sHjEGoYzaanc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836148; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FC6CX/jIGiLjvjNiNf8/2fb3OjzGYN4dvdc9R4+lUZc=; b=jIs8fzThYZNVTejZnUXbv5u7RFHttvVdEAgrv50BwiYu2LTqvGzUtbJjXfsBk2yBhHEHsG 6qUBplJY0wSxxWAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 39/51] tests/qtest/migration: TLS x509: Add init/cleanup routines Date: Mon, 15 Dec 2025 19:00:25 -0300 Message-ID: <20251215220041.12657-40-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836282784158500 Content-Type: text/plain; charset="utf-8" Split the TLS x509 hooks by moving out of them any code that doesn't need to access the QTestState. Aside from making the code harder to follow for no practical reason, having extra code in the hooks will soon get in the way of converting the tests to use a new API that, unlike migrate_set_parameters|capabilities, doesn't require the QEMU instance to be already live. Move the QTestState-independent code into a normal function and leave the hooks only for operations that need the guest machine. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/tls-tests.c | 155 +++++++++++++++--------------- 1 file changed, 75 insertions(+), 80 deletions(-) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 8da95dc92a..6a858b766f 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -210,15 +210,57 @@ migrate_hook_start_tls_x509_common(QTestState *from, void *opaque) { TestMigrateTLSX509 *args =3D opaque; - TestMigrateTLSX509Data *data =3D g_new0(TestMigrateTLSX509Data, 1); + const char *workdir =3D g_strdup_printf("%s/tlscredsx5090", tmpfs); =20 + qtest_qmp_assert_success(from, + "{ 'execute': 'object-add'," + " 'arguments': { 'qom-type': 'tls-creds-x509= '," + " 'id': 'tlscredsx509client0'= ," + " 'endpoint': 'client'," + " 'dir': %s," + " 'sanity-check': true," + " 'verify-peer': true} }", + workdir); + migrate_set_parameter_str(from, "tls-creds", "tlscredsx509client0"); + if (args->certhostname) { + migrate_set_parameter_str(from, "tls-hostname", args->certhostname= ); + } + + qtest_qmp_assert_success(to, + "{ 'execute': 'object-add'," + " 'arguments': { 'qom-type': 'tls-creds-x509= '," + " 'id': 'tlscredsx509server0'= ," + " 'endpoint': 'server'," + " 'dir': %s," + " 'sanity-check': true," + " 'verify-peer': %i} }", + workdir, args->verifyclient); + migrate_set_parameter_str(to, "tls-creds", "tlscredsx509server0"); + + if (args->authzclient) { + qtest_qmp_assert_success(to, + "{ 'execute': 'object-add'," + " 'arguments': { 'qom-type': 'authz-simp= le'," + " 'id': 'tlsauthz0'," + " 'identity': %s} }", + "CN=3D" QCRYPTO_TLS_TEST_CLIENT_NAME); + migrate_set_parameter_str(to, "tls-authz", "tlsauthz0"); + } + + return NULL; +} + +static void migrate_tls_x509_init(MigrateCommon *args, + TestMigrateTLSX509 *test_args, + TestMigrateTLSX509Data *data) +{ data->workdir =3D g_strdup_printf("%s/tlscredsx5090", tmpfs); data->keyfile =3D g_strdup_printf("%s/key.pem", data->workdir); =20 data->cacert =3D g_strdup_printf("%s/ca-cert.pem", data->workdir); data->serverkey =3D g_strdup_printf("%s/server-key.pem", data->workdir= ); data->servercert =3D g_strdup_printf("%s/server-cert.pem", data->workd= ir); - if (args->clientcert) { + if (test_args->clientcert) { data->clientkey =3D g_strdup_printf("%s/client-key.pem", data->wor= kdir); data->clientcert =3D g_strdup_printf("%s/client-cert.pem", data->w= orkdir); } @@ -231,7 +273,7 @@ migrate_hook_start_tls_x509_common(QTestState *from, #else g_assert(CreateHardLink(data->serverkey, data->keyfile, NULL) !=3D 0); #endif - if (args->clientcert) { + if (test_args->clientcert) { #ifndef _WIN32 g_assert(link(data->keyfile, data->clientkey) =3D=3D 0); #else @@ -240,9 +282,9 @@ migrate_hook_start_tls_x509_common(QTestState *from, } =20 TLS_ROOT_REQ_SIMPLE(cacertreq, data->cacert); - if (args->clientcert) { + if (test_args->clientcert) { TLS_CERT_REQ_SIMPLE_CLIENT(servercertreq, cacertreq, - args->hostileclient ? + test_args->hostileclient ? QCRYPTO_TLS_TEST_CLIENT_HOSTILE_NAME : QCRYPTO_TLS_TEST_CLIENT_NAME, data->clientcert); @@ -251,56 +293,14 @@ migrate_hook_start_tls_x509_common(QTestState *from, =20 TLS_CERT_REQ_SIMPLE_SERVER(clientcertreq, cacertreq, data->servercert, - args->certhostname, - args->certipaddr); + test_args->certhostname, + test_args->certipaddr); test_tls_deinit_cert(&clientcertreq); test_tls_deinit_cert(&cacertreq); - - qtest_qmp_assert_success(from, - "{ 'execute': 'object-add'," - " 'arguments': { 'qom-type': 'tls-creds-x509= '," - " 'id': 'tlscredsx509client0'= ," - " 'endpoint': 'client'," - " 'dir': %s," - " 'sanity-check': true," - " 'verify-peer': true} }", - data->workdir); - migrate_set_parameter_str(from, "tls-creds", "tlscredsx509client0"); - if (args->certhostname) { - migrate_set_parameter_str(from, "tls-hostname", args->certhostname= ); - } - - qtest_qmp_assert_success(to, - "{ 'execute': 'object-add'," - " 'arguments': { 'qom-type': 'tls-creds-x509= '," - " 'id': 'tlscredsx509server0'= ," - " 'endpoint': 'server'," - " 'dir': %s," - " 'sanity-check': true," - " 'verify-peer': %i} }", - data->workdir, args->verifyclient); - migrate_set_parameter_str(to, "tls-creds", "tlscredsx509server0"); - - if (args->authzclient) { - qtest_qmp_assert_success(to, - "{ 'execute': 'object-add'," - " 'arguments': { 'qom-type': 'authz-simp= le'," - " 'id': 'tlsauthz0'," - " 'identity': %s} }", - "CN=3D" QCRYPTO_TLS_TEST_CLIENT_NAME); - migrate_set_parameter_str(to, "tls-authz", "tlsauthz0"); - } - - return data; } =20 -static void -migrate_hook_end_tls_x509(QTestState *from, - QTestState *to, - void *opaque) +static void migrate_tls_x509_cleanup(TestMigrateTLSX509Data *data) { - TestMigrateTLSX509Data *data =3D opaque; - test_tls_cleanup(data->keyfile); g_free(data->keyfile); =20 @@ -325,6 +325,16 @@ migrate_hook_end_tls_x509(QTestState *from, =20 g_free(data); } + +static void test_precopy_tls_x509_common(MigrateCommon *args, + TestMigrateTLSX509 *test_args) +{ + TestMigrateTLSX509Data *data =3D g_new0(TestMigrateTLSX509Data, 1); + + migrate_tls_x509_init(args, test_args, data); + test_precopy_common(args); + migrate_tls_x509_cleanup(data); +} #endif /* CONFIG_TASN1 */ =20 static void test_postcopy_tls_psk(char *name, MigrateCommon *args) @@ -409,12 +419,11 @@ static void test_precopy_unix_tls_x509_default_host(c= har *name, args->listen_uri =3D uri; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &tls_x509_default_host; - args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 args->start.hide_stderr =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_default_host); } =20 static void test_precopy_unix_tls_x509_override_host(char *name, @@ -426,9 +435,8 @@ static void test_precopy_unix_tls_x509_override_host(ch= ar *name, args->listen_uri =3D uri; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &tls_x509_override_host; - args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_override_host); } #endif /* CONFIG_TASN1 */ =20 @@ -488,12 +496,11 @@ static void test_precopy_tcp_tls_no_hostname(char *na= me, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_tls_x509_no_host; - args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 args->start.hide_stderr =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_no_host); } =20 #ifdef CONFIG_TASN1 @@ -503,9 +510,8 @@ static void test_precopy_tcp_tls_x509_default_host(char= *name, args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &tls_x509_default_host; - args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_default_host); } =20 static void test_precopy_tcp_tls_x509_override_host(char *name, @@ -514,9 +520,8 @@ static void test_precopy_tcp_tls_x509_override_host(cha= r *name, args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &tls_x509_override_host; - args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_override_host); } =20 static void test_precopy_tcp_tls_x509_mismatch_host(char *name, @@ -525,12 +530,11 @@ static void test_precopy_tcp_tls_x509_mismatch_host(c= har *name, args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &tls_x509_mismatch_host; - args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 args->start.hide_stderr =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_mismatch_host); } =20 static void test_precopy_tcp_tls_x509_friendly_client(char *name, @@ -539,9 +543,8 @@ static void test_precopy_tcp_tls_x509_friendly_client(c= har *name, args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &x509_friendly_client; - args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &x509_friendly_client); } =20 static void test_precopy_tcp_tls_x509_hostile_client(char *name, @@ -550,12 +553,11 @@ static void test_precopy_tcp_tls_x509_hostile_client(= char *name, args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &tls_x509_hostile_client; - args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_hostile_client); } =20 static void test_precopy_tcp_tls_x509_allow_anon_client(char *name, @@ -564,9 +566,8 @@ static void test_precopy_tcp_tls_x509_allow_anon_client= (char *name, args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &tls_x509_allow_anon_client; - args->end_hook =3D migrate_hook_end_tls_x509; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_allow_anon_client); } =20 static void test_precopy_tcp_tls_x509_reject_anon_client(char *name, @@ -575,12 +576,11 @@ static void test_precopy_tcp_tls_x509_reject_anon_cli= ent(char *name, args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_x509_common; args->start_hook_data =3D &tls_x509_reject_anon_client; - args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_reject_anon_client); } #endif /* CONFIG_TASN1 */ =20 @@ -691,26 +691,24 @@ static void test_multifd_tcp_tls_x509_default_host(ch= ar *name, MigrateCommon *args) { args->start_hook =3D migrate_hook_start_multifd_tls_x509_default_host; - args->end_hook =3D migrate_hook_end_tls_x509; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_default_host); } =20 static void test_multifd_tcp_tls_x509_override_host(char *name, MigrateCommon *args) { args->start_hook =3D migrate_hook_start_multifd_tls_x509_override_host; - args->end_hook =3D migrate_hook_end_tls_x509; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_override_host); } =20 static void test_multifd_tcp_tls_x509_mismatch_host(char *name, @@ -730,7 +728,6 @@ static void test_multifd_tcp_tls_x509_mismatch_host(cha= r *name, * without exiting. */ args->start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host; - args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 @@ -738,27 +735,25 @@ static void test_multifd_tcp_tls_x509_mismatch_host(c= har *name, args->start.hide_stderr =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_mismatch_host); } =20 static void test_multifd_tcp_tls_x509_allow_anon_client(char *name, MigrateCommon *arg= s) { args->start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cl= ient; - args->end_hook =3D migrate_hook_end_tls_x509; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_allow_anon_client); } =20 static void test_multifd_tcp_tls_x509_reject_anon_client(char *name, MigrateCommon *ar= gs) { args->start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_c= lient; - args->end_hook =3D migrate_hook_end_tls_x509; args->result =3D MIG_TEST_FAIL; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 @@ -766,7 +761,7 @@ static void test_multifd_tcp_tls_x509_reject_anon_clien= t(char *name, args->start.hide_stderr =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_common(args); + test_precopy_tls_x509_common(args, &tls_x509_reject_anon_client); } #endif /* CONFIG_TASN1 */ =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836216; cv=none; d=zohomail.com; s=zohoarc; b=TI3zU1ErnmNaLn5bqmc4OcQs4VuM9oJqHDRT+2sy/hYXHx7YqOKUxt0vXIh9WeL/651sirPZRDd0gyHnLcPEXUxbHV+gMR51rU2I8wb8NXGeM1q1s8bCeZb1fyyK1i3v1fn9hSQi4kPBnpCsiVVM0BTuUQy070lH6S+DB2R/EZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836216; 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=3Kn2aTgGJ/0MobWDmu5uyVQfyYGUwkYy/He+BUbCRl0=; b=S1O/7uENHuTr6pVM3vbae7d1qVTZ/pDutXDmNuRhsjdD5GVpVFJV41yme1CSvXfhxRcUsLyd7zht3gBNHSz9bVAy+X4BqRQasL57QX/WLrh15uwBICca+pBFKBV5m1MDSqN8VtAZb0dJARwk27R481k8iAF2sTRUMKxBfHpxR5w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836216856187.2120717550739; Mon, 15 Dec 2025 14:03:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGf8-0000jR-UP; Mon, 15 Dec 2025 17:03:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGf4-0000HT-Nr for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:22 -0500 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 1vVGf2-000376-Fi for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:22 -0500 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 59ED5337EB; Mon, 15 Dec 2025 22:02:31 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 518483EA63; Mon, 15 Dec 2025 22:02:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QERKBHWFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836151; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Kn2aTgGJ/0MobWDmu5uyVQfyYGUwkYy/He+BUbCRl0=; b=yewJ7lJSd4CbD88zznGvSYzJnOl1kUcd7hudYNvHUvAuR3Z//Qkl9fGSSOyEwhusMq91/U DR8536I5bBKQlLF0iQ5ysAOadDtbbs6jFo24ttdjhsnBJsDis5N0aTxi7C8CFSwulkkL+i pkG9udAYYYmY2ec87tH9blv5nTYxRZ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836151; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Kn2aTgGJ/0MobWDmu5uyVQfyYGUwkYy/He+BUbCRl0=; b=jpyuqTklv01LlKSn0+utl2A+qbqlpJXTANzobq8kuEVZjcIhBwHdXMIA+fIxkc0WR87u+c u/muico3gltZcJBA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836151; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Kn2aTgGJ/0MobWDmu5uyVQfyYGUwkYy/He+BUbCRl0=; b=yewJ7lJSd4CbD88zznGvSYzJnOl1kUcd7hudYNvHUvAuR3Z//Qkl9fGSSOyEwhusMq91/U DR8536I5bBKQlLF0iQ5ysAOadDtbbs6jFo24ttdjhsnBJsDis5N0aTxi7C8CFSwulkkL+i pkG9udAYYYmY2ec87tH9blv5nTYxRZ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836151; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Kn2aTgGJ/0MobWDmu5uyVQfyYGUwkYy/He+BUbCRl0=; b=jpyuqTklv01LlKSn0+utl2A+qbqlpJXTANzobq8kuEVZjcIhBwHdXMIA+fIxkc0WR87u+c u/muico3gltZcJBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 40/51] tests/qtest/migration: TLS PSK: Refactor to use full hook Date: Mon, 15 Dec 2025 19:00:26 -0300 Message-ID: <20251215220041.12657-41-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836218387158500 Content-Type: text/plain; charset="utf-8" Similar to what's been done with the TLS x509 tests, pass an object in to the TLS PSK common hook so a couple of extra hooks can be removed, making the code easier to follow. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/tls-tests.c | 64 +++++++++++++++++-------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 6a858b766f..2eeed1fc5b 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -30,13 +30,26 @@ struct TestMigrateTLSPSKData { char *pskfilealt; }; =20 +typedef struct { + bool mismatch; +} TestMigrateTLSPSK; + +static TestMigrateTLSPSK tls_psk_match =3D { + .mismatch =3D false, +}; + +static TestMigrateTLSPSK tls_psk_mismatch =3D { + .mismatch =3D true, +}; + static char *tmpfs; =20 static void * migrate_hook_start_tls_psk_common(QTestState *from, QTestState *to, - bool mismatch) + void *opaque) { + TestMigrateTLSPSK *args =3D opaque; struct TestMigrateTLSPSKData *data =3D g_new0(struct TestMigrateTLSPSKData, 1); =20 @@ -46,7 +59,7 @@ migrate_hook_start_tls_psk_common(QTestState *from, g_mkdir_with_parents(data->workdir, 0700); test_tls_psk_init(data->pskfile); =20 - if (mismatch) { + if (args->mismatch) { data->workdiralt =3D g_strdup_printf("%s/tlscredspskalt0", tmpfs); data->pskfilealt =3D g_strdup_printf("%s/%s", data->workdiralt, QCRYPTO_TLS_CREDS_PSKFILE); @@ -69,7 +82,7 @@ migrate_hook_start_tls_psk_common(QTestState *from, " 'id': 'tlscredspsk0'," " 'endpoint': 'server'," " 'dir': %s } }", - mismatch ? data->workdiralt : data->workdir); + args->mismatch ? data->workdiralt : data->wor= kdir); =20 migrate_set_parameter_str(from, "tls-creds", "tlscredspsk0"); migrate_set_parameter_str(to, "tls-creds", "tlscredspsk0"); @@ -77,20 +90,6 @@ migrate_hook_start_tls_psk_common(QTestState *from, return data; } =20 -static void * -migrate_hook_start_tls_psk_match(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_psk_common(from, to, false); -} - -static void * -migrate_hook_start_tls_psk_mismatch(QTestState *from, - QTestState *to) -{ - return migrate_hook_start_tls_psk_common(from, to, true); -} - static void migrate_hook_end_tls_psk(QTestState *from, QTestState *to, @@ -339,7 +338,8 @@ static void test_precopy_tls_x509_common(MigrateCommon = *args, =20 static void test_postcopy_tls_psk(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_tls_psk_match; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 test_postcopy_common(args); @@ -347,7 +347,8 @@ static void test_postcopy_tls_psk(char *name, MigrateCo= mmon *args) =20 static void test_postcopy_preempt_tls_psk(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_tls_psk_match; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; @@ -357,7 +358,8 @@ static void test_postcopy_preempt_tls_psk(char *name, M= igrateCommon *args) =20 static void test_postcopy_recovery_tls_psk(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_tls_psk_match; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 test_postcopy_recovery_common(args); @@ -366,7 +368,8 @@ static void test_postcopy_recovery_tls_psk(char *name, = MigrateCommon *args) static void test_multifd_postcopy_recovery_tls_psk(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_tls_psk_match; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -377,7 +380,8 @@ static void test_multifd_postcopy_recovery_tls_psk(char= *name, /* This contains preempt+recovery+tls test altogether */ static void test_postcopy_preempt_all(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_tls_psk_match; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; @@ -388,7 +392,8 @@ static void test_postcopy_preempt_all(char *name, Migra= teCommon *args) static void test_multifd_postcopy_preempt_recovery_tls_psk(char *name, MigrateCommon *= args) { - args->start_hook =3D migrate_hook_start_tls_psk_match; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; @@ -403,7 +408,8 @@ static void test_precopy_unix_tls_psk(char *name, Migra= teCommon *args) =20 args->connect_uri =3D uri; args->listen_uri =3D uri; - args->start_hook =3D migrate_hook_start_tls_psk_match; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 test_precopy_common(args); @@ -443,7 +449,8 @@ static void test_precopy_unix_tls_x509_override_host(ch= ar *name, static void test_precopy_tcp_tls_psk_match(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_psk_match; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_match; args->end_hook =3D migrate_hook_end_tls_psk; =20 test_precopy_common(args); @@ -452,7 +459,8 @@ static void test_precopy_tcp_tls_psk_match(char *name, = MigrateCommon *args) static void test_precopy_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_psk_mismatch; + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D &tls_psk_mismatch; args->end_hook =3D migrate_hook_end_tls_psk; args->result =3D MIG_TEST_FAIL; =20 @@ -589,7 +597,7 @@ migrate_hook_start_multifd_tcp_tls_psk_match(QTestState= *from, QTestState *to) { migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); - return migrate_hook_start_tls_psk_match(from, to); + return migrate_hook_start_tls_psk_common(from, to, &tls_psk_match); } =20 static void * @@ -597,7 +605,7 @@ migrate_hook_start_multifd_tcp_tls_psk_mismatch(QTestSt= ate *from, QTestState *to) { migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); - return migrate_hook_start_tls_psk_mismatch(from, to); + return migrate_hook_start_tls_psk_common(from, to, &tls_psk_mismatch); } =20 #ifdef CONFIG_TASN1 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836237; cv=none; d=zohomail.com; s=zohoarc; b=EJdjrscZ4AvqsHZZUUMHMgCrtd+oS2kpSY5xpj57c8a6Gx6RY77EksHZTCFvw+t98NGzzJPMqNAgUZs2tcXmPU37rJESmAXDvOYwmNdYO9GHPWO3aM50RorpCFM9qYU72Dmv045PRBFgfOBOPcHLbTa3UTJjtxpKZ6JrjSMVMZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836237; 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=oaqejw6QbIIEISnVqLiykhW4s8zVxq/A8MJRBb+rqF4=; b=HCkeD3llwYXBHNC+7OIbHjYX/L7WBg8ABLD+w+UGCmdQUMsTHRVZrCjk6VylaXHH7DXJOwOyC+bxShJj4Iq84Eq+3o/CVR+Qe7vCh2qwDeQjUqOBaziqvn+bBLrPztCbP4GguFtQEwVD0b51pNxR5qy75/AhAkbKphiJ7yBZvhE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836236998514.8401428411587; Mon, 15 Dec 2025 14:03:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGfR-0001p8-AX; Mon, 15 Dec 2025 17:03:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGfA-0001Dl-LR for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:28 -0500 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 1vVGf8-00039g-FX for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:28 -0500 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 E5D68337EC; Mon, 15 Dec 2025 22:02:33 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DF9183EA63; Mon, 15 Dec 2025 22:02:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id GLJFJ3eFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836153; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oaqejw6QbIIEISnVqLiykhW4s8zVxq/A8MJRBb+rqF4=; b=hRhtyCONM0HgWmLN2y2u5KHLnm3RL0Nui/rPeajv/Z3e0o6p/aqNs71xmv6l3njThl9HwY TOJqk1646IqEjDHBqTFaWBGWNABr8PrKuDAo+mJjWlLHTAILQM6qEPUVz8kxNCzXawg30o mkxbc5u8D/jCNMHlAUm3J+kRjoiSuZQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836153; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oaqejw6QbIIEISnVqLiykhW4s8zVxq/A8MJRBb+rqF4=; b=62ly6vQiEfB4xe5c0+UCJR8FIih5qzsIWh+pXxM9GdcWohdShLclsbx9X6n6j13r1dJJmL AWVJtJWleG7CTzAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836153; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oaqejw6QbIIEISnVqLiykhW4s8zVxq/A8MJRBb+rqF4=; b=hRhtyCONM0HgWmLN2y2u5KHLnm3RL0Nui/rPeajv/Z3e0o6p/aqNs71xmv6l3njThl9HwY TOJqk1646IqEjDHBqTFaWBGWNABr8PrKuDAo+mJjWlLHTAILQM6qEPUVz8kxNCzXawg30o mkxbc5u8D/jCNMHlAUm3J+kRjoiSuZQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836153; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oaqejw6QbIIEISnVqLiykhW4s8zVxq/A8MJRBb+rqF4=; b=62ly6vQiEfB4xe5c0+UCJR8FIih5qzsIWh+pXxM9GdcWohdShLclsbx9X6n6j13r1dJJmL AWVJtJWleG7CTzAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 41/51] tests/qtest/migration: TLS PSK: Add init/cleanup routines Date: Mon, 15 Dec 2025 19:00:27 -0300 Message-ID: <20251215220041.12657-42-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836238481158500 Content-Type: text/plain; charset="utf-8" Move TLS PSK setup and cleanup into a common function instead of using hooks. Hooks are for when the test needs to access the QTestState. This primarily moves setup of TLS PSK tests from ->start_hook time earlier into test function call time, which brings the migrate_set_* calls within earlier, where they can be replaced in subsequent patches with the new config setup. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/tls-tests.c | 149 +++++++++++++++++------------- 1 file changed, 83 insertions(+), 66 deletions(-) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 2eeed1fc5b..aade57f7de 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -23,12 +23,12 @@ #endif /* CONFIG_TASN1 */ =20 =20 -struct TestMigrateTLSPSKData { +typedef struct { char *workdir; char *workdiralt; char *pskfile; char *pskfilealt; -}; +} TestMigrateTLSPSKData; =20 typedef struct { bool mismatch; @@ -44,59 +44,62 @@ static TestMigrateTLSPSK tls_psk_mismatch =3D { =20 static char *tmpfs; =20 -static void * -migrate_hook_start_tls_psk_common(QTestState *from, - QTestState *to, - void *opaque) +static void *migrate_hook_start_tls_psk_common(QTestState *from, + QTestState *to, + void *opaque) { TestMigrateTLSPSK *args =3D opaque; - struct TestMigrateTLSPSKData *data =3D - g_new0(struct TestMigrateTLSPSKData, 1); + g_autofree char *workdir =3D g_strdup_printf("%s/tlscredspsk0", tmpfs); + g_autofree char *workdiralt =3D NULL; =20 + if (args->mismatch) { + workdiralt =3D g_strdup_printf("%s/tlscredspskalt0", tmpfs); + } + + qtest_qmp_assert_success(from, + "{ 'execute': 'object-add'," + " 'arguments': { 'qom-type': 'tls-creds-psk'= ," + " 'id': 'tlscredspsk0'," + " 'endpoint': 'client'," + " 'dir': %s," + " 'username': 'qemu'} }", + workdir); + + qtest_qmp_assert_success(to, + "{ 'execute': 'object-add'," + " 'arguments': { 'qom-type': 'tls-creds-psk'= ," + " 'id': 'tlscredspsk0'," + " 'endpoint': 'server'," + " 'dir': %s } }", + args->mismatch ? workdiralt : workdir); + + migrate_set_parameter_str(from, "tls-creds", "tlscredspsk0"); + migrate_set_parameter_str(to, "tls-creds", "tlscredspsk0"); + + return NULL; +} + +static void migrate_tls_psk_init(MigrateCommon *args, + TestMigrateTLSPSK *test_args, + TestMigrateTLSPSKData *data) +{ data->workdir =3D g_strdup_printf("%s/tlscredspsk0", tmpfs); data->pskfile =3D g_strdup_printf("%s/%s", data->workdir, QCRYPTO_TLS_CREDS_PSKFILE); g_mkdir_with_parents(data->workdir, 0700); test_tls_psk_init(data->pskfile); =20 - if (args->mismatch) { + if (test_args->mismatch) { data->workdiralt =3D g_strdup_printf("%s/tlscredspskalt0", tmpfs); data->pskfilealt =3D g_strdup_printf("%s/%s", data->workdiralt, QCRYPTO_TLS_CREDS_PSKFILE); g_mkdir_with_parents(data->workdiralt, 0700); test_tls_psk_init_alt(data->pskfilealt); } - - qtest_qmp_assert_success(from, - "{ 'execute': 'object-add'," - " 'arguments': { 'qom-type': 'tls-creds-psk'= ," - " 'id': 'tlscredspsk0'," - " 'endpoint': 'client'," - " 'dir': %s," - " 'username': 'qemu'} }", - data->workdir); - - qtest_qmp_assert_success(to, - "{ 'execute': 'object-add'," - " 'arguments': { 'qom-type': 'tls-creds-psk'= ," - " 'id': 'tlscredspsk0'," - " 'endpoint': 'server'," - " 'dir': %s } }", - args->mismatch ? data->workdiralt : data->wor= kdir); - - migrate_set_parameter_str(from, "tls-creds", "tlscredspsk0"); - migrate_set_parameter_str(to, "tls-creds", "tlscredspsk0"); - - return data; } =20 -static void -migrate_hook_end_tls_psk(QTestState *from, - QTestState *to, - void *opaque) +static void migrate_tls_psk_cleanup(TestMigrateTLSPSKData *data) { - struct TestMigrateTLSPSKData *data =3D opaque; - test_tls_psk_cleanup(data->pskfile); if (data->pskfilealt) { test_tls_psk_cleanup(data->pskfilealt); @@ -113,6 +116,36 @@ migrate_hook_end_tls_psk(QTestState *from, g_free(data); } =20 +static void test_precopy_tls_psk_common(MigrateCommon *args, + TestMigrateTLSPSK *test_args) +{ + TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); + + migrate_tls_psk_init(args, test_args, data); + test_precopy_common(args); + migrate_tls_psk_cleanup(data); +} + +static void test_postcopy_tls_psk_common(MigrateCommon *args, + TestMigrateTLSPSK *test_args) +{ + TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); + + migrate_tls_psk_init(args, test_args, data); + test_postcopy_common(args); + migrate_tls_psk_cleanup(data); +} + +static void test_postcopy_recovery_tls_psk_common(MigrateCommon *args, + TestMigrateTLSPSK *test_= args) +{ + TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); + + migrate_tls_psk_init(args, test_args, data); + test_postcopy_recovery_common(args); + migrate_tls_psk_cleanup(data); +} + #ifdef CONFIG_TASN1 typedef struct { char *workdir; @@ -340,29 +373,26 @@ static void test_postcopy_tls_psk(char *name, Migrate= Common *args) { args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_common(args); + test_postcopy_tls_psk_common(args, &tls_psk_match); } =20 static void test_postcopy_preempt_tls_psk(char *name, MigrateCommon *args) { args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; =20 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_common(args); + test_postcopy_tls_psk_common(args, &tls_psk_match); } =20 static void test_postcopy_recovery_tls_psk(char *name, MigrateCommon *args) { args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); } =20 static void test_multifd_postcopy_recovery_tls_psk(char *name, @@ -370,11 +400,10 @@ static void test_multifd_postcopy_recovery_tls_psk(ch= ar *name, { args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; =20 args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); } =20 /* This contains preempt+recovery+tls test altogether */ @@ -382,11 +411,10 @@ static void test_postcopy_preempt_all(char *name, Mig= rateCommon *args) { args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; =20 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); } =20 static void test_multifd_postcopy_preempt_recovery_tls_psk(char *name, @@ -394,12 +422,11 @@ static void test_multifd_postcopy_preempt_recovery_tl= s_psk(char *name, { args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; =20 args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; =20 - test_postcopy_recovery_common(args); + test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); } =20 static void test_precopy_unix_tls_psk(char *name, MigrateCommon *args) @@ -410,9 +437,8 @@ static void test_precopy_unix_tls_psk(char *name, Migra= teCommon *args) args->listen_uri =3D uri; args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_precopy_common(args); + test_precopy_tls_psk_common(args, &tls_psk_match); } =20 #ifdef CONFIG_TASN1 @@ -451,9 +477,8 @@ static void test_precopy_tcp_tls_psk_match(char *name, = MigrateCommon *args) args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; =20 - test_precopy_common(args); + test_precopy_tls_psk_common(args, &tls_psk_match); } =20 static void test_precopy_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) @@ -461,30 +486,25 @@ static void test_precopy_tcp_tls_psk_mismatch(char *n= ame, MigrateCommon *args) args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_mismatch; - args->end_hook =3D migrate_hook_end_tls_psk; args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; =20 - test_precopy_common(args); + test_precopy_tls_psk_common(args, &tls_psk_mismatch); } =20 static void *migrate_hook_start_no_tls(QTestState *from, QTestState *to) { - struct TestMigrateTLSPSKData *data =3D - g_new0(struct TestMigrateTLSPSKData, 1); - migrate_set_parameter_null(from, "tls-creds"); migrate_set_parameter_null(to, "tls-creds"); =20 - return data; + return NULL; } =20 static void test_precopy_tcp_no_tls(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_no_tls; - args->end_hook =3D migrate_hook_end_tls_psk; =20 test_precopy_common(args); } @@ -657,19 +677,17 @@ migrate_hook_start_multifd_tls_x509_reject_anon_clien= t(QTestState *from, static void test_multifd_tcp_tls_psk_match(char *name, MigrateCommon *args) { args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_common(args); + test_precopy_tls_psk_common(args, &tls_psk_match); } =20 static void test_multifd_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch; - args->end_hook =3D migrate_hook_end_tls_psk; args->result =3D MIG_TEST_FAIL; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 @@ -677,21 +695,20 @@ static void test_multifd_tcp_tls_psk_mismatch(char *n= ame, MigrateCommon *args) args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_common(args); + test_precopy_tls_psk_common(args, &tls_psk_mismatch); } =20 static void test_multifd_postcopy_tcp_tls_psk_match(char *name, MigrateCommon *args) { args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; - args->end_hook =3D migrate_hook_end_tls_psk; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; =20 - test_precopy_common(args); + test_precopy_tls_psk_common(args, &tls_psk_match); } =20 #ifdef CONFIG_TASN1 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836408; cv=none; d=zohomail.com; s=zohoarc; b=Dz59ys8b66qvIdqe4wKwHfJhtuaHjk7h7YYjJKcX5jCWLjVtZOE0AtxNDKPgJFHAvmo+QNrs9u1NhlknEtFcLx/v/YBWETOdKAAA5Qmu2R8Wkdj1DCdTElwNq16dAXfoOb2P7mQkFvrfaxE5QSt0QUgR7wLf6CN9xJrhKXGJkHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836408; 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=5svvfSVfKlhQUUzj4Zr2+mOzyTqlhMOmC/BTiB93Qb0=; b=HlrShjB8Mh6TtGVWhQIbm1LsLAFpEeN0sLSce8zpQW3xqBiROWGLgsQ31vLnmwHyX3Hy3mzPFs1/NdusS4qZCTo+AnlCGY8vy0JzBvUdzdwbj5xW9/LhNm+UkYkhE+DbA19bnXGiCsGrfspuyTPsxEN6ZdxdTx90ds96+JpC/Aw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836408274166.19661007811408; Mon, 15 Dec 2025 14:06:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGet-00073e-Rw; Mon, 15 Dec 2025 17:03:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGer-0006lJ-Bv for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:09 -0500 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 1vVGeo-00031K-2A for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:08 -0500 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 8314F5BDC4; Mon, 15 Dec 2025 22:02:36 +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 80FA33EA63; Mon, 15 Dec 2025 22:02:34 +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 GEHNEHqFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836156; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5svvfSVfKlhQUUzj4Zr2+mOzyTqlhMOmC/BTiB93Qb0=; b=zQC+zcmmMCcK409q4u28jOFYszj4bHYJBu93/MqcgvUb8mJw37vOhF+iSRgOMWEoSUXPMo Toi3evAey8/id0X8Qgw3AzxGwyJf8EsHPd2GMsl3DY3bpCY4cCXLFPmyggnFDzyk7cpqYd wr77l0OPMNfd4GYGGi/oU3FLLvRlc4M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836156; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5svvfSVfKlhQUUzj4Zr2+mOzyTqlhMOmC/BTiB93Qb0=; b=g8tROh46rMfNPwLhiZz24lb3ziD9e+FA5F429LOORDWwWYSRL4faqJ0zjQj7s12A4llFzp n0aWiPbixMkuosAA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=zQC+zcmm; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=g8tROh46 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836156; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5svvfSVfKlhQUUzj4Zr2+mOzyTqlhMOmC/BTiB93Qb0=; b=zQC+zcmmMCcK409q4u28jOFYszj4bHYJBu93/MqcgvUb8mJw37vOhF+iSRgOMWEoSUXPMo Toi3evAey8/id0X8Qgw3AzxGwyJf8EsHPd2GMsl3DY3bpCY4cCXLFPmyggnFDzyk7cpqYd wr77l0OPMNfd4GYGGi/oU3FLLvRlc4M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836156; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5svvfSVfKlhQUUzj4Zr2+mOzyTqlhMOmC/BTiB93Qb0=; b=g8tROh46rMfNPwLhiZz24lb3ziD9e+FA5F429LOORDWwWYSRL4faqJ0zjQj7s12A4llFzp n0aWiPbixMkuosAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 42/51] tests/qtest/migration: Remove multifd compression hook Date: Mon, 15 Dec 2025 19:00:28 -0300 Message-ID: <20251215220041.12657-43-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 8314F5BDC4 X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836409329158500 Content-Type: text/plain; charset="utf-8" Remove the migrate_hook_start_precopy_tcp_multifd_common hook and open code its contents in the callers. This will simplify moving the migrate_set_parameters calls in the following patches. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/compression-tests.c | 25 ++++++++++++++++---- tests/qtest/migration/framework.c | 10 -------- tests/qtest/migration/framework.h | 4 ---- tests/qtest/migration/precopy-tests.c | 9 +++++--- tests/qtest/migration/tls-tests.c | 28 +++++++++++++++++------ 5 files changed, 47 insertions(+), 29 deletions(-) diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index bed39dece0..be60981f66 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -28,7 +28,10 @@ migrate_hook_start_precopy_tcp_multifd_zstd(QTestState *= from, migrate_set_parameter_int(from, "multifd-zstd-level", 2); migrate_set_parameter_int(to, "multifd-zstd-level", 2); =20 - return migrate_hook_start_precopy_tcp_multifd_common(from, to, "zstd"); + migrate_set_parameter_str(from, "multifd-compression", "zstd"); + migrate_set_parameter_str(to, "multifd-compression", "zstd"); + + return NULL; } =20 static void test_multifd_tcp_zstd(char *name, MigrateCommon *args) @@ -63,7 +66,10 @@ migrate_hook_start_precopy_tcp_multifd_qatzip(QTestState= *from, migrate_set_parameter_int(from, "multifd-qatzip-level", 2); migrate_set_parameter_int(to, "multifd-qatzip-level", 2); =20 - return migrate_hook_start_precopy_tcp_multifd_common(from, to, "qatzip= "); + migrate_set_parameter_str(from, "multifd-compression", "qatzip"); + migrate_set_parameter_str(to, "multifd-compression", "qatzip"); + + return NULL; } =20 static void test_multifd_tcp_qatzip(char *name, MigrateCommon *args) @@ -83,7 +89,10 @@ static void * migrate_hook_start_precopy_tcp_multifd_qpl(QTestState *from, QTestState *to) { - return migrate_hook_start_precopy_tcp_multifd_common(from, to, "qpl"); + migrate_set_parameter_str(from, "multifd-compression", "qpl"); + migrate_set_parameter_str(to, "multifd-compression", "qpl"); + + return NULL; } =20 static void test_multifd_tcp_qpl(char *name, MigrateCommon *args) @@ -103,7 +112,10 @@ static void * migrate_hook_start_precopy_tcp_multifd_uadk(QTestState *from, QTestState *to) { - return migrate_hook_start_precopy_tcp_multifd_common(from, to, "uadk"); + migrate_set_parameter_str(from, "multifd-compression", "uadk"); + migrate_set_parameter_str(to, "multifd-compression", "uadk"); + + return NULL; } =20 static void test_multifd_tcp_uadk(char *name, MigrateCommon *args) @@ -156,7 +168,10 @@ migrate_hook_start_precopy_tcp_multifd_zlib(QTestState= *from, migrate_set_parameter_int(from, "multifd-zlib-level", 2); migrate_set_parameter_int(to, "multifd-zlib-level", 2); =20 - return migrate_hook_start_precopy_tcp_multifd_common(from, to, "zlib"); + migrate_set_parameter_str(from, "multifd-compression", "zlib"); + migrate_set_parameter_str(to, "multifd-compression", "zlib"); + + return NULL; } =20 static void test_multifd_tcp_zlib(char *name, MigrateCommon *args) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index b9bbdca6a9..ecfeee570e 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -1115,16 +1115,6 @@ finish: migrate_end(from, to, args->result =3D=3D MIG_TEST_SUCCEED); } =20 -void *migrate_hook_start_precopy_tcp_multifd_common(QTestState *from, - QTestState *to, - const char *method) -{ - migrate_set_parameter_str(from, "multifd-compression", method); - migrate_set_parameter_str(to, "multifd-compression", method); - - return NULL; -} - QTestMigrationState *get_src(void) { return &src_state; diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 2584599f14..239fc54f82 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -272,10 +272,6 @@ void test_postcopy_common(MigrateCommon *args); void test_postcopy_recovery_common(MigrateCommon *args); int test_precopy_common(MigrateCommon *args); void test_file_common(MigrateCommon *args, bool stop_src); -void *migrate_hook_start_precopy_tcp_multifd_common(QTestState *from, - QTestState *to, - const char *method); - typedef struct QTestMigrationState QTestMigrationState; QTestMigrationState *get_src(void); QTestMigrationState *get_dst(void); diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 0b0f04bf19..01151301ce 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -452,14 +452,17 @@ static void * migrate_hook_start_precopy_tcp_multifd(QTestState *from, QTestState *to) { - return migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_set_parameter_str(from, "multifd-compression", "none"); + migrate_set_parameter_str(to, "multifd-compression", "none"); + + return NULL; } =20 static void * migrate_hook_start_precopy_tcp_multifd_zero_page_legacy(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_hook_start_precopy_tcp_multifd(from, to); migrate_set_parameter_str(from, "zero-page-detection", "legacy"); return NULL; } @@ -468,7 +471,7 @@ static void * migrate_hook_start_precopy_tcp_multifd_no_zero_page(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_hook_start_precopy_tcp_multifd(from, to); migrate_set_parameter_str(from, "zero-page-detection", "none"); return NULL; } diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index aade57f7de..5f561bc602 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -616,7 +616,9 @@ static void * migrate_hook_start_multifd_tcp_tls_psk_match(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_set_parameter_str(from, "multifd-compression", "none"); + migrate_set_parameter_str(to, "multifd-compression", "none"); + return migrate_hook_start_tls_psk_common(from, to, &tls_psk_match); } =20 @@ -624,7 +626,9 @@ static void * migrate_hook_start_multifd_tcp_tls_psk_mismatch(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_set_parameter_str(from, "multifd-compression", "none"); + migrate_set_parameter_str(to, "multifd-compression", "none"); + return migrate_hook_start_tls_psk_common(from, to, &tls_psk_mismatch); } =20 @@ -633,7 +637,9 @@ static void * migrate_hook_start_multifd_tls_x509_default_host(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_set_parameter_str(from, "multifd-compression", "none"); + migrate_set_parameter_str(to, "multifd-compression", "none"); + return migrate_hook_start_tls_x509_common(from, to, &tls_x509_default_= host); } =20 @@ -641,7 +647,9 @@ static void * migrate_hook_start_multifd_tls_x509_override_host(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_set_parameter_str(from, "multifd-compression", "none"); + migrate_set_parameter_str(to, "multifd-compression", "none"); + return migrate_hook_start_tls_x509_common(from, to, &tls_x509_override_host); } @@ -650,7 +658,9 @@ static void * migrate_hook_start_multifd_tls_x509_mismatch_host(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_set_parameter_str(from, "multifd-compression", "none"); + migrate_set_parameter_str(to, "multifd-compression", "none"); + return migrate_hook_start_tls_x509_common(from, to, &tls_x509_mismatch_host); } @@ -659,7 +669,9 @@ static void * migrate_hook_start_multifd_tls_x509_allow_anon_client(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_set_parameter_str(from, "multifd-compression", "none"); + migrate_set_parameter_str(to, "multifd-compression", "none"); + return migrate_hook_start_tls_x509_common(from, to, &tls_x509_allow_anon_client); } @@ -668,7 +680,9 @@ static void * migrate_hook_start_multifd_tls_x509_reject_anon_client(QTestState *from, QTestState *to) { - migrate_hook_start_precopy_tcp_multifd_common(from, to, "none"); + migrate_set_parameter_str(from, "multifd-compression", "none"); + migrate_set_parameter_str(to, "multifd-compression", "none"); + return migrate_hook_start_tls_x509_common(from, to, &tls_x509_reject_anon_client= ); } --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836309; cv=none; d=zohomail.com; s=zohoarc; b=Vea7CIieV6EgQlI1bIJg/Wdx4YEgQ42+JNCg9bRaJyaUhO0WujKAamqbMIJp9KwXEj6KSAGxBHoRKUV2fI+3x/w7gQxOQgCZW0IF9Nw/2O1JXoZ6JMFENfyK8q9wRDEJyZPzDOwIzEn24yOAIlOOScV0fZ41/aGsPlbY4Uh3FOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836309; 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=m3EAAXF/t2Le8CLhlGe+/S/F1KCweg+ZNh6980ehknw=; b=G4FD1v3siEJfs79qzoKhTqzFXGlriNzVhmjQMeMYfGp5zMvP75D59ZyFtnM+xaIuD9QPKL/TX95P+aeVJffQAmVqW1f60CkMpgYso7+s3+Ad7pMa2EHOp13OnYiksxQ2nDE9IxRM6wmR39alMYZGz2cUuFqk1TdjrLDZVT6Tju8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836309183412.32495600204265; Mon, 15 Dec 2025 14:05:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGez-0007pW-LK; Mon, 15 Dec 2025 17:03:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGex-0007Xs-NY for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:15 -0500 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 1vVGev-00033A-O2 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:15 -0500 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 1DD555BDDC; Mon, 15 Dec 2025 22:02:39 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 187B23EA63; Mon, 15 Dec 2025 22:02: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 ECfIMnyFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836159; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m3EAAXF/t2Le8CLhlGe+/S/F1KCweg+ZNh6980ehknw=; b=pu1fH6XzT/bwjoYyHRsqCqkjJS0fj0uMeBbLrwqlqzeHpkzrLBVwk7+pL+m/+YqM2gudHn qND3kyMt+IzdamRaCkXYAxMUADwxHQsOkezsyQ47UC113K+q4L6ZzIWjqn+DQyUt+/muw/ eum/I3O8qdeM4y9drlzB+DU/UUdv3KQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836159; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m3EAAXF/t2Le8CLhlGe+/S/F1KCweg+ZNh6980ehknw=; b=z+M0yXay1/id/ssi0USQXhI4QvTA1ASJY0kEn4EzTayjGvlFQAHV9Cu5Fez3YATmR/mg8e Bfxq8I2Gu0+6kICw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836159; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m3EAAXF/t2Le8CLhlGe+/S/F1KCweg+ZNh6980ehknw=; b=pu1fH6XzT/bwjoYyHRsqCqkjJS0fj0uMeBbLrwqlqzeHpkzrLBVwk7+pL+m/+YqM2gudHn qND3kyMt+IzdamRaCkXYAxMUADwxHQsOkezsyQ47UC113K+q4L6ZzIWjqn+DQyUt+/muw/ eum/I3O8qdeM4y9drlzB+DU/UUdv3KQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836159; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m3EAAXF/t2Le8CLhlGe+/S/F1KCweg+ZNh6980ehknw=; b=z+M0yXay1/id/ssi0USQXhI4QvTA1ASJY0kEn4EzTayjGvlFQAHV9Cu5Fez3YATmR/mg8e Bfxq8I2Gu0+6kICw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 43/51] tests/qtest/migration: Convert postcopy tests to use config Date: Mon, 15 Dec 2025 19:00:29 -0300 Message-ID: <20251215220041.12657-44-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.987]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836310980154100 Content-Type: text/plain; charset="utf-8" Make the postcopy tests (including TLS) pass a config argument to migration QMP commands. Temporarily, set the use-config key to enable the new method. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration/framework.c | 10 ++++++++-- tests/qtest/migration/postcopy-tests.c | 10 +++++----- tests/qtest/migration/tls-tests.c | 14 +++++++++----- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index ecfeee570e..8f179ea2fa 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -582,8 +582,8 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, QObject *channels; =20 /* set postcopy capabilities */ - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME] =3D true; - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; + qdict_put_bool(args->start.config, "postcopy-blocktime", true); + qdict_put_bool(args->start.config, "postcopy-ram", true); =20 if (migrate_start(&from, &to, "defer", &args->start)) { return -1; @@ -652,6 +652,9 @@ void test_postcopy_common(MigrateCommon *args) { QTestState *from, *to; =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + if (migrate_postcopy_prepare(&from, &to, args)) { return; } @@ -785,6 +788,9 @@ void test_postcopy_recovery_common(MigrateCommon *args) QTestState *from, *to; g_autofree char *uri =3D NULL; =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + /* * Always enable OOB QMP capability for recovery tests, migrate-recove= r is * executed out-of-band diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration= /postcopy-tests.c index 7ae4d765d7..5136a26abd 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -34,7 +34,7 @@ static void test_postcopy_suspend(char *name, MigrateComm= on *args) =20 static void test_postcopy_preempt(char *name, MigrateCommon *args) { - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 test_postcopy_common(args); } @@ -62,7 +62,7 @@ static void test_postcopy_recovery_fail_reconnect(char *n= ame, =20 static void test_postcopy_preempt_recovery(char *name, MigrateCommon *args) { - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 test_postcopy_recovery_common(args); } @@ -80,15 +80,15 @@ static void migration_test_add_postcopy_smoke(Migration= TestEnv *env) =20 static void test_multifd_postcopy(char *name, MigrateCommon *args) { - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + qdict_put_bool(args->start.config, "multifd", true); =20 test_postcopy_common(args); } =20 static void test_multifd_postcopy_preempt(char *name, MigrateCommon *args) { - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 test_postcopy_common(args); } diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 5f561bc602..abd6bf9281 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -131,6 +131,8 @@ static void test_postcopy_tls_psk_common(MigrateCommon = *args, { TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); =20 + qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0"); + migrate_tls_psk_init(args, test_args, data); test_postcopy_common(args); migrate_tls_psk_cleanup(data); @@ -141,6 +143,8 @@ static void test_postcopy_recovery_tls_psk_common(Migra= teCommon *args, { TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); =20 + qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0"); + migrate_tls_psk_init(args, test_args, data); test_postcopy_recovery_common(args); migrate_tls_psk_cleanup(data); @@ -382,7 +386,7 @@ static void test_postcopy_preempt_tls_psk(char *name, M= igrateCommon *args) args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; =20 - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 test_postcopy_tls_psk_common(args, &tls_psk_match); } @@ -401,7 +405,7 @@ static void test_multifd_postcopy_recovery_tls_psk(char= *name, args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; =20 - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + qdict_put_bool(args->start.config, "multifd", true); =20 test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); } @@ -412,7 +416,7 @@ static void test_postcopy_preempt_all(char *name, Migra= teCommon *args) args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; =20 - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); } @@ -423,8 +427,8 @@ static void test_multifd_postcopy_preempt_recovery_tls_= psk(char *name, args->start_hook_full =3D migrate_hook_start_tls_psk_common; args->start_hook_data =3D &tls_psk_match; =20 - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] =3D true; + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); } --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836299; cv=none; d=zohomail.com; s=zohoarc; b=NJfevLeeKfYcbGsOEhM1CwjSdJKEYoS1afDat0b5D7ZImed789qgAsXmERmXQBhYAPAPj/TOQizsZO9bk+7gq4w4yKq4Zimau/v6MpvjAcyDHiWiy+iLsxOni071Bm5XNoK610MJAUD6LwAEVXt1+mZymResJ2BOgmN87QTYcWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836299; 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=Asv0nckwgRbIXiiEg8gYC5OI3TeaKDkPOJPdSQRaX6o=; b=GI5ImHOxOqMPbstza5G6S0j2lW0tz1kZNRbI3etk0/Tgw1Me8RGszkwQfSP70q6NH82izQcEfE8ILb0yQy6O2UT6LaZHfUn8RfYFYgh8VA1bS8SkkwbEQvVdLBJl7isNG2D61L8YTvJaWeLB3fDV2uAKSu9JMbYqC5/tN8vH3fE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836299759469.98693821319375; Mon, 15 Dec 2025 14:04:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGf5-0000OK-J3; Mon, 15 Dec 2025 17:03:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGf3-0008TU-Et for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:21 -0500 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 1vVGf1-000359-8b for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:21 -0500 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 A4FA45BD2A; Mon, 15 Dec 2025 22:02:41 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9FBB23EA63; Mon, 15 Dec 2025 22:02:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id SDg1GH+FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Asv0nckwgRbIXiiEg8gYC5OI3TeaKDkPOJPdSQRaX6o=; b=TvVaBPYBkZIuR70fiDUeSMGEVJ81atnZ62IS81kPJbbrsNrqWToshtfaR3XMC6RXa9ijM1 ClzvrIsWgb13klFNaIQecYxiPl/zkbGp4xq5uTWt6piyyLkOLJHwxYPNZshOyo2nbTTk+h 13JRRNa14bmnJjvFgYJ5FLFMWnjt3i8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Asv0nckwgRbIXiiEg8gYC5OI3TeaKDkPOJPdSQRaX6o=; b=j18vZwMASWffzbvzG2rKKvs+IMJnO/kUIlgl+b0WOP8ZuHJNyugG7IF4wwwqF3WOo6KBkE c2kAb8folbWnjcBQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=TvVaBPYB; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=j18vZwMA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Asv0nckwgRbIXiiEg8gYC5OI3TeaKDkPOJPdSQRaX6o=; b=TvVaBPYBkZIuR70fiDUeSMGEVJ81atnZ62IS81kPJbbrsNrqWToshtfaR3XMC6RXa9ijM1 ClzvrIsWgb13klFNaIQecYxiPl/zkbGp4xq5uTWt6piyyLkOLJHwxYPNZshOyo2nbTTk+h 13JRRNa14bmnJjvFgYJ5FLFMWnjt3i8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Asv0nckwgRbIXiiEg8gYC5OI3TeaKDkPOJPdSQRaX6o=; b=j18vZwMASWffzbvzG2rKKvs+IMJnO/kUIlgl+b0WOP8ZuHJNyugG7IF4wwwqF3WOo6KBkE c2kAb8folbWnjcBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 44/51] tests/qtest/migration: Convert TLS PSK tests to use config Date: Mon, 15 Dec 2025 19:00:30 -0300 Message-ID: <20251215220041.12657-45-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim,suse.de:mid]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: A4FA45BD2A X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836300713158500 Content-Type: text/plain; charset="utf-8" Replace calls to migrate_set_parameters and the usage of args.caps with the new config object API. The multifd tests are now the same as the "precopy" tests, only setting some multifd options, so reuse the precopy code. Temporarily, set the use-config key to enable the new method. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/tls-tests.c | 72 +++++++++---------------------- 1 file changed, 20 insertions(+), 52 deletions(-) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index abd6bf9281..68304a7af3 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -73,9 +73,6 @@ static void *migrate_hook_start_tls_psk_common(QTestState= *from, " 'dir': %s } }", args->mismatch ? workdiralt : workdir); =20 - migrate_set_parameter_str(from, "tls-creds", "tlscredspsk0"); - migrate_set_parameter_str(to, "tls-creds", "tlscredspsk0"); - return NULL; } =20 @@ -121,6 +118,11 @@ static void test_precopy_tls_psk_common(MigrateCommon = *args, { TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + + qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0"); + migrate_tls_psk_init(args, test_args, data); test_precopy_common(args); migrate_tls_psk_cleanup(data); @@ -497,18 +499,11 @@ static void test_precopy_tcp_tls_psk_mismatch(char *n= ame, MigrateCommon *args) test_precopy_tls_psk_common(args, &tls_psk_mismatch); } =20 -static void *migrate_hook_start_no_tls(QTestState *from, QTestState *to) -{ - migrate_set_parameter_null(from, "tls-creds"); - migrate_set_parameter_null(to, "tls-creds"); - - return NULL; -} - static void test_precopy_tcp_no_tls(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_no_tls; + + qdict_put_null(args->start.config, "tls-creds"); =20 test_precopy_common(args); } @@ -614,29 +609,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_clie= nt(char *name, =20 test_precopy_tls_x509_common(args, &tls_x509_reject_anon_client); } -#endif /* CONFIG_TASN1 */ =20 -static void * -migrate_hook_start_multifd_tcp_tls_psk_match(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "none"); - migrate_set_parameter_str(to, "multifd-compression", "none"); - - return migrate_hook_start_tls_psk_common(from, to, &tls_psk_match); -} - -static void * -migrate_hook_start_multifd_tcp_tls_psk_mismatch(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "none"); - migrate_set_parameter_str(to, "multifd-compression", "none"); - - return migrate_hook_start_tls_psk_common(from, to, &tls_psk_mismatch); -} - -#ifdef CONFIG_TASN1 static void * migrate_hook_start_multifd_tls_x509_default_host(QTestState *from, QTestState *to) @@ -694,39 +667,34 @@ migrate_hook_start_multifd_tls_x509_reject_anon_clien= t(QTestState *from, =20 static void test_multifd_tcp_tls_psk_match(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; - args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_tls_psk_common(args, &tls_psk_match); + qdict_put_str(args->start.config, "multifd-compression", "none"); + qdict_put_bool(args->start.config, "multifd", true); + + test_precopy_tcp_tls_psk_match(name, args); } =20 static void test_multifd_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { - args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_mismatch; - args->result =3D MIG_TEST_FAIL; - args->listen_uri =3D "tcp:127.0.0.1:0"; - - args->start.hide_stderr =3D true; args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 - test_precopy_tls_psk_common(args, &tls_psk_mismatch); + qdict_put_str(args->start.config, "multifd-compression", "none"); + qdict_put_bool(args->start.config, "multifd", true); + + test_precopy_tcp_tls_psk_mismatch(name, args); } =20 static void test_multifd_postcopy_tcp_tls_psk_match(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_multifd_tcp_tls_psk_match; - args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; =20 - test_precopy_tls_psk_common(args, &tls_psk_match); + qdict_put_str(args->start.config, "multifd-compression", "none"); + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "postcopy-ram", true); + + test_precopy_tcp_tls_psk_match(name, args); } =20 #ifdef CONFIG_TASN1 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836299; cv=none; d=zohomail.com; s=zohoarc; b=X5tDpgZsGH+TGsHlfg6+iDqANMVJLggk/Ze/nCIkVmKiaVB4LNdjLo/n72C8e/jpldgHxoKvNXtlDgwyb/i4thn2clp1nX2gWUxIJc5yeqfe0YFvEma3Z7ZALQyKD+M0BbBGPaySzX0hT3fGt3brqA0yrnaa7jwxaa2OExREVXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836299; 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=5DMP/q2btvgcXeqHj+XzP+a3Z6jT5Co32VSxUCUeL+M=; b=MjLJzF5DcwgR1gcqdjaGKLLKN6mADrimDhMiBERu7jsyYk/uSkvfUBzziLSnUNM6Dv4DflJNkHdXs63gzJ8q4TsvVa8H+ZPZgv5bShY6WJK4QB/62KZyZ24L6DQ1nMhgv3o3/yKNDB5C3cwYfCkpDn8f4zCcMs7/yEIl/Iugsoc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836299830142.58144738468854; Mon, 15 Dec 2025 14:04:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGfU-0002LP-Cc; Mon, 15 Dec 2025 17:03:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGfK-0001Vh-Jj for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:42 -0500 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 1vVGfG-0003Bv-GF for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:37 -0500 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 5B58633742; Mon, 15 Dec 2025 22:02: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 3D1AC3EA65; Mon, 15 Dec 2025 22:02:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oAw/AIKFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836164; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5DMP/q2btvgcXeqHj+XzP+a3Z6jT5Co32VSxUCUeL+M=; b=oz4DzvEt8AeJ1zhVq1G0AS4OnmPtPArluLoAwYxHtQIciBeAJlMqVMyLP5D0OLYnjoMKQW RgpfNWxXGKzbWmJ0LregU6Pd4ik+vTv/alQRccwKmut2553KUth3vDCBcbzVCPAOkApV+B tq9yDTJs3hpBnvjU4Z4L7G7eLKOgDxc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836164; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5DMP/q2btvgcXeqHj+XzP+a3Z6jT5Co32VSxUCUeL+M=; b=QA4S/Ogfgt2BqdsjTJE537cxlwJULGBqgjtDzZnaL1gvWH6Ssa1T39zRyqAWlRvlK/UYvY 7oQB0nSm7LARDdAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=oz4DzvEt; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="QA4S/Ogf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836164; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5DMP/q2btvgcXeqHj+XzP+a3Z6jT5Co32VSxUCUeL+M=; b=oz4DzvEt8AeJ1zhVq1G0AS4OnmPtPArluLoAwYxHtQIciBeAJlMqVMyLP5D0OLYnjoMKQW RgpfNWxXGKzbWmJ0LregU6Pd4ik+vTv/alQRccwKmut2553KUth3vDCBcbzVCPAOkApV+B tq9yDTJs3hpBnvjU4Z4L7G7eLKOgDxc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836164; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5DMP/q2btvgcXeqHj+XzP+a3Z6jT5Co32VSxUCUeL+M=; b=QA4S/Ogfgt2BqdsjTJE537cxlwJULGBqgjtDzZnaL1gvWH6Ssa1T39zRyqAWlRvlK/UYvY 7oQB0nSm7LARDdAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 45/51] tests/qtest/migration: Convert TLS x509 tests to use config Date: Mon, 15 Dec 2025 19:00:31 -0300 Message-ID: <20251215220041.12657-46-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 5B58633742 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; FROM_EQ_ENVFROM(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_FIVE(0.00)[6]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid, suse.de:dkim, suse.de:email, imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836302816158500 Content-Type: text/plain; charset="utf-8" Convert the TLS x509 tests to start passing the config object to the migration commands. Replace the usage of migrate_set_parameters and args->caps with the config QDict. Note that the TLS credentials id is different among the two migration machines so it cannot follow the standard practice of setting the same value for both QTestState instances (i.e. from/to). This is a issue specific to the test code because it uses the same config object for both QEMU instances. Since this is a one-off, add a workaround specific for that situation. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 11 +- tests/qtest/migration/migration-util.c | 44 ++++++++ tests/qtest/migration/migration-util.h | 1 + tests/qtest/migration/tls-tests.c | 139 +++++++------------------ 4 files changed, 92 insertions(+), 103 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 8f179ea2fa..44ef80cf0c 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -429,8 +429,10 @@ int migrate_args(char **from, char **to, const char *u= ri, MigrateStart *args) */ events =3D args->defer_target_connect ? "-global migration.x-events=3D= on" : ""; =20 - if (args->config) { - GString *json =3D qobject_to_json(QOBJECT(args->config)); + if (!args->incoming_defer && args->config) { + QDict *conf =3D fixup_tls_creds(args->config); + GString *json =3D qobject_to_json(QOBJECT(conf)); + config_opts =3D g_strdup_printf("-incoming '%s'", json->str); } =20 @@ -883,12 +885,15 @@ int test_precopy_common(MigrateCommon *args) } =20 if (args->start.incoming_defer && !args->start.defer_target_connect) { + QDict *incoming_conf =3D fixup_tls_creds(args->start.config); + if (args->connect_channels) { in_channels =3D qobject_from_json(args->connect_channels, &error_abort); } + migrate_incoming_qmp(to, args->listen_uri, in_channels, - args->start.config, "{}"); + incoming_conf, "{}"); } =20 /* Wait for the first serial output from the source */ diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration= /migration-util.c index e702f00896..efe1ae25de 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -395,3 +395,47 @@ bool kvm_dirty_ring_supported(void) return false; #endif } + +QDict *fixup_tls_creds(QDict *config) +{ + QDict *new; + + if (!config) { + return NULL; + } + + /* + * The tests expect the tls-creds to have different values for + * client and server, but there's only one config object. The + * tls-tests have passed the values in the two temporary keys + * below. + */ + const char *server =3D qdict_get_try_str(config, "tmp-tls-server"); + const char *client =3D qdict_get_try_str(config, "tmp-tls-client"); + + if (server && client) { + new =3D qdict_clone_shallow(config); + + /* + * Set the proper value for the incoming side and discard the + * temporaries. Note that removing the temporaries cannot + * happen before cloning because the qdict code frees the + * strings. + */ + qdict_put_str(new, "tls-creds", server); + qdict_del(new, "tmp-tls-client"); + qdict_del(new, "tmp-tls-server"); + + /* + * Set the value for the outgoing side for further usage + * outside this function. + */ + qdict_put_str(config, "tls-creds", client); + qdict_del(config, "tmp-tls-client"); + qdict_del(config, "tmp-tls-server"); + + return new; + } + + return config; +} diff --git a/tests/qtest/migration/migration-util.h b/tests/qtest/migration= /migration-util.h index 3c3b5a8777..ec58868197 100644 --- a/tests/qtest/migration/migration-util.h +++ b/tests/qtest/migration/migration-util.h @@ -59,6 +59,7 @@ void migration_test_add_suffix(const char *path, const ch= ar *suffix, void (*fn)(char *name, MigrateCommon *args)= ); char *migrate_get_connect_uri(QTestState *who); void migrate_set_ports(QTestState *to, QList *channel_list); +QDict *fixup_tls_creds(QDict *config); =20 /* * Scaffolding to allow the framework _common functions and _qmp diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 68304a7af3..b6d436389a 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -259,10 +259,6 @@ migrate_hook_start_tls_x509_common(QTestState *from, " 'sanity-check': true," " 'verify-peer': true} }", workdir); - migrate_set_parameter_str(from, "tls-creds", "tlscredsx509client0"); - if (args->certhostname) { - migrate_set_parameter_str(from, "tls-hostname", args->certhostname= ); - } =20 qtest_qmp_assert_success(to, "{ 'execute': 'object-add'," @@ -273,7 +269,6 @@ migrate_hook_start_tls_x509_common(QTestState *from, " 'sanity-check': true," " 'verify-peer': %i} }", workdir, args->verifyclient); - migrate_set_parameter_str(to, "tls-creds", "tlscredsx509server0"); =20 if (args->authzclient) { qtest_qmp_assert_success(to, @@ -282,7 +277,6 @@ migrate_hook_start_tls_x509_common(QTestState *from, " 'id': 'tlsauthz0'," " 'identity': %s} }", "CN=3D" QCRYPTO_TLS_TEST_CLIENT_NAME); - migrate_set_parameter_str(to, "tls-authz", "tlsauthz0"); } =20 return NULL; @@ -335,6 +329,28 @@ static void migrate_tls_x509_init(MigrateCommon *args, test_args->certipaddr); test_tls_deinit_cert(&clientcertreq); test_tls_deinit_cert(&cacertreq); + + /* + * These keys are not actual parameters, we need them for the test + * code because it uses the same config object for both QEMUs. + */ + qdict_put_str(args->start.config, "tmp-tls-client", "tlscredsx509clien= t0"); + qdict_put_str(args->start.config, "tmp-tls-server", "tlscredsx509serve= r0"); + + if (test_args->certhostname) { + qdict_put_str(args->start.config, "tls-hostname", + test_args->certhostname); + } else { + qdict_put_null(args->start.config, "tls-hostname"); + } + + if (test_args->authzclient) { + qdict_put_str(args->start.config, "tls-authz", "tlsauthz0"); + } + + if (qdict_get_try_bool(args->start.config, "multifd", false)) { + qdict_put_str(args->start.config, "multifd-compression", "none"); + } } =20 static void migrate_tls_x509_cleanup(TestMigrateTLSX509Data *data) @@ -369,6 +385,9 @@ static void test_precopy_tls_x509_common(MigrateCommon = *args, { TestMigrateTLSX509Data *data =3D g_new0(TestMigrateTLSX509Data, 1); =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + migrate_tls_x509_init(args, test_args, data); test_precopy_common(args); migrate_tls_x509_cleanup(data); @@ -508,21 +527,11 @@ static void test_precopy_tcp_no_tls(char *name, Migra= teCommon *args) test_precopy_common(args); } =20 -static void * -migrate_hook_start_tls_x509_no_host(QTestState *from, QTestState *to) -{ - TestMigrateTLSX509Data *data =3D migrate_hook_start_tls_x509_common( - from, to, &tls_x509_no_host); - migrate_set_parameter_null(from, "tls-hostname"); - migrate_set_parameter_null(to, "tls-hostname"); - - return data; -} - static void test_precopy_tcp_tls_no_hostname(char *name, MigrateCommon *ar= gs) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_tls_x509_no_host; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_no_host; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 args->start.hide_stderr =3D true; @@ -609,60 +618,6 @@ static void test_precopy_tcp_tls_x509_reject_anon_clie= nt(char *name, =20 test_precopy_tls_x509_common(args, &tls_x509_reject_anon_client); } - -static void * -migrate_hook_start_multifd_tls_x509_default_host(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "none"); - migrate_set_parameter_str(to, "multifd-compression", "none"); - - return migrate_hook_start_tls_x509_common(from, to, &tls_x509_default_= host); -} - -static void * -migrate_hook_start_multifd_tls_x509_override_host(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "none"); - migrate_set_parameter_str(to, "multifd-compression", "none"); - - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_override_host); -} - -static void * -migrate_hook_start_multifd_tls_x509_mismatch_host(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "none"); - migrate_set_parameter_str(to, "multifd-compression", "none"); - - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_mismatch_host); -} - -static void * -migrate_hook_start_multifd_tls_x509_allow_anon_client(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "none"); - migrate_set_parameter_str(to, "multifd-compression", "none"); - - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_allow_anon_client); -} - -static void * -migrate_hook_start_multifd_tls_x509_reject_anon_client(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "none"); - migrate_set_parameter_str(to, "multifd-compression", "none"); - - return migrate_hook_start_tls_x509_common(from, to, - &tls_x509_reject_anon_client= ); -} #endif /* CONFIG_TASN1 */ =20 static void test_multifd_tcp_tls_psk_match(char *name, MigrateCommon *args) @@ -701,25 +656,17 @@ static void test_multifd_postcopy_tcp_tls_psk_match(c= har *name, static void test_multifd_tcp_tls_x509_default_host(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_multifd_tls_x509_default_host; - args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - - test_precopy_tls_x509_common(args, &tls_x509_default_host); + qdict_put_bool(args->start.config, "multifd", true); + test_precopy_tcp_tls_x509_default_host(name, args); } =20 static void test_multifd_tcp_tls_x509_override_host(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_multifd_tls_x509_override_host; - args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - - test_precopy_tls_x509_common(args, &tls_x509_override_host); + qdict_put_bool(args->start.config, "multifd", true); + test_precopy_tcp_tls_x509_override_host(name, args); } =20 static void test_multifd_tcp_tls_x509_mismatch_host(char *name, @@ -738,13 +685,15 @@ static void test_multifd_tcp_tls_x509_mismatch_host(c= har *name, * to load migration state, and thus just aborts the migration * without exiting. */ - args->start_hook =3D migrate_hook_start_multifd_tls_x509_mismatch_host; + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D &tls_x509_mismatch_host; args->result =3D MIG_TEST_FAIL; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; args->start.hide_stderr =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); =20 test_precopy_tls_x509_common(args, &tls_x509_mismatch_host); } @@ -752,27 +701,17 @@ static void test_multifd_tcp_tls_x509_mismatch_host(c= har *name, static void test_multifd_tcp_tls_x509_allow_anon_client(char *name, MigrateCommon *arg= s) { - args->start_hook =3D migrate_hook_start_multifd_tls_x509_allow_anon_cl= ient; - args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - - test_precopy_tls_x509_common(args, &tls_x509_allow_anon_client); + qdict_put_bool(args->start.config, "multifd", true); + test_precopy_tcp_tls_x509_allow_anon_client(name, args); } =20 static void test_multifd_tcp_tls_x509_reject_anon_client(char *name, MigrateCommon *ar= gs) { - args->start_hook =3D migrate_hook_start_multifd_tls_x509_reject_anon_c= lient; - args->result =3D MIG_TEST_FAIL; - args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start.incoming_defer =3D true; - args->start.hide_stderr =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - - test_precopy_tls_x509_common(args, &tls_x509_reject_anon_client); + qdict_put_bool(args->start.config, "multifd", true); + test_precopy_tcp_tls_x509_reject_anon_client(name, args); } #endif /* CONFIG_TASN1 */ =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836285; cv=none; d=zohomail.com; s=zohoarc; b=TbGT+tFl5uvzvtywORelgEg+e33QWTB1cnsPTqTgXYpfawuVgaLFP3Gd4tumrv/7YwPXAIdY08XmtrRbOm14QOmI0tnC6nfhszeDVHcA8T7ENgeBhjoVBAc8qdcYljWvynbG5NMhnyus5ZoMaFGvw4kQ7HqQka1FscWC3sIkZ+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836285; 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=mvL4BBSmoKDumAmp6JVFT+bkUw/pD2BkaKKn388vg9Q=; b=mLrXhYJaEf6Avv53d+aZyF7k6S+Re3WwLfSJMG7PChQ2+gRiVSaToMQLCzF7C3DxQkiQJxRHQfP5WLT/SYxFVPELPx+6QWTNjImmjvx3IY10v97vAsluEadpOWrDXOcnZLDENywksk9S1edc7siHLFXMLDH3EpuqOYDQ/1eoxNE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836285340422.8904297324531; Mon, 15 Dec 2025 14:04:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGfU-0002LK-CR; Mon, 15 Dec 2025 17:03:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGfP-0001Zb-Pi for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:44 -0500 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 1vVGfO-0003Kr-2M for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:43 -0500 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 435103381A; Mon, 15 Dec 2025 22:02:47 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EAAFB3EA63; Mon, 15 Dec 2025 22:02:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4LyNKoSFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836168; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mvL4BBSmoKDumAmp6JVFT+bkUw/pD2BkaKKn388vg9Q=; b=tj8nHKXlfxcGAnWXapFZnV2L8inDLmzDSYNWK0C+Roq/o+8wMcCOEowiWmyDAPdreIkHjw IDxjGVUWbI5wGOnxwWIO/kxDruVAjEVeO35R1mWXb7R6k6aRwXsu57/hbNkOhwdLWiFK+a vtz8LOm64LVZh17+l9PIodZQFwPvo4Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836168; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mvL4BBSmoKDumAmp6JVFT+bkUw/pD2BkaKKn388vg9Q=; b=pqP8twu5qcYSHAHGF8iLZHTctvewzSjhmkYASSvJf/IadRQAX3c1+GBQQERLIwCcQwCSWX Vcz770XeVRruUOAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=nDewrYoq; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=gGDqDyyX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836167; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mvL4BBSmoKDumAmp6JVFT+bkUw/pD2BkaKKn388vg9Q=; b=nDewrYoqHKQXjeNTKnLYPa//Bm6KEr0ofKKPYqCKK6CZ0vi5xgFQRUoqtqNI0Adkzvi1x5 pOkGwgipyPyziMq4uevmGqHhSc2PmtLDg247Ap1xYZhJwpQd+3OGOukNCLnNBBHYNeLGQI uxdNA5rO77MqIg9DunPfCot9kZvfbL0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836167; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mvL4BBSmoKDumAmp6JVFT+bkUw/pD2BkaKKn388vg9Q=; b=gGDqDyyXQYB+cTHFrOkxR5J8f8VdxBlU2RYQTHkjf24ZOUUHa0jhPlVGxfwzaSU0iXN9MG XTJAF1bHIxLtnrCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 46/51] tests/qtest/migration: Convert compression tests to use config Date: Mon, 15 Dec 2025 19:00:32 -0300 Message-ID: <20251215220041.12657-47-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 435103381A X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim,suse.de:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1765836288660154100 Content-Type: text/plain; charset="utf-8" Make the compression tests pass a config argument to migration QMP commands. Temporarily, set the use-config key to enable the new method. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/compression-tests.c | 132 ++++++++-------------- 1 file changed, 47 insertions(+), 85 deletions(-) diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index be60981f66..ff3386f586 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -21,26 +21,16 @@ static char *tmpfs; =20 #ifdef CONFIG_ZSTD -static void * -migrate_hook_start_precopy_tcp_multifd_zstd(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_int(from, "multifd-zstd-level", 2); - migrate_set_parameter_int(to, "multifd-zstd-level", 2); - - migrate_set_parameter_str(from, "multifd-compression", "zstd"); - migrate_set_parameter_str(to, "multifd-compression", "zstd"); - - return NULL; -} - static void test_multifd_tcp_zstd(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); =20 test_precopy_common(args); } @@ -48,103 +38,79 @@ static void test_multifd_tcp_zstd(char *name, MigrateC= ommon *args) static void test_multifd_postcopy_tcp_zstd(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zstd, =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "postcopy-ram", true); + qdict_put_int(args->start.config, "multifd-zstd-level", 2); + qdict_put_str(args->start.config, "multifd-compression", "zstd"); + + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); =20 test_precopy_common(args); } #endif /* CONFIG_ZSTD */ =20 #ifdef CONFIG_QATZIP -static void * -migrate_hook_start_precopy_tcp_multifd_qatzip(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_int(from, "multifd-qatzip-level", 2); - migrate_set_parameter_int(to, "multifd-qatzip-level", 2); - - migrate_set_parameter_str(from, "multifd-compression", "qatzip"); - migrate_set_parameter_str(to, "multifd-compression", "qatzip"); - - return NULL; -} - static void test_multifd_tcp_qatzip(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qatzip; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_int(args->start.config, "multifd-qatzip-level", 2); + qdict_put_str(args->start.config, "multifd-compression", "qatzip"); + + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); =20 test_precopy_common(args); } #endif =20 #ifdef CONFIG_QPL -static void * -migrate_hook_start_precopy_tcp_multifd_qpl(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "qpl"); - migrate_set_parameter_str(to, "multifd-compression", "qpl"); - - return NULL; -} - static void test_multifd_tcp_qpl(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_qpl; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_str(args->start.config, "multifd-compression", "qpl"); + + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); =20 test_precopy_common(args); } #endif /* CONFIG_QPL */ =20 #ifdef CONFIG_UADK -static void * -migrate_hook_start_precopy_tcp_multifd_uadk(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "uadk"); - migrate_set_parameter_str(to, "multifd-compression", "uadk"); - - return NULL; -} - static void test_multifd_tcp_uadk(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_uadk; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_str(args->start.config, "multifd-compression", "uadk"); + + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); =20 test_precopy_common(args); } #endif /* CONFIG_UADK */ =20 -static void * -migrate_hook_start_xbzrle(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_int(from, "xbzrle-cache-size", 33554432); - return NULL; -} - static void test_precopy_unix_xbzrle(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); =20 args->connect_uri =3D uri; args->listen_uri =3D uri; - args->start_hook =3D migrate_hook_start_xbzrle; args->iterations =3D 2; /* * XBZRLE needs pages to be modified when doing the 2nd+ round @@ -152,35 +118,31 @@ static void test_precopy_unix_xbzrle(char *name, Migr= ateCommon *args) */ args->live =3D true; =20 - args->start.caps[MIGRATION_CAPABILITY_XBZRLE] =3D true; + qdict_put_bool(args->start.config, "xbzrle", true); + qdict_put_int(args->start.config, "xbzrle-cache-size", 33554432); + + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); =20 test_precopy_common(args); } =20 -static void * -migrate_hook_start_precopy_tcp_multifd_zlib(QTestState *from, - QTestState *to) +static void test_multifd_tcp_zlib(char *name, MigrateCommon *args) { + args->listen_uri =3D "tcp:127.0.0.1:0"; + + args->start.incoming_defer =3D true; + args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + /* * Overloading this test to also check that set_parameter does not err= or. * This is also done in the tests for the other compression methods. */ - migrate_set_parameter_int(from, "multifd-zlib-level", 2); - migrate_set_parameter_int(to, "multifd-zlib-level", 2); + qdict_put_int(args->start.config, "multifd-zlib-level", 2); + qdict_put_str(args->start.config, "multifd-compression", "zlib"); =20 - migrate_set_parameter_str(from, "multifd-compression", "zlib"); - migrate_set_parameter_str(to, "multifd-compression", "zlib"); - - return NULL; -} - -static void test_multifd_tcp_zlib(char *name, MigrateCommon *args) -{ - args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zlib; - - args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); =20 test_precopy_common(args); } --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836384; cv=none; d=zohomail.com; s=zohoarc; b=XHNDShmKuXpWs9jrPUAhDsZq9fRmULIb95r11EkjXepOVYGc2fkIGd5Uuj5iiXH2YaaDJztOqUUO7kpsgHEkfA/qeIpG27WdvYUBHC7S2E9hZwNs0JwqyF/PklWR1fygst8/yzFewfGBWrOxpY6HZvgpdC1aes++YqnKfbbixiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836384; 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=WnqpBZJU2474UbbWD0OquXynqcPEoAQXGMMMbY0+ih0=; b=cmv+/7tfFLdkCOQqqo7nhi+WylPICZxpZXoArFZm8vuhri0EhFlNWiarRQ1R+AJuPGRNG5XCsGl6Q4Xt/MSuEVXDlFpLR1VyLcdq4jNBRqXWxQgHuBqKQ2/x/IPQ0kNY/i2XQGp/naWwSM0CRHRf3xFX4eP+Mst0cLUKNxM/EtI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836384563598.7109300889994; Mon, 15 Dec 2025 14:06:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGfQ-0001VT-3g; Mon, 15 Dec 2025 17:03:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGf9-0001Dk-QH for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:28 -0500 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 1vVGf7-00039V-Dg for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:27 -0500 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 D40515BDDD; Mon, 15 Dec 2025 22:02:49 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CAD3B3EA65; Mon, 15 Dec 2025 22:02:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sFjPIoeFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836169; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WnqpBZJU2474UbbWD0OquXynqcPEoAQXGMMMbY0+ih0=; b=blXWxjIGPA2dQRqrB2ogXXEqxLJY1ob1zesz8I1si1pZgzo5IzP9CGPx57wPiNXnRGDdzR lBI0treeYGdwr6+6zBeJccZVAS9CTWKy9fIQaQL92hq7Kd8XADuCsl4MMaNjD3bfXLSDHP av4PsgRR85EtSZpXzLMDkg/PrT+OCHA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836169; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WnqpBZJU2474UbbWD0OquXynqcPEoAQXGMMMbY0+ih0=; b=+fX7SZA7ZUCKJlv4LcwDINMfdwI+YrHzojujZD+4I9wze+Lrsf27j523LfyIqNVILVqU+u jtZ/37askLgFw5Aw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836169; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WnqpBZJU2474UbbWD0OquXynqcPEoAQXGMMMbY0+ih0=; b=blXWxjIGPA2dQRqrB2ogXXEqxLJY1ob1zesz8I1si1pZgzo5IzP9CGPx57wPiNXnRGDdzR lBI0treeYGdwr6+6zBeJccZVAS9CTWKy9fIQaQL92hq7Kd8XADuCsl4MMaNjD3bfXLSDHP av4PsgRR85EtSZpXzLMDkg/PrT+OCHA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836169; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WnqpBZJU2474UbbWD0OquXynqcPEoAQXGMMMbY0+ih0=; b=+fX7SZA7ZUCKJlv4LcwDINMfdwI+YrHzojujZD+4I9wze+Lrsf27j523LfyIqNVILVqU+u jtZ/37askLgFw5Aw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 47/51] tests/qtest/migration: Convert file tests to use config Date: Mon, 15 Dec 2025 19:00:33 -0300 Message-ID: <20251215220041.12657-48-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.990]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836385255158500 Content-Type: text/plain; charset="utf-8" Convert the file tests (including CPR) to use the config object. The 'events' line can be removed because the capability is always set in the config QDict in common code. Temporarily, set the use-config key to enable the new method. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/cpr-tests.c | 51 ++++++++++++++---------------- tests/qtest/migration/file-tests.c | 39 ++++++++--------------- tests/qtest/migration/framework.c | 3 ++ 3 files changed, 41 insertions(+), 52 deletions(-) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 9883616cb5..a1b5a39f9f 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -21,14 +21,6 @@ =20 static char *tmpfs; =20 -static void *migrate_hook_start_mode_reboot(QTestState *from, QTestState *= to) -{ - migrate_set_parameter_str(from, "mode", "cpr-reboot"); - migrate_set_parameter_str(to, "mode", "cpr-reboot"); - - return NULL; -} - static void test_mode_reboot(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, @@ -36,21 +28,15 @@ static void test_mode_reboot(char *name, MigrateCommon = *args) =20 args->listen_uri =3D uri; args->connect_uri =3D uri; - args->start_hook =3D migrate_hook_start_mode_reboot; =20 args->start.incoming_defer =3D true; args->start.mem_type =3D MEM_TYPE_SHMEM; - args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true; =20 + qdict_put_bool(args->start.config, "x-ignore-shared", true); + qdict_put_str(args->start.config, "mode", "cpr-reboot"); test_file_common(args, true); } =20 -static void *test_mode_transfer_start(QTestState *from, QTestState *to) -{ - migrate_set_parameter_str(from, "mode", "cpr-transfer"); - return NULL; -} - /* * cpr-transfer mode cannot use the target monitor prior to starting the * migration, and cannot connect synchronously to the monitor, so defer @@ -94,13 +80,17 @@ static void test_mode_transfer_common(MigrateCommon *ar= gs) args->listen_uri =3D uri; args->connect_channels =3D connect_channels; args->cpr_channel =3D cpr_channel; - args->start_hook =3D test_mode_transfer_start; =20 args->start.opts_source =3D opts; args->start.opts_target =3D opts_target; args->start.defer_target_connect =3D true; args->start.mem_type =3D MEM_TYPE_MEMFD; =20 + qdict_put_str(args->start.config, "mode", "cpr-transfer"); + + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + if (test_precopy_common(args) < 0) { close(cpr_sockfd); unlink(cpr_path); @@ -119,6 +109,18 @@ static void test_mode_transfer_defer(char *name, Migra= teCommon *args) test_mode_transfer_common(args); } =20 +static void set_cpr_exec_command(QDict *config, char **strv) +{ + QList *list =3D qlist_new(); + + while (*strv) { + qlist_append_str(list, *strv); + strv++; + } + + qdict_put_obj(config, "cpr-exec-command", (QObject *)list); +} + static void set_cpr_exec_args(QTestState *who, MigrateCommon *args) { g_autofree char *qtest_from_args =3D NULL; @@ -157,7 +159,7 @@ static void set_cpr_exec_args(QTestState *who, MigrateC= ommon *args) exec_args =3D g_strconcat(qtest_qemu_binary(migration_get_env()->qemu_= dst), " -incoming defer ", from_str, NULL); argv =3D g_strsplit(exec_args, " ", -1); - migrate_set_parameter_strv(who, "cpr-exec-command", argv); + set_cpr_exec_command(args->start.config, argv); } =20 static void wait_for_migration_event(QTestState *who, const char *waitfor) @@ -187,6 +189,9 @@ static void test_cpr_exec(MigrateCommon *args) FILE_TEST_FILENAME); g_autofree char *channels =3D NULL; =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + if (migrate_start(&from, NULL, args->listen_uri, &args->start)) { return; } @@ -200,7 +205,6 @@ static void test_cpr_exec(MigrateCommon *args) =20 wait_for_serial("src_serial"); set_cpr_exec_args(from, args); - migrate_set_capability(from, "events", true); migrate_qmp(from, NULL, connect_uri, NULL, args->start.config, "{}"); wait_for_migration_event(from, "completed"); =20 @@ -229,13 +233,6 @@ static void test_cpr_exec(MigrateCommon *args) migrate_end(from, to, args->result =3D=3D MIG_TEST_SUCCEED); } =20 -static void *test_mode_exec_start(QTestState *from, QTestState *to) -{ - assert(!to); - migrate_set_parameter_str(from, "mode", "cpr-exec"); - return NULL; -} - static void test_mode_exec(char *name, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, @@ -244,12 +241,12 @@ static void test_mode_exec(char *name, MigrateCommon = *args) =20 args->connect_uri =3D uri; args->listen_uri =3D listen_uri; - args->start_hook =3D test_mode_exec_start; =20 args->start.only_source =3D true; args->start.opts_source =3D "-machine aux-ram-share=3Don -nodefaults"; args->start.mem_type =3D MEM_TYPE_MEMFD; =20 + qdict_put_str(args->start.config, "mode", "cpr-exec"); test_cpr_exec(args); } =20 diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/fil= e-tests.c index 57117b2496..c7a4eb145b 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -118,8 +118,8 @@ static void test_precopy_file_mapped_ram_live(char *nam= e, MigrateCommon *args) args->listen_uri =3D uri; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; =20 + qdict_put_bool(args->start.config, "mapped-ram", true); test_file_common(args, false); } =20 @@ -132,8 +132,8 @@ static void test_precopy_file_mapped_ram(char *name, Mi= grateCommon *args) args->listen_uri =3D uri; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; =20 + qdict_put_bool(args->start.config, "mapped-ram", true); test_file_common(args, true); } =20 @@ -145,9 +145,9 @@ static void test_multifd_file_mapped_ram_live(char *nam= e, MigrateCommon *args) args->listen_uri =3D uri; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; =20 + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "mapped-ram", true); test_file_common(args, false); } =20 @@ -160,38 +160,29 @@ static void test_multifd_file_mapped_ram(char *name, = MigrateCommon *args) args->listen_uri =3D uri; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; - args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; =20 + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "mapped-ram", true); test_file_common(args, true); } =20 -static void *migrate_hook_start_multifd_mapped_ram_dio(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_bool(from, "direct-io", true); - migrate_set_parameter_bool(to, "direct-io", true); - - return NULL; -} - static void test_multifd_file_mapped_ram_dio(char *name, MigrateCommon *ar= gs) { g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); args->connect_uri =3D uri; args->listen_uri =3D uri; - args->start_hook =3D migrate_hook_start_multifd_mapped_ram_dio; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 if (!probe_o_direct_support(tmpfs)) { g_test_skip("Filesystem does not support O_DIRECT"); return; } =20 + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "mapped-ram", true); + qdict_put_bool(args->start.config, "direct-io", true); test_file_common(args, true); } =20 @@ -230,9 +221,6 @@ static void *migrate_hook_start_multifd_mapped_ram_fdse= t_dio(QTestState *from, fdset_add_fds(from, file, O_WRONLY, 2, true); fdset_add_fds(to, file, O_RDONLY, 2, true); =20 - migrate_set_parameter_bool(from, "direct-io", true); - migrate_set_parameter_bool(to, "direct-io", true); - return NULL; } =20 @@ -258,9 +246,9 @@ static void test_multifd_file_mapped_ram_fdset(char *na= me, MigrateCommon *args) args->end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "mapped-ram", true); test_file_common(args, true); } =20 @@ -276,14 +264,15 @@ static void test_multifd_file_mapped_ram_fdset_dio(ch= ar *name, args->end_hook =3D migrate_hook_end_multifd_mapped_ram_fdset; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; =20 if (!probe_o_direct_support(tmpfs)) { g_test_skip("Filesystem does not support O_DIRECT"); return; } =20 + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_bool(args->start.config, "mapped-ram", true); + qdict_put_bool(args->start.config, "direct-io", true); test_file_common(args, true); } #endif /* !_WIN32 */ diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 44ef80cf0c..6cf2bbf9cc 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -1056,6 +1056,9 @@ void test_file_common(MigrateCommon *args, bool stop_= src) void *data_hook =3D NULL; bool check_offset =3D false; =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + if (migrate_start(&from, &to, args->listen_uri, &args->start)) { return; } --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836330; cv=none; d=zohomail.com; s=zohoarc; b=d6mOntVK3sGxaVLZw6uxs9c3MgZnQlodVAk4bM5exPxI3voA547WVaiQsIcqi0p2BcVmLWh9txzlxbshRMIt9Az8ofVg6KTy3hUK47PG65WfTeL7iTYWBDGlxwKaLskF9qSYPxOn+/UEJ6I2/qR85B++NsLejZRHRH/7I39/szs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836330; 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=TLzP0FP/GuIRsL62Nak4M/JkrfBmomudVQwI79vGZYw=; b=LR4cto9XfGAchLOuSgrpbZV1Qd4X0DZvfrUDdyn/KmC1PasPBvHqgQ7kGXTC8GGqEUaTFR62BkfqKJhGNQLIjtq+MJGrdLC4cQMA7YHmfREcULdCBy3Fd4rQ3kUEHHadvwFvoKY4FU5KX6S5V0I6I6axmVZF5s2GZeZvrk4gUAY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176583633047655.27457020247584; Mon, 15 Dec 2025 14:05:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGfS-000216-Eo; Mon, 15 Dec 2025 17:03:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGfG-0001Nm-QI for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:36 -0500 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 1vVGfD-0003Bd-Lv for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:33 -0500 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 744045BDE2; Mon, 15 Dec 2025 22:02:52 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 61EC93EA63; Mon, 15 Dec 2025 22:02:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QCwwCYqFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836172; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TLzP0FP/GuIRsL62Nak4M/JkrfBmomudVQwI79vGZYw=; b=fA8uPO85qrkM8gM2zfDHEuLTHWLLwo3+YYejBoN8TREvjgtrripd8VOm9X6pCgeKtDL39G yy+srsd4Nw99dH80dsZk8UBB3SfQVznzrz+DCnlkzC4eMblVu5jzFsHbLJarSRWKyJ44t2 ThSR2ZdPMfsDXNIst5+uSip2Qkn7eko= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836172; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TLzP0FP/GuIRsL62Nak4M/JkrfBmomudVQwI79vGZYw=; b=9n9WGj9SYPhGNfHGM2k42lVt76eOpWTJ5zpyI02itnZuBzwVLoLS5bRqBBtVpFxoLSFo6V /GTYCOiJvNtSD+AQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836172; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TLzP0FP/GuIRsL62Nak4M/JkrfBmomudVQwI79vGZYw=; b=fA8uPO85qrkM8gM2zfDHEuLTHWLLwo3+YYejBoN8TREvjgtrripd8VOm9X6pCgeKtDL39G yy+srsd4Nw99dH80dsZk8UBB3SfQVznzrz+DCnlkzC4eMblVu5jzFsHbLJarSRWKyJ44t2 ThSR2ZdPMfsDXNIst5+uSip2Qkn7eko= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836172; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TLzP0FP/GuIRsL62Nak4M/JkrfBmomudVQwI79vGZYw=; b=9n9WGj9SYPhGNfHGM2k42lVt76eOpWTJ5zpyI02itnZuBzwVLoLS5bRqBBtVpFxoLSFo6V /GTYCOiJvNtSD+AQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 48/51] tests/qtest/migration: Convert misc-tests to use config Date: Mon, 15 Dec 2025 19:00:34 -0300 Message-ID: <20251215220041.12657-49-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.989]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836330827158500 Content-Type: text/plain; charset="utf-8" Make the misc tests pass a config argument to migration QMP commands. Temporarily, set the use-config key to enable the new method. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/misc-tests.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index c62fd1e3f9..7e38d26ab2 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -28,6 +28,9 @@ static void test_baddest(char *name, MigrateCommon *args) =20 args->start.hide_stderr =3D true; =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; } @@ -52,6 +55,9 @@ static void test_analyze_script(char *name, MigrateCommon= *args) return; } =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + /* dummy url */ if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; @@ -62,8 +68,8 @@ static void test_analyze_script(char *name, MigrateCommon= *args) * vmstate to include subsections for them. The script needs to * parse those subsections properly. */ - migrate_set_capability(from, "validate-uuid", true); - migrate_set_capability(from, "x-ignore-shared", true); + qdict_put_bool(args->start.config, "validate-uuid", true); + qdict_put_bool(args->start.config, "x-ignore-shared", true); =20 file =3D g_strdup_printf("%s/migfile", tmpfs); uri =3D g_strdup_printf("exec:cat > %s", file); @@ -96,7 +102,11 @@ static void test_ignore_shared(char *name, MigrateCommo= n *args) QTestState *from, *to; =20 args->start.mem_type =3D MEM_TYPE_SHMEM; - args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] =3D true; + + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + + qdict_put_bool(args->start.config, "x-ignore-shared", true); =20 if (migrate_start(&from, &to, uri, &args->start)) { return; @@ -131,6 +141,9 @@ static void do_test_validate_uuid(MigrateStart *args, b= ool should_fail) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 + /* temporary */ + qdict_put_bool(args->config, "use-config", true); + if (migrate_start(&from, &to, uri, args)) { return; } @@ -140,8 +153,8 @@ static void do_test_validate_uuid(MigrateStart *args, b= ool should_fail) * migration is not interesting for us here. Thus, set huge downtime f= or * very fast migration. */ - migrate_set_parameter_int(from, "downtime-limit", 1000000); - migrate_set_capability(from, "validate-uuid", true); + qdict_put_int(args->config, "downtime-limit", 1000000); + qdict_put_bool(args->config, "validate-uuid", true); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836321; cv=none; d=zohomail.com; s=zohoarc; b=UnbbIdv5s9ahy+l+0FqLA5RzdYfOeTOGdPiPdboT6htdNvIMC6i1KUSiC2kUNhVnsKlnfyE7U2KAI4dFSLl3WH8qtyOmSwh/xWb3lJc/YIoh1EnXxx+1Y7fXTX9Fa8/g2cnfJ24bKGrcLFet5i55oXIUxRzuryVv1GVHlSmEGTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836321; 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=cSYehILACAIjOXpISJcVu+gLmJ3cJe6LXzbUoZ3QKhE=; b=c7IhvUtX3oOh66PTclGW97JUGtfoEANluClM3WaY/WYuZagjmj+3/XVEHBjohCYEcnp3k/0fSELnWrFfbnTq2t1J3O9XZoy7qO61sXCA+XINyFmFgujpggi49o5ZHFT9ubPFTD3E32XBT6YG2W7FFiMWNSvo8X/oVE4UWep/L1c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836321281894.8664957693065; Mon, 15 Dec 2025 14:05:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGfV-0002TW-RI; Mon, 15 Dec 2025 17:03:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGfN-0001Yp-Mr for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:43 -0500 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 1vVGfK-0003Ee-C7 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:41 -0500 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 2068B5BDE8; Mon, 15 Dec 2025 22:02:55 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 06D7B3EA63; Mon, 15 Dec 2025 22:02:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id GOl6LoyFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836176; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cSYehILACAIjOXpISJcVu+gLmJ3cJe6LXzbUoZ3QKhE=; b=BolL/ip9nnr5q5xl7jzRng6HFIxonwksmrLwIzkKQl2xv1P6UxAsvdmPqvKXja+KaHAzQo X0ulnmKjHAOV7bzQhcp5P7R7Tbg4Ai5VBej6s856TP5FNNCHRUlomobO4jURske9MvTkhE vkY69djcXn8MKcW6izV/IputKeeoz98= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836176; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cSYehILACAIjOXpISJcVu+gLmJ3cJe6LXzbUoZ3QKhE=; b=nFoY8BFp7fcvIlIGyuvFV+QWwQHGTlihOSe+CKoWmNGqqHwi8sIZsFw6z2XpJtXFfkdZeF /cr8Q/uo6bt7HdBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=rlniXr0B; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=pVUB1t0i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836175; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cSYehILACAIjOXpISJcVu+gLmJ3cJe6LXzbUoZ3QKhE=; b=rlniXr0BRm7KJb7RzEch3w2UGjbmLqyaqhA0wWeZEeppdGmqZNhIaoIi5rMq5FdW2cAFgb m1BZo8j1NZgvst2hIXfjHgzuVKlpRI1/cC73CrXQypifbSdoCeKnNAG9L4zxEUS7Z0cP8p KimqdgcThmQyB5+8V6in+NfKiASmEVY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836175; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cSYehILACAIjOXpISJcVu+gLmJ3cJe6LXzbUoZ3QKhE=; b=pVUB1t0iers8/VOOx0aMZUFjsw0UB+LFMcl2HYMjHtoqhp1wFaM4YmaZ5BhpfWirmRnkOX t3PbzF+gpcH5nUCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 49/51] tests/qtest/migration: Convert precopy tests to use config Date: Mon, 15 Dec 2025 19:00:35 -0300 Message-ID: <20251215220041.12657-50-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 2068B5BDE8 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLi3368pnyb3ujpcs6u1hud8b3)]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; 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:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1765836323284154100 Content-Type: text/plain; charset="utf-8" Make the precopy tests pass a config argument to migration QMP commands. Temporarily, set the use-config key to enable the new method. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/compression-tests.c | 21 ---- tests/qtest/migration/cpr-tests.c | 3 - tests/qtest/migration/framework.c | 5 +- tests/qtest/migration/precopy-tests.c | 111 ++++++++-------------- tests/qtest/migration/tls-tests.c | 6 -- 5 files changed, 46 insertions(+), 100 deletions(-) diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migrat= ion/compression-tests.c index ff3386f586..7ecb10d9a8 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -29,9 +29,6 @@ static void test_multifd_tcp_zstd(char *name, MigrateComm= on *args) =20 qdict_put_bool(args->start.config, "multifd", true); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - test_precopy_common(args); } =20 @@ -46,9 +43,6 @@ static void test_multifd_postcopy_tcp_zstd(char *name, Mi= grateCommon *args) qdict_put_int(args->start.config, "multifd-zstd-level", 2); qdict_put_str(args->start.config, "multifd-compression", "zstd"); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - test_precopy_common(args); } #endif /* CONFIG_ZSTD */ @@ -64,9 +58,6 @@ static void test_multifd_tcp_qatzip(char *name, MigrateCo= mmon *args) qdict_put_int(args->start.config, "multifd-qatzip-level", 2); qdict_put_str(args->start.config, "multifd-compression", "qatzip"); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - test_precopy_common(args); } #endif @@ -81,9 +72,6 @@ static void test_multifd_tcp_qpl(char *name, MigrateCommo= n *args) qdict_put_bool(args->start.config, "multifd", true); qdict_put_str(args->start.config, "multifd-compression", "qpl"); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - test_precopy_common(args); } #endif /* CONFIG_QPL */ @@ -98,9 +86,6 @@ static void test_multifd_tcp_uadk(char *name, MigrateComm= on *args) qdict_put_bool(args->start.config, "multifd", true); qdict_put_str(args->start.config, "multifd-compression", "uadk"); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - test_precopy_common(args); } #endif /* CONFIG_UADK */ @@ -121,9 +106,6 @@ static void test_precopy_unix_xbzrle(char *name, Migrat= eCommon *args) qdict_put_bool(args->start.config, "xbzrle", true); qdict_put_int(args->start.config, "xbzrle-cache-size", 33554432); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - test_precopy_common(args); } =20 @@ -141,9 +123,6 @@ static void test_multifd_tcp_zlib(char *name, MigrateCo= mmon *args) qdict_put_int(args->start.config, "multifd-zlib-level", 2); qdict_put_str(args->start.config, "multifd-compression", "zlib"); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - test_precopy_common(args); } =20 diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index a1b5a39f9f..57199ed3b8 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -88,9 +88,6 @@ static void test_mode_transfer_common(MigrateCommon *args) =20 qdict_put_str(args->start.config, "mode", "cpr-transfer"); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - if (test_precopy_common(args) < 0) { close(cpr_sockfd); unlink(cpr_path); diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 6cf2bbf9cc..f596f1c171 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -868,6 +868,9 @@ int test_precopy_common(MigrateCommon *args) QObject *in_channels =3D NULL; QObject *out_channels =3D NULL; =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + g_assert(!args->cpr_channel || args->connect_channels); if (args->start.incoming_defer) { g_assert(args->listen_uri || args->connect_channels); @@ -951,7 +954,7 @@ int test_precopy_common(MigrateCommon *args) qtest_connect(to); qtest_qmp_handshake(to, NULL); if (args->start.incoming_defer) { - migrate_incoming_qmp(to, args->connect_uri, in_channels, + migrate_incoming_qmp(to, NULL, in_channels, args->start.config, "{}"); } } diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index 01151301ce..f8f46322bc 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -216,8 +216,8 @@ static void test_precopy_tcp_switchover_ack(char *name,= MigrateCommon *args) */ args->live =3D true; =20 - args->start.caps[MIGRATION_CAPABILITY_RETURN_PATH] =3D true; - args->start.caps[MIGRATION_CAPABILITY_SWITCHOVER_ACK] =3D true; + qdict_put_bool(args->start.config, "return-path", true); + qdict_put_bool(args->start.config, "switchover-ack", true); =20 test_precopy_common(args); } @@ -365,10 +365,10 @@ static void test_auto_converge(char *name, MigrateCom= mon *args) return; } =20 - migrate_set_capability(from, "auto-converge", true); - migrate_set_parameter_int(from, "cpu-throttle-initial", init_pct); - migrate_set_parameter_int(from, "cpu-throttle-increment", inc_pct); - migrate_set_parameter_int(from, "max-cpu-throttle", max_pct); + qdict_put_bool(args->start.config, "auto-converge", true); + qdict_put_int(args->start.config, "cpu-throttle-initial", init_pct); + qdict_put_int(args->start.config, "cpu-throttle-increment", inc_pct); + qdict_put_int(args->start.config, "max-cpu-throttle", max_pct); =20 /* * Set the initial parameters so that the migration could not converge @@ -377,7 +377,7 @@ static void test_auto_converge(char *name, MigrateCommo= n *args) migrate_ensure_non_converge(from, args->start.config); =20 /* To check remaining size after precopy */ - migrate_set_capability(from, "pause-before-switchover", true); + qdict_put_bool(args->start.config, "pause-before-switchover", true); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -448,37 +448,8 @@ static void test_auto_converge(char *name, MigrateComm= on *args) migrate_end(from, to, true); } =20 -static void * -migrate_hook_start_precopy_tcp_multifd(QTestState *from, - QTestState *to) -{ - migrate_set_parameter_str(from, "multifd-compression", "none"); - migrate_set_parameter_str(to, "multifd-compression", "none"); - - return NULL; -} - -static void * -migrate_hook_start_precopy_tcp_multifd_zero_page_legacy(QTestState *from, - QTestState *to) -{ - migrate_hook_start_precopy_tcp_multifd(from, to); - migrate_set_parameter_str(from, "zero-page-detection", "legacy"); - return NULL; -} - -static void * -migrate_hook_start_precopy_tcp_multifd_no_zero_page(QTestState *from, - QTestState *to) -{ - migrate_hook_start_precopy_tcp_multifd(from, to); - migrate_set_parameter_str(from, "zero-page-detection", "none"); - return NULL; -} - static void test_multifd_tcp_uri_none(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd; /* * Multifd is more complicated than most of the features, it * directly takes guest page buffers when sending, make sure @@ -488,14 +459,15 @@ static void test_multifd_tcp_uri_none(char *name, Mig= rateCommon *args) args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_str(args->start.config, "multifd-compression", "none"); =20 test_precopy_common(args); } =20 static void test_multifd_tcp_zero_page_legacy(char *name, MigrateCommon *a= rgs) { - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_zero_page_= legacy; /* * Multifd is more complicated than most of the features, it * directly takes guest page buffers when sending, make sure @@ -505,14 +477,16 @@ static void test_multifd_tcp_zero_page_legacy(char *n= ame, MigrateCommon *args) args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_str(args->start.config, "multifd-compression", "none"); + qdict_put_str(args->start.config, "zero-page-detection", "legacy"); =20 test_precopy_common(args); } =20 static void test_multifd_tcp_no_zero_page(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd_no_zero_pa= ge; /* * Multifd is more complicated than most of the features, it * directly takes guest page buffers when sending, make sure @@ -522,14 +496,16 @@ static void test_multifd_tcp_no_zero_page(char *name,= MigrateCommon *args) args->listen_uri =3D "tcp:127.0.0.1:0"; =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_str(args->start.config, "multifd-compression", "none"); + qdict_put_str(args->start.config, "zero-page-detection", "none"); =20 test_precopy_common(args); } =20 static void test_multifd_tcp_channels_none(char *name, MigrateCommon *args) { - args->start_hook =3D migrate_hook_start_precopy_tcp_multifd; args->live =3D true; args->connect_channels =3D ("[ { 'channel-type': 'main'," " 'addr': { 'transport': 'socket'," @@ -538,7 +514,9 @@ static void test_multifd_tcp_channels_none(char *name, = MigrateCommon *args) " 'port': '0' } } ]"); =20 args->start.incoming_defer =3D true; - args->start.caps[MIGRATION_CAPABILITY_MULTIFD] =3D true; + + qdict_put_bool(args->start.config, "multifd", true); + qdict_put_str(args->start.config, "multifd-compression", "none"); =20 test_precopy_common(args); } @@ -558,6 +536,9 @@ static void test_multifd_tcp_cancel(MigrateCommon *args= , bool postcopy_ram) { QTestState *from, *to, *to2; =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + args->start.hide_stderr =3D true; args->start.incoming_defer =3D true; =20 @@ -569,15 +550,11 @@ static void test_multifd_tcp_cancel(MigrateCommon *ar= gs, bool postcopy_ram) migrate_prepare_for_dirty_mem(from); =20 if (postcopy_ram) { - migrate_set_capability(from, "postcopy-ram", true); - migrate_set_capability(to, "postcopy-ram", true); + qdict_put_bool(args->start.config, "postcopy-ram", true); } =20 - migrate_set_parameter_int(from, "multifd-channels", 16); - migrate_set_parameter_int(to, "multifd-channels", 16); - - migrate_set_capability(from, "multifd", true); - migrate_set_capability(to, "multifd", true); + qdict_put_int(args->start.config, "multifd-channels", 16); + qdict_put_bool(args->start.config, "multifd", true); =20 /* Start incoming migration from the 1st socket */ migrate_incoming_qmp(to, "tcp:127.0.0.1:0", NULL, args->start.config, = "{}"); @@ -615,13 +592,7 @@ static void test_multifd_tcp_cancel(MigrateCommon *arg= s, bool postcopy_ram) return; } =20 - if (postcopy_ram) { - migrate_set_capability(to2, "postcopy-ram", true); - } - - migrate_set_parameter_int(to2, "multifd-channels", 16); - - migrate_set_capability(to2, "multifd", true); + /* reusing the same config for to2 */ =20 /* Start incoming migration from the 1st socket */ migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, args->start.config, @@ -755,12 +726,6 @@ static void test_cancel_src_pre_switchover(QTestState = *from, QTestState *to, const char *uri, const char *ph= ase, MigrateStart *args) { - migrate_set_capability(from, "pause-before-switchover", true); - migrate_set_capability(to, "pause-before-switchover", true); - - migrate_set_capability(from, "multifd", true); - migrate_set_capability(to, "multifd", true); - migrate_incoming_qmp(to, uri, NULL, args->config, "{ 'exit-on-error': false }"); =20 @@ -786,6 +751,9 @@ static void test_cancel_src_after_status(char *test_pat= h, MigrateCommon *args) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 + /* temporary */ + qdict_put_bool(args->start.config, "use-config", true); + args->start.hide_stderr =3D true; args->start.incoming_defer =3D true; =20 @@ -808,6 +776,10 @@ static void test_cancel_src_after_status(char *test_pa= th, MigrateCommon *args) =20 } else { /* any state that comes before pre-switchover */ + + qdict_put_bool(args->start.config, "pause-before-switchover", true= ); + qdict_put_bool(args->start.config, "multifd", true); + test_cancel_src_pre_switchover(from, to, uri, phase, &args->start); } =20 @@ -1061,19 +1033,19 @@ static void test_vcpu_dirty_limit(char *name, Migra= teCommon *args) dirtylimit_stop_vm(vm); } =20 -static void migrate_dirty_limit_wait_showup(QTestState *from, +static void migrate_dirty_limit_wait_showup(QDict *config, const int64_t period, const int64_t value) { /* Enable dirty limit capability */ - migrate_set_capability(from, "dirty-limit", true); + qdict_put_bool(config, "dirty-limit", true); =20 /* Set dirty limit parameters */ - migrate_set_parameter_int(from, "x-vcpu-dirty-limit-period", period); - migrate_set_parameter_int(from, "vcpu-dirty-limit", value); + qdict_put_int(config, "x-vcpu-dirty-limit-period", period); + qdict_put_int(config, "vcpu-dirty-limit", value); =20 /* To check limit rate after precopy */ - migrate_set_capability(from, "pause-before-switchover", true); + qdict_put_bool(config, "pause-before-switchover", true); =20 /* Wait for the serial output from the source */ wait_for_serial("src_serial"); @@ -1132,7 +1104,8 @@ static void test_dirty_limit(char *name, MigrateCommo= n *args) =20 /* Prepare for dirty limit migration and wait src vm show up */ migrate_ensure_non_converge(from, args->start.config); - migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_va= lue); + migrate_dirty_limit_wait_showup(args->start.config, dirtylimit_period, + dirtylimit_value); =20 /* Start migrate */ migrate_qmp(from, to, args->connect_uri, NULL, args->start.config, "{}= "); diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index b6d436389a..aa5482b823 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -118,9 +118,6 @@ static void test_precopy_tls_psk_common(MigrateCommon *= args, { TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0"); =20 migrate_tls_psk_init(args, test_args, data); @@ -385,9 +382,6 @@ static void test_precopy_tls_x509_common(MigrateCommon = *args, { TestMigrateTLSX509Data *data =3D g_new0(TestMigrateTLSX509Data, 1); =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - migrate_tls_x509_init(args, test_args, data); test_precopy_common(args); migrate_tls_x509_cleanup(data); --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836390; cv=none; d=zohomail.com; s=zohoarc; b=gy4aKWH+tAaxz5iQUIAC6OhEx/8VRKf8QElqLWRFCNoNPPAcdHQ49RzuFXbuk8mEQuNQ8ha0lW8pdS6/Ue/dSO/phtwgp0+IzNXO8ZZpzpxwGrYZumXM4biuxuZEQFMhDksf39IVGAKrW3YBJRUfSNbGyYX0AtLlvYTC1aSc/BM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836390; 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=uXWTsFpn/V6CcaxTrVtLPSrXypzOKq52f9e40li1sUU=; b=WPOtefTPDO2JcVmHx+LhnRLp7g035Au9XcGWJkOrlDlPWcSfuoG3SVDGLa9peDFCfg6B5OqagpCn0L38/q4lkpav13/47xZqIKvYVup1rLOIsVGTKlYdIK5X9I5rLmsb/4dY9jOdVhxVXIkRy10g7LzbHRevxdJ5yy74t9nbdJ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836390437785.3450274620722; Mon, 15 Dec 2025 14:06:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGfa-00037q-CZ; Mon, 15 Dec 2025 17:03:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGfW-0002an-F2 for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:50 -0500 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 1vVGfR-0003Mh-Ob for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:50 -0500 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 B55965BDEF; Mon, 15 Dec 2025 22:02:57 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B0D6F3EA65; Mon, 15 Dec 2025 22:02:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id iL50HI+FQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836177; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uXWTsFpn/V6CcaxTrVtLPSrXypzOKq52f9e40li1sUU=; b=xvg2X2GWxeC/wbC0V+hDzI3GQ5H5jBNe3zCpbqJiBZV0oTiTeTDSZUenYjMocG6rtg8UlG 9E6F+5PieKLYm/BPWfw4mGp1BNFKEM1kjOZLUiln2I04u0GT1TYSdrRfkoIXPAapDx9qWK 62Z0l94Sakn7TwpT1Qgv/lMkfKmgr08= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836177; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uXWTsFpn/V6CcaxTrVtLPSrXypzOKq52f9e40li1sUU=; b=F2cyTkLe8WmsTsfOBZ75XdKN7OnTZzCj7/JjLBAogTHiUZlqFjG3A08LLGmXQIRSa1DVg7 ZuSuEchVdEp+wWBQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836177; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uXWTsFpn/V6CcaxTrVtLPSrXypzOKq52f9e40li1sUU=; b=xvg2X2GWxeC/wbC0V+hDzI3GQ5H5jBNe3zCpbqJiBZV0oTiTeTDSZUenYjMocG6rtg8UlG 9E6F+5PieKLYm/BPWfw4mGp1BNFKEM1kjOZLUiln2I04u0GT1TYSdrRfkoIXPAapDx9qWK 62Z0l94Sakn7TwpT1Qgv/lMkfKmgr08= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836177; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uXWTsFpn/V6CcaxTrVtLPSrXypzOKq52f9e40li1sUU=; b=F2cyTkLe8WmsTsfOBZ75XdKN7OnTZzCj7/JjLBAogTHiUZlqFjG3A08LLGmXQIRSa1DVg7 ZuSuEchVdEp+wWBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 50/51] tests/qtest/migration: Remove migrate_set_capabilities and code around it Date: Mon, 15 Dec 2025 19:00:36 -0300 Message-ID: <20251215220041.12657-51-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836391293158500 Content-Type: text/plain; charset="utf-8" Remove all of the code that sets capabilities via migrate_set_capabilities. All the users have already been converted to use the new API. Also remove all usage of the use-config key. This is not needed anymore, tests should always pass the config object, even if empty. The ensure_non_converge and ensure_converge functions don't need the QTestState parameter anymore because there will be no fallback, the config will always be used. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/cpr-tests.c | 3 - tests/qtest/migration/framework.c | 86 +++----------------------- tests/qtest/migration/migration-qmp.c | 82 +++++------------------- tests/qtest/migration/migration-qmp.h | 4 +- tests/qtest/migration/migration-util.c | 1 - tests/qtest/migration/migration-util.h | 34 ---------- tests/qtest/migration/misc-tests.c | 16 +---- tests/qtest/migration/precopy-tests.c | 24 +++---- 8 files changed, 37 insertions(+), 213 deletions(-) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 57199ed3b8..f8c20b9038 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -186,9 +186,6 @@ static void test_cpr_exec(MigrateCommon *args) FILE_TEST_FILENAME); g_autofree char *channels =3D NULL; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - if (migrate_start(&from, NULL, args->listen_uri, &args->start)) { return; } diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index f596f1c171..363604031e 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -209,70 +209,21 @@ static QList *migrate_start_get_qmp_capabilities(cons= t MigrateStart *args) } =20 static void migrate_start_set_default_options(MigrateStart *args) -{ - if (args->config && qdict_get_bool(args->config, "use-config")) { - /* - * Always enable migration events. Libvirt always uses it, - * let's mimic that. - */ - qdict_put_bool(args->config, "events", true); - - /* - * Default number of channels should be fine for most - * tests. Individual tests can override by calling - * migrate_set_parameter() directly. - */ - if (qdict_get_try_bool(args->config, "multifd", false)) { - qdict_put_int(args->config, "multifd-channels", - MULTIFD_TEST_CHANNELS); - } - - return; - } -} - -static void migrate_start_set_capabilities(QTestState *from, QTestState *t= o, - MigrateStart *args) { /* - * MigrationCapability_lookup and MIGRATION_CAPABILITY_ constants - * are from qapi-types-migration.h. + * Always enable migration events. Libvirt always uses it, + * let's mimic that. */ - for (uint8_t i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (!args->caps[i]) { - continue; - } - if (from) { - migrate_set_capability(from, - MigrationCapability_lookup.array[i], true); - } - if (to) { - migrate_set_capability(to, - MigrationCapability_lookup.array[i], true); - } - } - - /* - * Always enable migration events. Libvirt always uses it, let's try - * to mimic as closer as that. - */ - migrate_set_capability(from, "events", true); - if (!args->defer_target_connect && to) { - migrate_set_capability(to, "events", true); - } + qdict_put_bool(args->config, "events", true); =20 /* * Default number of channels should be fine for most * tests. Individual tests can override by calling * migrate_set_parameter() directly. */ - if (args->caps[MIGRATION_CAPABILITY_MULTIFD]) { - migrate_set_parameter_int(from, "multifd-channels", - MULTIFD_TEST_CHANNELS); - if (to) { - migrate_set_parameter_int(to, "multifd-channels", - MULTIFD_TEST_CHANNELS); - } + if (qdict_get_try_bool(args->config, "multifd", false)) { + qdict_put_int(args->config, "multifd-channels", + MULTIFD_TEST_CHANNELS); } =20 return; @@ -429,7 +380,7 @@ int migrate_args(char **from, char **to, const char *ur= i, MigrateStart *args) */ events =3D args->defer_target_connect ? "-global migration.x-events=3D= on" : ""; =20 - if (!args->incoming_defer && args->config) { + if (!args->incoming_defer) { QDict *conf =3D fixup_tls_creds(args->config); GString *json =3D qobject_to_json(QOBJECT(conf)); =20 @@ -512,11 +463,9 @@ int migrate_start(QTestState **from, QTestState **to, = const char *uri, bootfile_create(qtest_get_arch(), tmpfs, args->suspend_me); src_state.suspend_me =3D args->suspend_me; =20 - args->config =3D config_load(args->config); if (migrate_args(&cmd_source, &cmd_target, uri, args)) { return -1; } - config_put(args->config); =20 if (!args->only_target) { *from =3D qtest_init_ext(QEMU_ENV_SRC, cmd_source, capabilities, t= rue); @@ -534,9 +483,6 @@ int migrate_start(QTestState **from, QTestState **to, c= onst char *uri, } =20 migrate_mem_type_cleanup(args->mem_type); - migrate_start_set_capabilities(*from, - args->only_source ? NULL : *to, - args); =20 return 0; } @@ -598,7 +544,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, args->start_hook_data); } =20 - migrate_ensure_non_converge(from, args->start.config); + migrate_ensure_non_converge(args->start.config); migrate_prepare_for_dirty_mem(from); =20 channels =3D qobject_from_json("[ { 'channel-type': 'main'," @@ -654,9 +600,6 @@ void test_postcopy_common(MigrateCommon *args) { QTestState *from, *to; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - if (migrate_postcopy_prepare(&from, &to, args)) { return; } @@ -790,9 +733,6 @@ void test_postcopy_recovery_common(MigrateCommon *args) QTestState *from, *to; g_autofree char *uri =3D NULL; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - /* * Always enable OOB QMP capability for recovery tests, migrate-recove= r is * executed out-of-band @@ -868,9 +808,6 @@ int test_precopy_common(MigrateCommon *args) QObject *in_channels =3D NULL; QObject *out_channels =3D NULL; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - g_assert(!args->cpr_channel || args->connect_channels); if (args->start.incoming_defer) { g_assert(args->listen_uri || args->connect_channels); @@ -906,7 +843,7 @@ int test_precopy_common(MigrateCommon *args) } =20 if (args->live) { - migrate_ensure_non_converge(from, args->start.config); + migrate_ensure_non_converge(args->start.config); migrate_prepare_for_dirty_mem(from); } else { /* @@ -1059,9 +996,6 @@ void test_file_common(MigrateCommon *args, bool stop_s= rc) void *data_hook =3D NULL; bool check_offset =3D false; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - if (migrate_start(&from, &to, args->listen_uri, &args->start)) { return; } @@ -1089,7 +1023,7 @@ void test_file_common(MigrateCommon *args, bool stop_= src) data_hook =3D args->start_hook_full(from, to, args->start_hook_dat= a); } =20 - migrate_ensure_converge(from, args->start.config); + migrate_ensure_converge(args->start.config); wait_for_serial("src_serial"); =20 if (stop_src) { diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/= migration-qmp.c index a4dde029ee..a9edc793cd 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -96,11 +96,8 @@ void migrate_qmp_fail(QTestState *who, const char *uri, qdict_put_obj(args, "channels", channels); } =20 - config =3D config_load(config); - if (config) { - qdict_put_obj(args, "config", QOBJECT(config)); - qobject_ref(config); - } + qdict_put_obj(args, "config", QOBJECT(config)); + qobject_ref(config); =20 err =3D qtest_qmp_assert_failure_ref( who, "{ 'execute': 'migrate', 'arguments': %p}", args); @@ -108,7 +105,6 @@ void migrate_qmp_fail(QTestState *who, const char *uri, g_assert(qdict_haskey(err, "desc")); =20 qobject_unref(err); - config_put(config); } =20 /* @@ -142,26 +138,11 @@ void migrate_qmp(QTestState *who, QTestState *to, con= st char *uri, qdict_put_obj(args, "channels", channels); } =20 - config =3D config_load(config); - if (config) { - qdict_put_obj(args, "config", QOBJECT(config)); - qobject_ref(config); - } + qdict_put_obj(args, "config", QOBJECT(config)); + qobject_ref(config); =20 qtest_qmp_assert_success(who, "{ 'execute': 'migrate', 'arguments': %p}", a= rgs); - config_put(config); -} - -void migrate_set_capability(QTestState *who, const char *capability, - bool value) -{ - qtest_qmp_assert_success(who, - "{ 'execute': 'migrate-set-capabilities'," - "'arguments': { " - "'capabilities': [ { " - "'capability': %s, 'state': %i } ] } }", - capability, value); } =20 void migrate_incoming_qmp(QTestState *to, const char *uri, QObject *channe= ls, @@ -185,13 +166,10 @@ void migrate_incoming_qmp(QTestState *to, const char = *uri, QObject *channels, } =20 /* This function relies on the event to work, make sure it's enabled */ - migrate_set_capability(to, "events", true); + qdict_put_bool(config, "events", true); =20 - config =3D config_load(config); - if (config) { - qdict_put_obj(args, "config", QOBJECT(config)); - qobject_ref(config); - } + qdict_put_obj(args, "config", QOBJECT(config)); + qobject_ref(config); =20 rsp =3D qtest_qmp(to, "{ 'execute': 'migrate-incoming', 'arguments': %= p}", args); @@ -205,7 +183,6 @@ void migrate_incoming_qmp(QTestState *to, const char *u= ri, QObject *channels, qobject_unref(rsp); =20 migration_event_wait(to, "setup"); - config_put(config); } =20 static bool check_migration_status(QTestState *who, const char *goal, @@ -463,22 +440,6 @@ void migrate_set_parameter_str(QTestState *who, const = char *parameter, migrate_check_parameter_str(who, parameter, value); } =20 -void migrate_set_parameter_strv(QTestState *who, const char *parameter, - char **strv) -{ - g_autofree char *args =3D g_strjoinv("\",\"", strv); - g_autoptr(GString) value =3D g_string_new(""); - g_autofree char *command =3D NULL; - - g_string_printf(value, "\"%s\"", args); - - command =3D g_strdup_printf("{ 'execute': 'migrate-set-parameters'," - "'arguments': { %%s: [ %s ]}}", - value->str); - - qtest_qmp_assert_success(who, command, parameter); -} - void migrate_set_parameter_null(QTestState *who, const char *parameter) { qtest_qmp_assert_success(who, @@ -534,32 +495,17 @@ void migrate_ongoing_ensure_converge(QTestState *who) migrate_set_parameter_int(who, "downtime-limit", 30 * 1000); } =20 -void migrate_ensure_non_converge(QTestState *who, QDict *config) +void migrate_ensure_non_converge(QDict *config) { - config =3D config_load(config); - if (config) { - /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */ - qdict_put_int(config, "max-bandwidth", 3 * 1000 * 1000); - qdict_put_int(config, "downtime-limit", 1); - } else { - assert(who); - migrate_ongoing_ensure_non_converge(who); - } - config_put(config); + /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */ + qdict_put_int(config, "max-bandwidth", 3 * 1000 * 1000); + qdict_put_int(config, "downtime-limit", 1); } =20 -void migrate_ensure_converge(QTestState *who, QDict *config) +void migrate_ensure_converge(QDict *config) { - config =3D config_load(config); - /* Should converge with 30s downtime + 1 gbs bandwidth limit */ - if (config) { - qdict_put_int(config, "max-bandwidth", 1 * 1000 * 1000 * 1000); - qdict_put_int(config, "downtime-limit", 30 * 1000); - } else { - assert(who); - migrate_ongoing_ensure_converge(who); - } - config_put(config); + qdict_put_int(config, "max-bandwidth", 1 * 1000 * 1000 * 1000); + qdict_put_int(config, "downtime-limit", 30 * 1000); } =20 void migrate_pause(QTestState *who) diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/= migration-qmp.h index 7daeb913fa..da0d99af59 100644 --- a/tests/qtest/migration/migration-qmp.h +++ b/tests/qtest/migration/migration-qmp.h @@ -42,8 +42,8 @@ void migrate_set_parameter_bool(QTestState *who, const ch= ar *parameter, int value); void migrate_ongoing_ensure_non_converge(QTestState *who); void migrate_ongoing_ensure_converge(QTestState *who); -void migrate_ensure_non_converge(QTestState *who, QDict *config); -void migrate_ensure_converge(QTestState *who, QDict *config); +void migrate_ensure_non_converge(QDict *config); +void migrate_ensure_converge(QDict *config); void migrate_pause(QTestState *who); void migrate_continue(QTestState *who, const char *state); void migrate_recover(QTestState *who, const char *uri); diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration= /migration-util.c index efe1ae25de..c6f5ae3cb1 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -255,7 +255,6 @@ static void migration_test_wrapper(const void *data) =20 test->data =3D g_new0(MigrateCommon, 1); test->data->start.config =3D qdict_new(); - qdict_put_bool(test->data->start.config, "use-config", false); =20 g_test_message("Running /%s%s", qtest_get_arch(), test->name); test->func(test->name, test->data); diff --git a/tests/qtest/migration/migration-util.h b/tests/qtest/migration= /migration-util.h index ec58868197..da523fb2f7 100644 --- a/tests/qtest/migration/migration-util.h +++ b/tests/qtest/migration/migration-util.h @@ -61,38 +61,4 @@ char *migrate_get_connect_uri(QTestState *who); void migrate_set_ports(QTestState *to, QList *channel_list); QDict *fixup_tls_creds(QDict *config); =20 -/* - * Scaffolding to allow the framework _common functions and _qmp - * functions to use the config object while some tests are still using - * migrate_set_*. Tests that have been converted will set use-config =3D - * true on the config dict. - */ -static bool has_key; -static bool use_config; -static inline QDict *config_load(QDict *config) -{ - if (!config) { - return NULL; - } - - has_key =3D qdict_haskey(config, "use-config"); - if (has_key) { - use_config =3D qdict_get_try_bool(config, "use-config", false); - qdict_del(config, "use-config"); - } - - if (use_config) { - return config; - } - - return NULL; -} - -static inline void config_put(QDict *config) -{ - if (config && has_key) { - qdict_put_bool(config, "use-config", use_config); - } -} - #endif /* MIGRATION_UTIL_H */ diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 7e38d26ab2..4bac7fff41 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -28,9 +28,6 @@ static void test_baddest(char *name, MigrateCommon *args) =20 args->start.hide_stderr =3D true; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; } @@ -55,9 +52,6 @@ static void test_analyze_script(char *name, MigrateCommon= *args) return; } =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - /* dummy url */ if (migrate_start(&from, &to, "tcp:127.0.0.1:0", &args->start)) { return; @@ -74,7 +68,7 @@ static void test_analyze_script(char *name, MigrateCommon= *args) file =3D g_strdup_printf("%s/migfile", tmpfs); uri =3D g_strdup_printf("exec:cat > %s", file); =20 - migrate_ensure_converge(from, args->start.config); + migrate_ensure_converge(args->start.config); migrate_qmp(from, to, uri, NULL, args->start.config, "{}"); wait_for_migration_complete(from); =20 @@ -103,16 +97,13 @@ static void test_ignore_shared(char *name, MigrateComm= on *args) =20 args->start.mem_type =3D MEM_TYPE_SHMEM; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - qdict_put_bool(args->start.config, "x-ignore-shared", true); =20 if (migrate_start(&from, &to, uri, &args->start)) { return; } =20 - migrate_ensure_non_converge(from, args->start.config); + migrate_ensure_non_converge(args->start.config); migrate_prepare_for_dirty_mem(from); =20 /* Wait for the first serial output from the source */ @@ -141,9 +132,6 @@ static void do_test_validate_uuid(MigrateStart *args, b= ool should_fail) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - /* temporary */ - qdict_put_bool(args->config, "use-config", true); - if (migrate_start(&from, &to, uri, args)) { return; } diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index f8f46322bc..bb96cbb56f 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -374,7 +374,7 @@ static void test_auto_converge(char *name, MigrateCommo= n *args) * Set the initial parameters so that the migration could not converge * without throttling. */ - migrate_ensure_non_converge(from, args->start.config); + migrate_ensure_non_converge(args->start.config); =20 /* To check remaining size after precopy */ qdict_put_bool(args->start.config, "pause-before-switchover", true); @@ -536,9 +536,6 @@ static void test_multifd_tcp_cancel(MigrateCommon *args= , bool postcopy_ram) { QTestState *from, *to, *to2; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - args->start.hide_stderr =3D true; args->start.incoming_defer =3D true; =20 @@ -546,7 +543,7 @@ static void test_multifd_tcp_cancel(MigrateCommon *args= , bool postcopy_ram) return; } =20 - migrate_ensure_non_converge(from, args->start.config); + migrate_ensure_non_converge(args->start.config); migrate_prepare_for_dirty_mem(from); =20 if (postcopy_ram) { @@ -598,7 +595,7 @@ static void test_multifd_tcp_cancel(MigrateCommon *args= , bool postcopy_ram) migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", NULL, args->start.config, "{}"); =20 - migrate_ensure_non_converge(from, args->start.config); + migrate_ensure_non_converge(args->start.config); =20 migrate_qmp(from, to2, NULL, NULL, args->start.config, "{}"); =20 @@ -632,7 +629,7 @@ static void test_cancel_src_after_failed(QTestState *fr= om, QTestState *to, */ =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from, args->config); + migrate_ensure_converge(args->config); =20 migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 @@ -658,7 +655,7 @@ static void test_cancel_src_after_cancelled(QTestState = *from, QTestState *to, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from, args->config); + migrate_ensure_converge(args->config); =20 migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 @@ -684,7 +681,7 @@ static void test_cancel_src_after_complete(QTestState *= from, QTestState *to, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from, args->config); + migrate_ensure_converge(args->config); =20 migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 @@ -715,7 +712,7 @@ static void test_cancel_src_after_none(QTestState *from= , QTestState *to, migrate_incoming_qmp(to, uri, NULL, args->config, "{ 'exit-on-error': false }"); =20 - migrate_ensure_converge(from, args->config); + migrate_ensure_converge(args->config); migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 wait_for_migration_complete(from); @@ -730,7 +727,7 @@ static void test_cancel_src_pre_switchover(QTestState *= from, QTestState *to, "{ 'exit-on-error': false }"); =20 wait_for_serial("src_serial"); - migrate_ensure_converge(from, args->config); + migrate_ensure_converge(args->config); =20 migrate_qmp(from, to, uri, NULL, args->config, "{}"); =20 @@ -751,9 +748,6 @@ static void test_cancel_src_after_status(char *test_pat= h, MigrateCommon *args) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - /* temporary */ - qdict_put_bool(args->start.config, "use-config", true); - args->start.hide_stderr =3D true; args->start.incoming_defer =3D true; =20 @@ -1103,7 +1097,7 @@ static void test_dirty_limit(char *name, MigrateCommo= n *args) } =20 /* Prepare for dirty limit migration and wait src vm show up */ - migrate_ensure_non_converge(from, args->start.config); + migrate_ensure_non_converge(args->start.config); migrate_dirty_limit_wait_showup(args->start.config, dirtylimit_period, dirtylimit_value); =20 --=20 2.51.0 From nobody Mon Feb 9 04:32:46 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=1765836263; cv=none; d=zohomail.com; s=zohoarc; b=Qcxaa+x3/T8hL1QkDpMAjSKpoIF/o2yBrTIQUZ9nlbdDzbB//sAe7yQHpGVa+xBZ31giwX1Cmu/R6MHWGCRnjQ24j+UuSaJrmbgNHB3o3JXltzy1EOTjjzFuArUAlTnM+AlGATq7E020xAQFTXkZSMvOGKHektKKTePuDVEmTN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765836263; 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=wS1Se1O16cm5p8znhF1rexTm8ckxpPn3WO6AAmjcCME=; b=Pnu2nTgOEIhSlj1EZqCJXFWzT84gzy2fGfvp/3iWFUp/Zhfg02rpyHq+bTY0eyDShqqadAYMrXBIVrJR9GiZBM74b3H3UVXoSJSxjeaFQ2sjMWNZQBPWp0v0JftUffUv7kg23Js230g2hkUsQwn1lIEjg4rXTyWQFOjg2MOmqsE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765836263248235.15140021295792; Mon, 15 Dec 2025 14:04:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vVGfX-0002kP-MY; Mon, 15 Dec 2025 17:03:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vVGfV-0002Ww-Rn for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:49 -0500 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 1vVGfT-0003OG-3M for qemu-devel@nongnu.org; Mon, 15 Dec 2025 17:03:49 -0500 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 583BC33748; Mon, 15 Dec 2025 22:03:00 +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 471F83EA63; Mon, 15 Dec 2025 22:02:58 +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 KPl3ApKFQGlrMQAAD6G6ig (envelope-from ); Mon, 15 Dec 2025 22:02:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836180; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wS1Se1O16cm5p8znhF1rexTm8ckxpPn3WO6AAmjcCME=; b=pORvknywWNso6vZMFl1PTv7DwWRtC97CgQ4fQUg2IosCdbqzd925sDSyOq2j9tbGO0P/jP XNSTlwcojXkXrhOjJc4cfKyxBN4EuV1cQ3ZYiyfYA71yVlQqkkOSHD5n4ZHkL8oVlsY2SH J0ntCrF3FRdmfqA2GQpuB8qqZcxk4s4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836180; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wS1Se1O16cm5p8znhF1rexTm8ckxpPn3WO6AAmjcCME=; b=QEjkd0UqOi3D/8HvyGueu7NiDx9Lc4xI0Ou/1dwQ3AJXUrwJnJ1zcwMRF8DFI9EnBG1VcP 2nIhoFfyze3NsjAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765836180; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wS1Se1O16cm5p8znhF1rexTm8ckxpPn3WO6AAmjcCME=; b=pORvknywWNso6vZMFl1PTv7DwWRtC97CgQ4fQUg2IosCdbqzd925sDSyOq2j9tbGO0P/jP XNSTlwcojXkXrhOjJc4cfKyxBN4EuV1cQ3ZYiyfYA71yVlQqkkOSHD5n4ZHkL8oVlsY2SH J0ntCrF3FRdmfqA2GQpuB8qqZcxk4s4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765836180; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wS1Se1O16cm5p8znhF1rexTm8ckxpPn3WO6AAmjcCME=; b=QEjkd0UqOi3D/8HvyGueu7NiDx9Lc4xI0Ou/1dwQ3AJXUrwJnJ1zcwMRF8DFI9EnBG1VcP 2nIhoFfyze3NsjAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: berrange@redhat.com, armbru@redhat.com, Peter Xu , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 51/51] tests/qtest/migration: Further simplify TLS tests Date: Mon, 15 Dec 2025 19:00:37 -0300 Message-ID: <20251215220041.12657-52-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251215220041.12657-1-farosas@suse.de> References: <20251215220041.12657-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.990]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLjrdmmf3juheryardexw6jb95)]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1765836264556158500 Content-Type: text/plain; charset="utf-8" Now that the TLS hooks were simplified, many test functions are using the same hook, but passing a different data pointer. Since the data pointer is already an argument for the _common function, stop setting the hook & data in the test function and do it instead in the init routine. Signed-off-by: Fabiano Rosas --- tests/qtest/migration/tls-tests.c | 60 +++++-------------------------- 1 file changed, 8 insertions(+), 52 deletions(-) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index aa5482b823..da8b3e42fe 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -80,6 +80,11 @@ static void migrate_tls_psk_init(MigrateCommon *args, TestMigrateTLSPSK *test_args, TestMigrateTLSPSKData *data) { + qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0"); + + args->start_hook_full =3D migrate_hook_start_tls_psk_common; + args->start_hook_data =3D test_args; + data->workdir =3D g_strdup_printf("%s/tlscredspsk0", tmpfs); data->pskfile =3D g_strdup_printf("%s/%s", data->workdir, QCRYPTO_TLS_CREDS_PSKFILE); @@ -118,8 +123,6 @@ static void test_precopy_tls_psk_common(MigrateCommon *= args, { TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); =20 - qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0"); - migrate_tls_psk_init(args, test_args, data); test_precopy_common(args); migrate_tls_psk_cleanup(data); @@ -130,8 +133,6 @@ static void test_postcopy_tls_psk_common(MigrateCommon = *args, { TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); =20 - qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0"); - migrate_tls_psk_init(args, test_args, data); test_postcopy_common(args); migrate_tls_psk_cleanup(data); @@ -142,8 +143,6 @@ static void test_postcopy_recovery_tls_psk_common(Migra= teCommon *args, { TestMigrateTLSPSKData *data =3D g_new0(TestMigrateTLSPSKData, 1); =20 - qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0"); - migrate_tls_psk_init(args, test_args, data); test_postcopy_recovery_common(args); migrate_tls_psk_cleanup(data); @@ -283,6 +282,9 @@ static void migrate_tls_x509_init(MigrateCommon *args, TestMigrateTLSX509 *test_args, TestMigrateTLSX509Data *data) { + args->start_hook_full =3D migrate_hook_start_tls_x509_common; + args->start_hook_data =3D test_args; + data->workdir =3D g_strdup_printf("%s/tlscredsx5090", tmpfs); data->keyfile =3D g_strdup_printf("%s/key.pem", data->workdir); =20 @@ -390,17 +392,11 @@ static void test_precopy_tls_x509_common(MigrateCommo= n *args, =20 static void test_postcopy_tls_psk(char *name, MigrateCommon *args) { - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_match; - test_postcopy_tls_psk_common(args, &tls_psk_match); } =20 static void test_postcopy_preempt_tls_psk(char *name, MigrateCommon *args) { - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_match; - qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 test_postcopy_tls_psk_common(args, &tls_psk_match); @@ -408,18 +404,12 @@ static void test_postcopy_preempt_tls_psk(char *name,= MigrateCommon *args) =20 static void test_postcopy_recovery_tls_psk(char *name, MigrateCommon *args) { - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_match; - test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); } =20 static void test_multifd_postcopy_recovery_tls_psk(char *name, MigrateCommon *args) { - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_match; - qdict_put_bool(args->start.config, "multifd", true); =20 test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); @@ -428,9 +418,6 @@ static void test_multifd_postcopy_recovery_tls_psk(char= *name, /* This contains preempt+recovery+tls test altogether */ static void test_postcopy_preempt_all(char *name, MigrateCommon *args) { - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_match; - qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 test_postcopy_recovery_tls_psk_common(args, &tls_psk_match); @@ -439,9 +426,6 @@ static void test_postcopy_preempt_all(char *name, Migra= teCommon *args) static void test_multifd_postcopy_preempt_recovery_tls_psk(char *name, MigrateCommon *= args) { - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_match; - qdict_put_bool(args->start.config, "multifd", true); qdict_put_bool(args->start.config, "postcopy-preempt", true); =20 @@ -454,8 +438,6 @@ static void test_precopy_unix_tls_psk(char *name, Migra= teCommon *args) =20 args->connect_uri =3D uri; args->listen_uri =3D uri; - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_match; =20 test_precopy_tls_psk_common(args, &tls_psk_match); } @@ -468,8 +450,6 @@ static void test_precopy_unix_tls_x509_default_host(cha= r *name, =20 args->connect_uri =3D uri; args->listen_uri =3D uri; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_default_host; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 args->start.hide_stderr =3D true; @@ -484,8 +464,6 @@ static void test_precopy_unix_tls_x509_override_host(ch= ar *name, =20 args->connect_uri =3D uri; args->listen_uri =3D uri; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_override_host; =20 test_precopy_tls_x509_common(args, &tls_x509_override_host); } @@ -494,8 +472,6 @@ static void test_precopy_unix_tls_x509_override_host(ch= ar *name, static void test_precopy_tcp_tls_psk_match(char *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_match; =20 test_precopy_tls_psk_common(args, &tls_psk_match); } @@ -503,8 +479,6 @@ static void test_precopy_tcp_tls_psk_match(char *name, = MigrateCommon *args) static void test_precopy_tcp_tls_psk_mismatch(char *name, MigrateCommon *a= rgs) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_psk_common; - args->start_hook_data =3D &tls_psk_mismatch; args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; @@ -524,8 +498,6 @@ static void test_precopy_tcp_no_tls(char *name, Migrate= Common *args) static void test_precopy_tcp_tls_no_hostname(char *name, MigrateCommon *ar= gs) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_no_host; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 args->start.hide_stderr =3D true; @@ -538,8 +510,6 @@ static void test_precopy_tcp_tls_x509_default_host(char= *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_default_host; =20 test_precopy_tls_x509_common(args, &tls_x509_default_host); } @@ -548,8 +518,6 @@ static void test_precopy_tcp_tls_x509_override_host(cha= r *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_override_host; =20 test_precopy_tls_x509_common(args, &tls_x509_override_host); } @@ -558,8 +526,6 @@ static void test_precopy_tcp_tls_x509_mismatch_host(cha= r *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_mismatch_host; args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; =20 args->start.hide_stderr =3D true; @@ -571,8 +537,6 @@ static void test_precopy_tcp_tls_x509_friendly_client(c= har *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &x509_friendly_client; =20 test_precopy_tls_x509_common(args, &x509_friendly_client); } @@ -581,8 +545,6 @@ static void test_precopy_tcp_tls_x509_hostile_client(ch= ar *name, MigrateCommon *args) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_hostile_client; args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; @@ -594,8 +556,6 @@ static void test_precopy_tcp_tls_x509_allow_anon_client= (char *name, MigrateCommon *arg= s) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_allow_anon_client; =20 test_precopy_tls_x509_common(args, &tls_x509_allow_anon_client); } @@ -604,8 +564,6 @@ static void test_precopy_tcp_tls_x509_reject_anon_clien= t(char *name, MigrateCommon *ar= gs) { args->listen_uri =3D "tcp:127.0.0.1:0"; - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_reject_anon_client; args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; @@ -679,8 +637,6 @@ static void test_multifd_tcp_tls_x509_mismatch_host(cha= r *name, * to load migration state, and thus just aborts the migration * without exiting. */ - args->start_hook_full =3D migrate_hook_start_tls_x509_common; - args->start_hook_data =3D &tls_x509_mismatch_host; args->result =3D MIG_TEST_FAIL; args->listen_uri =3D "tcp:127.0.0.1:0"; =20 --=20 2.51.0