From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398925; cv=none; d=zohomail.com; s=zohoarc; b=VDNQjm03cdFhhikAHRjv/9JeSsHG3qoyM4qgjmQbhhob7RFHK3bO67kQDDhgv/tGNW1qfKgg7WOEDAZehtcu9GG/qq0csQX4dnwCgKwBYZdmK9a9eZ0PhNYjuykwHmn+v1FXtrVgxXs+bPFGkUvje8W+0+WOHmq4eZYYujjZyEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398925; 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=XeUdd4OZZmhyTvc1eokp8pIfAly+LfyHHMrzqrr7cdM=; b=IsRS41Fdd2QlMzP+IrbGxQlk9UWMpKwWLnwMuby1BJhwYMVMllYd5ouiEwy05dwEAVltv7bMUA1RTWWhAqBuwmZmu2Sdo8q/OXL5cWMqukPxmkckLMJzYjwxwh+JrG+vfnmm8cbrmLtETPNQCHVuPISVPFhi51it/OElrAILsGM= 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 1744398925504494.91502658393244; Fri, 11 Apr 2025 12:15:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jq9-0003vc-EL; Fri, 11 Apr 2025 15:15:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jq6-0003v7-T3 for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:14:58 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3Jq5-0005xm-3n for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:14:58 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E678121196; Fri, 11 Apr 2025 19:14: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 6BDC613886; Fri, 11 Apr 2025 19:14:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0NKrCyhq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:14:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398890; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XeUdd4OZZmhyTvc1eokp8pIfAly+LfyHHMrzqrr7cdM=; b=CcTiyHCgG6pzT27e/AGFgw8qhRyKmqtUDXbgOAf2oGeccLl+JJ9ja/Daoe97SQIbM6+7qL AEZX8pCXLDeOMd2IUrWKDo9NJGiIXAHL+DXeQ3Kz/404/f92HeJBGgP184JcErQJ7RNjMl NJavNsJ3qQ45ZqsM3OQj+1qL9U8X2YU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398890; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XeUdd4OZZmhyTvc1eokp8pIfAly+LfyHHMrzqrr7cdM=; b=P+K5es7mM0UnduNCglLhwAdzlchZWk4VRJt1mnl7CYBLXcCTcAVfKfEmVjhKzZouWsmth/ HCEagLx3ojRGdGCg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398889; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XeUdd4OZZmhyTvc1eokp8pIfAly+LfyHHMrzqrr7cdM=; b=ADnqfvVygfp7NajDkSK7LxebjvZUd9u0KnHqri3kqy+NGba1p3M1scwp+eykToN+l79S6k gSmxjPK5LUMRexY5Sdb8A358y9Lav7WGCREc7xwIMH3zYCy74qw5nL7sy1rRfOsZ4V16+s m6KktpW0f6UubYdVhWwEg5o2jof7Xj0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398889; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XeUdd4OZZmhyTvc1eokp8pIfAly+LfyHHMrzqrr7cdM=; b=Xy9c4fXgJKVnWT0tCvhlrJeCjRWLHxWpP5+n26pL82vkbISqUZl/56L8I8tOQvz+ZCk0+F RXcIeDAZEN+cYFDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 01/13] migration: Fix latent bug in migrate_params_test_apply() Date: Fri, 11 Apr 2025 16:14:31 -0300 Message-Id: <20250411191443.22565-2-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-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)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; 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: 1744398926295019000 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster migrate_params_test_apply() neglects to apply tls_authz. Currently harmless, because migrate_params_check() doesn't care. Fix it anyway. Signed-off-by: Markus Armbruster Reviewed-by: Fabiano Rosas Message-ID: <20250407072833.2118928-1-armbru@redhat.com> Signed-off-by: Fabiano Rosas --- migration/options.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/migration/options.c b/migration/options.c index b0ac2ea408..cb8eec218f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1193,6 +1193,11 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, dest->tls_hostname =3D params->tls_hostname->u.s; } =20 + if (params->tls_authz) { + assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); + dest->tls_authz =3D params->tls_authz->u.s; + } + if (params->has_max_bandwidth) { dest->max_bandwidth =3D params->max_bandwidth; } --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398927; cv=none; d=zohomail.com; s=zohoarc; b=E5YAR/4U/tcKa3CuSqez4+e+6uWLSj+ROFIUkA3f6fJ/HIQ0EU/UJyoG9kvJAFBYY70Wz6xComAznSEMZR7vucPlNRV30u33zkfzpbXrI5gim6BUD2YCxkPQG/+axXrJ8hvJ284Pn5I7dsZKxPA0wQSaGG6hjyZINyO9BYp+J6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398927; 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=UdWkTrqphcjVjsPPDRqSv5Jp27YEDItKik/C/U4rk+M=; b=Mm1foskFyBibUNbhUr9DuFV5eZ9Nw3x+mn3RvyvhBotnKHhPolD9fI+LZ4Fz7jkF17glxq6SoLhzDUC2GodSdz5rpR/IcH3CDwxm6j18PGixltCQGxUed4aCWfstg9uZgivOrlAp5UnQ5hf9TO5EqSrp7vSdXj4HUovH8Tgguv8= 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 1744398927442726.3344730420973; Fri, 11 Apr 2025 12:15:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3JqF-0003xk-OU; Fri, 11 Apr 2025 15:15:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3JqC-0003wr-Po for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:04 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3JqA-0005ym-Q4 for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:04 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E27EF21197; Fri, 11 Apr 2025 19:14: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 667C313886; Fri, 11 Apr 2025 19:14: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 +Nc5Cipq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:14:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398892; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UdWkTrqphcjVjsPPDRqSv5Jp27YEDItKik/C/U4rk+M=; b=aevb3CS5uG38mFQJseB5TPIDmS7EqQ6JGoqbs5LFm3kG9jJHzGMVfEsSr1Ww6hQhshENzN +akle7p1hh+wlvrgS+iZcCF1Sa/Ne5dYREF7gH8vyX3NrDlmNj9oH81P4iSVIdpicQVupe p9CW7Z4qPUWNe5iSLxldBW6I5ZnVp6g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398892; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UdWkTrqphcjVjsPPDRqSv5Jp27YEDItKik/C/U4rk+M=; b=OE8e05W8uHPZyJxQNJ9XOrAXS1JVKxNzBzwe2OW5iRKYtwddJKcwIUS8nnpVMsMvs/B1Kw P2FGbNRCKTyHU7Cg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=pzFyWFW0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=o+uSWmNH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398891; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UdWkTrqphcjVjsPPDRqSv5Jp27YEDItKik/C/U4rk+M=; b=pzFyWFW0Wkq8SqPYFMNbYlFiMEoN4IhuPjvrthOoHnuybavDC3gvP0y5nDw1HgvhdrNGl6 Ia7Gd95rlLiVWajPDM3AjEi9xAZTh5bVoCYQ5YaNXE7JSzMc9DQm6ueMtHjUPUC4ZS4QUl b+d9V7JIUbbqrsifn5RlIOn9+EYCa7I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398891; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UdWkTrqphcjVjsPPDRqSv5Jp27YEDItKik/C/U4rk+M=; b=o+uSWmNHWCkOkYBqnAcev2cdYtYKUEgnc5+WhPjDXnqiQamLudwwCXTqu46rmMDyyo0zPs 9udt4CigZlxXSEBQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 02/13] migration: Normalize tls arguments Date: Fri, 11 Apr 2025 16:14:32 -0300 Message-Id: <20250411191443.22565-3-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: E27EF21197 X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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: 1744398930060019100 Content-Type: text/plain; charset="utf-8" The tls_creds, tls_authz and tls_hostname arguments are strings that can be set by the user. They are allowed to be either a valid string, an empty string or NULL. The values "" and NULL are effectively treated the same by the code, but this is not entirely clear because the handling is not uniform. Make the 3 variables be handled the same and at the same place in options.c. Note that this affects only the internal usage of the variables. (migrate_tls() had to be moved to be able to use migrate_tls_creds()) Signed-off-by: Fabiano Rosas --- migration/options.c | 81 ++++++++++++++++++++++++--------------------- migration/tls.c | 2 +- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/migration/options.c b/migration/options.c index cb8eec218f..7cd465ca94 100644 --- a/migration/options.c +++ b/migration/options.c @@ -379,13 +379,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, @@ -814,21 +807,41 @@ const char *migrate_tls_authz(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.tls_authz; + if (s->parameters.tls_authz && + *s->parameters.tls_authz) { + return s->parameters.tls_authz; + } + + 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 && + *s->parameters.tls_creds) { + return s->parameters.tls_creds; + } + + 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 && + *s->parameters.tls_hostname) { + return s->parameters.tls_hostname; + } + + return NULL; +} + +bool migrate_tls(void) +{ + return !!migrate_tls_creds(); } =20 uint64_t migrate_vcpu_dirty_limit_period(void) @@ -883,8 +896,10 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **errp) params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; params->has_cpu_throttle_tailslow =3D true; params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; - params->tls_creds =3D g_strdup(s->parameters.tls_creds); - params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); + params->tls_creds =3D g_strdup(s->parameters.tls_creds ? + s->parameters.tls_creds : ""); + params->tls_hostname =3D g_strdup(s->parameters.tls_hostname ? + s->parameters.tls_hostname : ""); params->tls_authz =3D g_strdup(s->parameters.tls_authz ? s->parameters.tls_authz : ""); params->has_max_bandwidth =3D true; @@ -945,6 +960,7 @@ void migrate_params_init(MigrationParameters *params) { params->tls_hostname =3D g_strdup(""); params->tls_creds =3D g_strdup(""); + params->tls_authz =3D g_strdup(""); =20 /* Set has_* up only for parameter checks */ params->has_throttle_trigger_threshold =3D true; @@ -1184,18 +1200,27 @@ 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; + if (params->tls_creds->type =3D=3D QTYPE_QNULL) { + dest->tls_creds =3D NULL; + } else { + dest->tls_creds =3D params->tls_creds->u.s; + } } =20 if (params->tls_hostname) { - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - dest->tls_hostname =3D params->tls_hostname->u.s; + if (params->tls_hostname->type =3D=3D QTYPE_QNULL) { + dest->tls_hostname =3D NULL; + } else { + dest->tls_hostname =3D params->tls_hostname->u.s; + } } =20 if (params->tls_authz) { - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - dest->tls_authz =3D params->tls_authz->u.s; + if (params->tls_authz->type =3D=3D QTYPE_QNULL) { + dest->tls_authz =3D NULL; + } else { + dest->tls_authz =3D params->tls_authz->u.s; + } } =20 if (params->has_max_bandwidth) { @@ -1413,26 +1438,6 @@ void qmp_migrate_set_parameters(MigrateSetParameters= *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(""); - } - migrate_params_test_apply(params, &tmp); =20 if (!migrate_params_check(&tmp, errp)) { diff --git a/migration/tls.c b/migration/tls.c index 5cbf952383..8a89d3f767 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -126,7 +126,7 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *= ioc, } =20 const char *tls_hostname =3D migrate_tls_hostname(); - if (tls_hostname && *tls_hostname) { + if (tls_hostname) { hostname =3D tls_hostname; } =20 --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398938; cv=none; d=zohomail.com; s=zohoarc; b=e+u8LIB82iVO2jWVhGl6/hEfRXVmhJVVFazIw9hnh2J/CdcjPCI/zaCi7FqqhaIn5FIDIUbgWD3k+uRt/WeRkUVlZJWXqJxraiW9iov9cux1YOMrt3XGR847sj0mfO/Zw41rdf4ysLf1S2f4CEF1SZCzSC6Yp6fy7wYbu39kkUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398938; 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=1nDdyb8LBvk2cGMnL7r5nRYQqV2zhbnFKysMMSxK7yo=; b=Gq9dA4s9Dvh0QZVkBAoPKuWkm9bt6jIpbglQmOJ9VALilM3BdbcjVb+Hum5P+A/jeHCbMWvkaHnlhOGrajdtlBk89Pc3FIO4wVrJ9JDH6SZEdF5rFfOKSCI30OJGfNwq58kAVZLL+tcneFgveBoW/R8z+fpkCCVArrrkNZS5M8I= 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 1744398938173357.3806787218242; Fri, 11 Apr 2025 12:15:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jq7-0003vD-6z; Fri, 11 Apr 2025 15:14:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jq5-0003uv-7z for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:14:57 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3Jq3-0005xU-IN for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:14:56 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E24761F453; Fri, 11 Apr 2025 19:14:53 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6296D13886; Fri, 11 Apr 2025 19:14: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 ULdJCSxq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:14:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398893; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1nDdyb8LBvk2cGMnL7r5nRYQqV2zhbnFKysMMSxK7yo=; b=IDTcfhXuIrAv9hKK/zs/b5q/DAhVFhmXcnGEcDvXxWML/LhaXFVfx1fRpLpqDCvCvdkTon 4Bqk9BiX/g8G+30R6CY/SRuKhpJ+2z593Msttc1TcWT8E8fr+8m5xZ4rVichvGJNUmvDDr 1b861pJfBpmWGSWnBsgsaw4eGJuqqus= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398893; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1nDdyb8LBvk2cGMnL7r5nRYQqV2zhbnFKysMMSxK7yo=; b=NhfwtQYvhREeAGHmeGvixQaWZmp/JWZ5sF1/ogzDm9aqb3GQGdWLre3UuR1mchrr3rKQvM 4eVLb1mn56kfu9Dw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398893; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1nDdyb8LBvk2cGMnL7r5nRYQqV2zhbnFKysMMSxK7yo=; b=IDTcfhXuIrAv9hKK/zs/b5q/DAhVFhmXcnGEcDvXxWML/LhaXFVfx1fRpLpqDCvCvdkTon 4Bqk9BiX/g8G+30R6CY/SRuKhpJ+2z593Msttc1TcWT8E8fr+8m5xZ4rVichvGJNUmvDDr 1b861pJfBpmWGSWnBsgsaw4eGJuqqus= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398893; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1nDdyb8LBvk2cGMnL7r5nRYQqV2zhbnFKysMMSxK7yo=; b=NhfwtQYvhREeAGHmeGvixQaWZmp/JWZ5sF1/ogzDm9aqb3GQGdWLre3UuR1mchrr3rKQvM 4eVLb1mn56kfu9Dw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 03/13] migration: Run a post update routine after setting parameters Date: Fri, 11 Apr 2025 16:14:33 -0300 Message-Id: <20250411191443.22565-4-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -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: 1744398940238019000 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. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/options.c | 39 +++++++++++++++++++++++++++++---------- migration/ram.c | 2 +- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/migration/options.c b/migration/options.c index 7cd465ca94..cac28540dd 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1302,7 +1302,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(MigrateSetParameters *params) { MigrationState *s =3D migrate_get_current(); =20 @@ -1344,9 +1344,6 @@ static void migrate_params_apply(MigrateSetParameters= *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) { @@ -1359,7 +1356,6 @@ static void migrate_params_apply(MigrateSetParameters= *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) { @@ -1379,13 +1375,9 @@ static void migrate_params_apply(MigrateSetParameter= s *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; @@ -1434,6 +1426,32 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) } } =20 +static void migrate_post_update_params(MigrateSetParameters *new, Error **= errp) +{ + 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); + } + } + +} + void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) { MigrationParameters tmp; @@ -1445,5 +1463,6 @@ void qmp_migrate_set_parameters(MigrateSetParameters = *params, Error **errp) return; } =20 - migrate_params_apply(params, errp); + migrate_params_apply(params); + migrate_post_update_params(params, errp); } diff --git a/migration/ram.c b/migration/ram.c index 424df6d9f1..e0ba8e0d48 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -144,7 +144,7 @@ static void XBZRLE_cache_unlock(void) /** * xbzrle_cache_resize: resize the xbzrle cache * - * This function is called from migrate_params_apply in main + * This function is called from migrate_post_update_config in main * thread, possibly while a migration is in progress. A running * migration may be using the cache and might finish during this call, * hence changes to the cache are protected by XBZRLE.lock(). --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398983; cv=none; d=zohomail.com; s=zohoarc; b=dBwEXMjNQWiZRRQrXegRyf01eGgXjWNW9Xesu2+EEpmNk3Ti+5bFaIqQ7u2ItQzOl9CX4StchWOro009LbS5ooocAZF5Aegz0KelzQqXGUYgeXbib9ILHODIFEMtzvvbHo6Q3evRszLlPUM6mZLsebxKJB/n4+Zw8LNnTiR8tTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398983; 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=3tIyrgfRRtKoSyhqRZyFijGoBLABFttNkQx5rn3jGRQ=; b=fhnqwOVFMLR6WGO+SMy/Wfh0jcoapcmV7ke2DfKKVTNmxw249mnCgRVEtJs5zI6CCMYNRw1J7duWJTAjStg0KGUEUACLBMlIMd3tR8fc5B9DCiWy0WRR/cn0e7IAC2e99WR3EVJV8YV9vHZGw5hE0iwGB5c12vH7dDK2FhWplWQ= 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 1744398983365650.5294966934036; Fri, 11 Apr 2025 12:16:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jqf-0004Ef-Q8; Fri, 11 Apr 2025 15:15:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3JqL-0003yI-Tn for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:24 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3JqG-0006AR-Oe for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:11 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E82BD21195; Fri, 11 Apr 2025 19:14: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 610EC13886; Fri, 11 Apr 2025 19:14: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 mHP/CC5q+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:14:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3tIyrgfRRtKoSyhqRZyFijGoBLABFttNkQx5rn3jGRQ=; b=bKGeDgXfHxBbZpfI8XvTSseFfcEEAYi3tuM2web9vKOhE2FPKhvUyaT/m9YsjOh7BU2inX IEHwKo19D4ILqKnWucbUDUQAQZDOGTeJdWcsMEAc8RuT68SIw5XmjL/5R8kx2yb7Ts4WYJ SnuOlTUeeg6IQlP6CXN78vcV6ZnixHY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3tIyrgfRRtKoSyhqRZyFijGoBLABFttNkQx5rn3jGRQ=; b=1TjBOuaOC6BhKpqPSj7B4+YKVUhb7owiBgls6OF6ls4dcRIi5+oz0s2oDUk7NNsXtAhpAP L++hZTYFf5z5YcCw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3tIyrgfRRtKoSyhqRZyFijGoBLABFttNkQx5rn3jGRQ=; b=bKGeDgXfHxBbZpfI8XvTSseFfcEEAYi3tuM2web9vKOhE2FPKhvUyaT/m9YsjOh7BU2inX IEHwKo19D4ILqKnWucbUDUQAQZDOGTeJdWcsMEAc8RuT68SIw5XmjL/5R8kx2yb7Ts4WYJ SnuOlTUeeg6IQlP6CXN78vcV6ZnixHY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3tIyrgfRRtKoSyhqRZyFijGoBLABFttNkQx5rn3jGRQ=; b=qrE7lDGTx9H5ElvAfYRHWFGtBkBtjwmUfpOfa9VOD9UiTfoaFKrkTYMB7dGSinPqwdrqfA mCM0b1HKVJBqAOBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 04/13] migration: Fix parameter validation Date: Fri, 11 Apr 2025 16:14:34 -0300 Message-Id: <20250411191443.22565-5-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-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)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; 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: 1744398984512019000 Content-Type: text/plain; charset="utf-8" The migration parameters validation involves producing a temporary structure which merges the current parameter values with the new parameters set by the user. The has_ boolean fields of MigrateSetParameter are taken into consideration when writing the temporary structure, however the copy of the current parameters also copies all the has_ fields of s->parameters and those are (almost) all true due to being initialized by migrate_params_init(). Since the temporary structure copy does not carry over the has_ fields from MigrateSetParameters, only the values which were initialized in migrate_params_init() will end up being validated. This causes (almost) all of the migration parameters to be validated again every time a parameter is set, which could be considered a bug. But it also skips validation of those values which are not set in migrate_params_init(), which is a worse issue. Fix by initializing the missing values in migrate_params_init(). Currently 'avail_switchover_bandwidth' and 'block_bitmap_mapping' are affected. Signed-off-by: Fabiano Rosas --- migration/options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/options.c b/migration/options.c index cac28540dd..625d597a85 100644 --- a/migration/options.c +++ b/migration/options.c @@ -987,6 +987,8 @@ void migrate_params_init(MigrationParameters *params) params->has_mode =3D true; params->has_zero_page_detection =3D true; params->has_direct_io =3D true; + params->has_avail_switchover_bandwidth =3D true; + params->has_block_bitmap_mapping =3D true; } =20 /* --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398999; cv=none; d=zohomail.com; s=zohoarc; b=b3XFf8daWFJ+TpdqLkM0f8jKUkBRbx5opLRIjbXcfW2CO7UM8QE2qipbaVpADb8zjhtTLqKMRiD1YBTd11wFwNnJUqRyjIf8JDXN8JacA1JRxhmHJ7o7jfwpfDwj7R4K73EFlQmv0MyGeCyTy4CVqZGVHCxxPVmraTk99DDV9es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398999; 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=hzMgFr7OoLDNGfjaDG8o1jfdQFd6dVoxbKv5kz0F9Vw=; b=Y9kd2OHM8YiIVwLIzKov7ftc5Mj7Wcgw/RM9jaZifp7BJiyOQXMEqq0vcbouhSihJxSx6W4Ct9edKauG1tS5k/84IVwiELlbwzxycaRqVfJumBQCnhOoSzfqymJxbLydyu9AeqtOrGVbjsmdh+3y71UU+srtG+Mv5sJEY+27Wec= 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 1744398999316105.60279421767768; Fri, 11 Apr 2025 12:16:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jqt-0004YS-LH; Fri, 11 Apr 2025 15:15:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jqf-00049A-8R for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:33 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3JqW-0006BW-HI for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:29 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E11C921199; Fri, 11 Apr 2025 19:14: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 5F1B713886; Fri, 11 Apr 2025 19:14:56 +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 yB56CDBq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:14:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398898; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hzMgFr7OoLDNGfjaDG8o1jfdQFd6dVoxbKv5kz0F9Vw=; b=gZUAaMproYTKVuJKEhwiihDWsk2rhnKFodpajui4sVPeFIFqeJcpOKSOosJJuCrXdUksWy jQPxwq2tuZ/Wt6FOnFnL3Tgxuj/m8v/uzfnJGbiKD9eD/IGd4Q4jdTd+IxvI3ks+toHPQ3 zNCrvJ9bE2SH7fP1REFYa2Q3GeoapS4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398898; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hzMgFr7OoLDNGfjaDG8o1jfdQFd6dVoxbKv5kz0F9Vw=; b=2b7xtPkSo03nWAh5qUnatPkh0uO7YhkLYVPZPnPQYcKdF8DG8NFoA17hh6okFOQv8q9tBv p0OmKc6jFD5kMMCg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=I1S+RQiU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=rmez8VpG DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398897; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hzMgFr7OoLDNGfjaDG8o1jfdQFd6dVoxbKv5kz0F9Vw=; b=I1S+RQiU9xlPtcZoZpXpOnbbNfLgrUsjYNNxOepqN8uDfhWuTZ7HbJFvPvAXygfUzekzpu 8bK+5xC9dWDu0FrovkTpnB6gY5kxs7O268W7bHoss2kNgngJM2sCX6vdCp7Ma12BfztDZP 1U8mKPAFLxo0odI0+gI56ia7/KBExBw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398897; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hzMgFr7OoLDNGfjaDG8o1jfdQFd6dVoxbKv5kz0F9Vw=; b=rmez8VpG5LJmaZinTK9YsJTKMPm2X9sSHDozmkafUHEGPbhZJLej/6O0QYZfyYJNraiImN fakg4Qgra7A5pSBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 05/13] migration: Reduce a bit of duplication in migration.json Date: Fri, 11 Apr 2025 16:14:35 -0300 Message-Id: <20250411191443.22565-6-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: E11C921199 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)[suse.de:email,suse.de:dkim,suse.de:mid]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1744399000424019000 Content-Type: text/plain; charset="utf-8" Introduce a new MigrationConfigBase, to allow most of the duplication in migration.json to be eliminated. The reason we need MigrationParameters and MigrationSetParameters is that the internal parameter representation in the migration code, as well as the user-facing return of query-migrate-parameters use one type for the TLS options (tls-creds, tls-hostname, tls-authz), while the user-facing input from migrate-set-parameters uses another. The difference is in whether the NULL values is accepted. The former considers NULL as invalid, while the latter doesn't. Move all other (non-TLS) options into the new type and make it a base type for the two diverging types so that each child type can declare the TLS options in its own way. Nothing changes in the user API, nothing changes in the internal representation, but we save several lines of duplication in migration.json. Signed-off-by: Fabiano Rosas --- qapi/migration.json | 358 +++++++++++++------------------------------- 1 file changed, 108 insertions(+), 250 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 8b9c53595c..5a4d5a2d3e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -914,202 +914,6 @@ 'zero-page-detection', 'direct-io'] } =20 -## -# @MigrateSetParameters: -# -# @announce-initial: Initial delay (in milliseconds) before sending -# the first announce (Since 4.0) -# -# @announce-max: Maximum delay (in milliseconds) between packets in -# the announcement (Since 4.0) -# -# @announce-rounds: Number of self-announce packets sent after -# migration (Since 4.0) -# -# @announce-step: Increase in delay (in milliseconds) between -# subsequent packets in the announcement (Since 4.0) -# -# @throttle-trigger-threshold: The ratio of bytes_dirty_period and -# bytes_xfer_period to trigger throttling. It is expressed as -# percentage. The default value is 50. (Since 5.0) -# -# @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttled when migration auto-converge is activated. The -# default value is 20. (Since 2.7) -# -# @cpu-throttle-increment: throttle percentage increase each time -# auto-converge detects that migration is not making progress. -# The default value is 10. (Since 2.7) -# -# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At -# the tail stage of throttling, the Guest is very sensitive to CPU -# percentage while the @cpu-throttle -increment is excessive -# usually at tail stage. If this parameter is true, we will -# compute the ideal CPU percentage used by the Guest, which may -# exactly make the dirty rate match the dirty rate threshold. -# Then we will choose a smaller throttle increment between the one -# specified by @cpu-throttle-increment and the one generated by -# ideal CPU percentage. Therefore, it is compatible to -# traditional throttling, meanwhile the throttle increment won't -# be excessive at tail stage. The default value is false. (Since -# 5.1) -# -# @tls-creds: ID of the 'tls-creds' object that provides credentials -# for establishing a TLS connection over the migration data -# channel. On the outgoing side of the migration, the credentials -# must be for a 'client' endpoint, while for the incoming side the -# credentials must be for a 'server' endpoint. Setting this to a -# non-empty string enables TLS for all migrations. An empty -# string means that QEMU will use plain text mode for migration, -# rather than TLS. This is the default. (Since 2.7) -# -# @tls-hostname: migration target's hostname for validating the -# server's x509 certificate identity. If empty, QEMU will use the -# hostname from the migration URI, if any. A non-empty value is -# required when using x509 based TLS credentials and the migration -# URI does not include a hostname, such as fd: or exec: based -# migration. (Since 2.7) -# -# Note: empty value works only since 2.9. -# -# @tls-authz: ID of the 'authz' object subclass that provides access -# control checking of the TLS x509 certificate distinguished name. -# This object is only resolved at time of use, so can be deleted -# and recreated on the fly while the migration server is active. -# If missing, it will default to denying access (Since 4.0) -# -# @max-bandwidth: maximum speed for migration, in bytes per second. -# (Since 2.8) -# -# @avail-switchover-bandwidth: to set the available bandwidth that -# migration can use during switchover phase. NOTE! This does not -# limit the bandwidth during switchover, but only for calculations -# when making decisions to switchover. By default, this value is -# zero, which means QEMU will estimate the bandwidth -# automatically. This can be set when the estimated value is not -# accurate, while the user is able to guarantee such bandwidth is -# available when switching over. When specified correctly, this -# can make the switchover decision much more accurate. -# (Since 8.2) -# -# @downtime-limit: set maximum tolerated downtime for migration. -# maximum downtime in milliseconds (Since 2.8) -# -# @x-checkpoint-delay: The delay time (in ms) between two COLO -# checkpoints in periodic mode. (Since 2.8) -# -# @multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the number of sockets -# used for migration. The default value is 2 (since 4.0) -# -# @xbzrle-cache-size: cache size to be used by XBZRLE migration. It -# needs to be a multiple of the target page size and a power of 2 -# (Since 2.11) -# -# @max-postcopy-bandwidth: Background transfer bandwidth during -# postcopy. Defaults to 0 (unlimited). In bytes per second. -# (Since 3.0) -# -# @max-cpu-throttle: maximum cpu throttle percentage. Defaults to 99. -# (Since 3.1) -# -# @multifd-compression: Which compression method to use. Defaults to -# none. (Since 5.0) -# -# @multifd-zlib-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 9, -# where 0 means no compression, 1 means the best compression -# speed, and 9 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @multifd-qatzip-level: Set the compression level to be used in live -# migration. The level is an integer between 1 and 9, where 1 means -# the best compression speed, and 9 means the best compression -# ratio which will consume more CPU. Defaults to 1. (Since 9.2) -# -# @multifd-zstd-level: Set the compression level to be used in live -# migration, the compression level is an integer between 0 and 20, -# where 0 means no compression, 1 means the best compression -# speed, and 20 means best compression ratio which will consume -# more CPU. Defaults to 1. (Since 5.0) -# -# @block-bitmap-mapping: Maps block nodes and bitmaps on them to -# aliases for the purpose of dirty bitmap migration. Such aliases -# may for example be the corresponding names on the opposite site. -# The mapping must be one-to-one, but not necessarily complete: On -# the source, unmapped bitmaps and all bitmaps on unmapped nodes -# will be ignored. On the destination, encountering an unmapped -# alias in the incoming migration stream will result in a report, -# and all further bitmap migration data will then be discarded. -# Note that the destination does not know about bitmaps it does -# not receive, so there is no limitation or requirement regarding -# the number of bitmaps received, or how they are named, or on -# which nodes they are placed. By default (when this parameter -# has never been set), bitmap names are mapped to themselves. -# Nodes are mapped to their block device name if there is one, and -# to their node name otherwise. (Since 5.2) -# -# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty -# limit during live migration. Should be in the range 1 to -# 1000ms. Defaults to 1000ms. (Since 8.1) -# -# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. -# Defaults to 1. (Since 8.1) -# -# @mode: Migration mode. See description in @MigMode. Default is -# 'normal'. (Since 8.2) -# -# @zero-page-detection: Whether and how to detect zero pages. -# See description in @ZeroPageDetection. Default is 'multifd'. -# (since 9.0) -# -# @direct-io: Open migration files with O_DIRECT when possible. This -# only has effect if the @mapped-ram capability is enabled. -# (Since 9.1) -# -# Features: -# -# @unstable: Members @x-checkpoint-delay and -# @x-vcpu-dirty-limit-period are experimental. -# -# TODO: either fuse back into MigrationParameters, or make -# MigrationParameters members mandatory -# -# Since: 2.4 -## -{ 'struct': 'MigrateSetParameters', - 'data': { '*announce-initial': 'size', - '*announce-max': 'size', - '*announce-rounds': 'size', - '*announce-step': 'size', - '*throttle-trigger-threshold': 'uint8', - '*cpu-throttle-initial': 'uint8', - '*cpu-throttle-increment': 'uint8', - '*cpu-throttle-tailslow': 'bool', - '*tls-creds': 'StrOrNull', - '*tls-hostname': 'StrOrNull', - '*tls-authz': 'StrOrNull', - '*max-bandwidth': 'size', - '*avail-switchover-bandwidth': 'size', - '*downtime-limit': 'uint64', - '*x-checkpoint-delay': { 'type': 'uint32', - 'features': [ 'unstable' ] }, - '*multifd-channels': 'uint8', - '*xbzrle-cache-size': 'size', - '*max-postcopy-bandwidth': 'size', - '*max-cpu-throttle': 'uint8', - '*multifd-compression': 'MultiFDCompression', - '*multifd-zlib-level': 'uint8', - '*multifd-qatzip-level': 'uint8', - '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], - '*x-vcpu-dirty-limit-period': { 'type': 'uint64', - 'features': [ 'unstable' ] }, - '*vcpu-dirty-limit': 'uint64', - '*mode': 'MigMode', - '*zero-page-detection': 'ZeroPageDetection', - '*direct-io': 'bool' } } - ## # @migrate-set-parameters: # @@ -1127,9 +931,7 @@ 'data': 'MigrateSetParameters' } =20 ## -# @MigrationParameters: -# -# The optional members aren't actually optional. +# @MigrationConfigBase: # # @announce-initial: Initial delay (in milliseconds) before sending # the first announce (Since 4.0) @@ -1168,26 +970,6 @@ # 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. 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. -# -# @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) -# -# Note: 2.8 omits empty @tls-hostname instead. -# -# @tls-authz: ID of the 'authz' object subclass that provides access -# control checking of the TLS x509 certificate distinguished name. -# (Since 4.0) -# # @max-bandwidth: maximum speed for migration, in bytes per second. # (Since 2.8) # @@ -1277,45 +1059,121 @@ # only has effect if the @mapped-ram capability is enabled. # (Since 9.1) # +# @tls: Whether to use TLS. If this is set the options @tls-authz, +# @tls-creds, @tls-hostname are mandatory and a valid string is +# expected. (Since 10.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and # @x-vcpu-dirty-limit-period are experimental. # +# Since: 10.1 +## +{ 'struct': 'MigrationConfigBase', + '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', + '*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', + '*tls': 'bool' } } + +## +# @MigrationParameters: +# +# The optional members of the base type aren't actually optional. +# +# @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) +# # Since: 2.4 ## { 'struct': 'MigrationParameters', - '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': 'str', - '*tls-hostname': 'str', - '*tls-authz': 'str', - '*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' } } + 'base': 'MigrationConfigBase', + 'data': { 'tls-creds': 'str', + 'tls-hostname': 'str', + 'tls-authz': 'str' } } + +## +# @MigrateSetParameters: +# +# Compatibility layer to accept null values for the TLS options. +# +# @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) +# +# Since: 2.4 +## +{ 'struct': 'MigrateSetParameters', + 'base': 'MigrationConfigBase', + 'data': { '*tls-creds': 'StrOrNull', + '*tls-hostname': 'StrOrNull', + '*tls-authz': 'StrOrNull' } } =20 ## # @query-migrate-parameters: --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398984; cv=none; d=zohomail.com; s=zohoarc; b=ZlXj6F6HWr41wte0mKMYrTsGcYDo4qj3RgLi4lrCcP6FBGldMt8NYw/KIc0w5FKXeRkjcI3mLWDQ+9MpccKVtjAmNENLQ2LszgzY6+dIUI4DmM3y21gPs0uqRqNwAf7ovTAJMJ4hgqxbYoC/a/KZG0TejWUjzYY4D+eiXQuQs6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398984; 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=OHvVJjcEIzNSFG0PMffj1+aMv+tXjeJ0kBNej+uLdBE=; b=J0dEH6AnDv5VhFrWOgejFMFiHfqoVhs5JWdOGecMnmus7GtTY269nxfFj/t9zZO/4s++paGYyvsdVrswb2O1CI3mOdVrpJjjgzmWRUN8v2ZoPUCa2VPenW9z2EdKRN/L9bWf4qLSnvegZduE5bzRUg249EIitUSarfxNUVDbbnY= 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 1744398984510543.1514155336303; Fri, 11 Apr 2025 12:16:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3JqD-0003x3-8o; Fri, 11 Apr 2025 15:15:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3JqB-0003wZ-Es for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:03 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3Jq9-0005yP-4Q for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:03 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DD9341F453; Fri, 11 Apr 2025 19:14: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 6039B13886; Fri, 11 Apr 2025 19:14: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 MGLiCDJq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:14:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398899; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OHvVJjcEIzNSFG0PMffj1+aMv+tXjeJ0kBNej+uLdBE=; b=FN1MgTCwBOczp+xeBRGgrfY/gRDlYR/poq89Rq5hbcgduHp0C+S06c6xc8XnLHCAtCjddh /JZgUHbLBfdrLIeY9SoyL/0siLv5n2USVvuMPYcXcHjO6hCmcpAvB0Jiwu1yBn3tBQ9CYL IyrbGdqWfB+/fti/zWvWwSuB0wvPEFI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398899; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OHvVJjcEIzNSFG0PMffj1+aMv+tXjeJ0kBNej+uLdBE=; b=RGv0E2aHHGteUzgQegh5dpcioP6Tp1J/6vfQRhclXiAWo4wdFIK0pVORlg9QGl10RdYVqA CTSBUKIeJ8FPv3Bw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398899; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OHvVJjcEIzNSFG0PMffj1+aMv+tXjeJ0kBNej+uLdBE=; b=FN1MgTCwBOczp+xeBRGgrfY/gRDlYR/poq89Rq5hbcgduHp0C+S06c6xc8XnLHCAtCjddh /JZgUHbLBfdrLIeY9SoyL/0siLv5n2USVvuMPYcXcHjO6hCmcpAvB0Jiwu1yBn3tBQ9CYL IyrbGdqWfB+/fti/zWvWwSuB0wvPEFI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398899; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OHvVJjcEIzNSFG0PMffj1+aMv+tXjeJ0kBNej+uLdBE=; b=RGv0E2aHHGteUzgQegh5dpcioP6Tp1J/6vfQRhclXiAWo4wdFIK0pVORlg9QGl10RdYVqA CTSBUKIeJ8FPv3Bw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 06/13] migration: Remove the parameters copy during validation Date: Fri, 11 Apr 2025 16:14:36 -0300 Message-Id: <20250411191443.22565-7-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -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: 1744398985882019100 Content-Type: text/plain; charset="utf-8" While validating migration parameters, a temporary structure is used to apply the values to be validated. Only when validation succeeds on the temporary values, they are actually copied into the internal s->parameters. There is however an extra step, which is to copy s->parameters into the temporary structure prior to merging the new values in. This is not documented. The validation function is intended to only validate new values by checking the QAPI generated has_* boolean fields for each struct member. However, nothing ever sets the has_* fields on the temporary structure, so the reason that copy is there is to take advantage of the has_* fields of s->parameters, which _have_ been set by migrate_params_init() for the same reason of allowing migrate_params_check() to interpret the values as newly added. This is convoluted and has led to the current state of validating _every_ parameter, even the ones who were not set by the user. migrate_params_init() sets _all_ has_* fields because there are global qdev properties defined for every parameter and those need to be validated at migration_object_check(). Detangle the validation done at object creation from the one done after user input, remove the s->parameters copy and move the migrate_params_init() function close to the migrate_params_check(). Add comments. With the removal of the copy at migrate_set_parameters, there's still the need to convert MigrateSetParameters into MigrationParameters to satisfy the signature of migrate_params_check(). This is fine. Keep it, but replace the inline copy of every member (done at migrate_params_test_apply) with a QAPI_CLONE call as long prophecized by the code comments. This last step cannot be in a separate patch because with the removal of the s->parameters copy, something needs to be done to set the has_* fields of the temporary structure so it can be validated. That something is already embedded in the MigrateSetParameters -> MigrationParameters conversion due to the former having the booleans properly set by QAPI. MigrateSetParameters and MigrationParameters are obviously not of the same type, so the QAPI_CLONE call will use the common base MigrationConfigBase. The only remaining fields will be the TLS options which will be set inline. For the validation done at migration_check_object(), introduce a new copy, to make sure we're not operating on the s->parameters and leaving it dirty with the has_* fields set. Signed-off-by: Fabiano Rosas --- migration/migration.c | 22 +++++- migration/options.c | 175 ++++++++++++------------------------------ 2 files changed, 67 insertions(+), 130 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index d46e776e24..2c3bb98df8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4051,8 +4051,6 @@ static void migration_instance_init(Object *obj) qemu_sem_init(&ms->pause_sem, 0); qemu_mutex_init(&ms->error_mutex); =20 - migrate_params_init(&ms->parameters); - qemu_sem_init(&ms->postcopy_pause_sem, 0); qemu_sem_init(&ms->rp_state.rp_sem, 0); qemu_sem_init(&ms->rp_state.rp_pong_acks, 0); @@ -4070,11 +4068,29 @@ static bool migration_object_check(MigrationState *= ms, Error **errp) { /* Assuming all off */ bool old_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; + g_autoptr(MigrationParameters) globals =3D NULL; =20 - if (!migrate_params_check(&ms->parameters, errp)) { + /* + * Copy the values that were already set via qdev properties + * (-global). + */ + globals =3D QAPI_CLONE(MigrationParameters, &ms->parameters); + + /* + * Set the has_* fields because migrate_params_check() only + * validates new fields. + */ + migrate_params_init(globals); + + if (!migrate_params_check(globals, errp)) { return false; } =20 + /* + * After the validation succeeds, there's no need to apply the + * 'globals' because the values are already in s->config. + */ + return migrate_caps_check(old_caps, ms->capabilities, errp); } =20 diff --git a/migration/options.c b/migration/options.c index 625d597a85..87599e4fdd 100644 --- a/migration/options.c +++ b/migration/options.c @@ -958,11 +958,7 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **errp) =20 void migrate_params_init(MigrationParameters *params) { - params->tls_hostname =3D g_strdup(""); - params->tls_creds =3D g_strdup(""); - params->tls_authz =3D g_strdup(""); - - /* Set has_* up only for parameter checks */ + /* these should match the parameters in migration_properties */ params->has_throttle_trigger_threshold =3D true; params->has_cpu_throttle_initial =3D true; params->has_cpu_throttle_increment =3D true; @@ -1178,138 +1174,51 @@ bool migrate_params_check(MigrationParameters *par= ams, Error **errp) return true; } =20 -static void migrate_params_test_apply(MigrateSetParameters *params, - MigrationParameters *dest) +/* + * Compatibility layer to convert MigrateSetParameters to + * MigrationParameters. In the existing QMP user interface, the + * migrate-set-parameters command takes the TLS options as 'StrOrNull' + * while the query-migrate-parameters command returns the TLS strings + * as 'str'. + */ +static void migrate_params_copy_compat(MigrationParameters *dst, + MigrateSetParameters *src) { - *dest =3D migrate_get_current()->parameters; - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - - if (params->has_throttle_trigger_threshold) { - dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; - } - - if (params->has_cpu_throttle_initial) { - dest->cpu_throttle_initial =3D params->cpu_throttle_initial; - } - - if (params->has_cpu_throttle_increment) { - dest->cpu_throttle_increment =3D params->cpu_throttle_increment; - } - - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; - } - - if (params->tls_creds) { - if (params->tls_creds->type =3D=3D QTYPE_QNULL) { - dest->tls_creds =3D NULL; + /* copy the common elements between the two */ + QAPI_CLONE_MEMBERS(MigrationConfigBase, + (MigrationConfigBase *)dst, + (MigrationConfigBase *)src); + + /* now copy the elements of different type */ + if (src->tls_creds) { + if (src->tls_creds->type =3D=3D QTYPE_QNULL) { + dst->tls_creds =3D NULL; } else { - dest->tls_creds =3D params->tls_creds->u.s; + dst->tls_creds =3D src->tls_creds->u.s; } } =20 - if (params->tls_hostname) { - if (params->tls_hostname->type =3D=3D QTYPE_QNULL) { - dest->tls_hostname =3D NULL; + if (src->tls_hostname) { + if (src->tls_hostname->type =3D=3D QTYPE_QNULL) { + dst->tls_hostname =3D NULL; } else { - dest->tls_hostname =3D params->tls_hostname->u.s; + dst->tls_hostname =3D src->tls_hostname->u.s; } } =20 - if (params->tls_authz) { - if (params->tls_authz->type =3D=3D QTYPE_QNULL) { - dest->tls_authz =3D NULL; + if (src->tls_authz) { + if (src->tls_authz->type =3D=3D QTYPE_QNULL) { + dst->tls_authz =3D NULL; } else { - dest->tls_authz =3D params->tls_authz->u.s; + dst->tls_authz =3D src->tls_authz->u.s; } } - - 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->has_block_bitmap_mapping =3D true; - 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; - } } =20 static void migrate_params_apply(MigrateSetParameters *params) { MigrationState *s =3D migrate_get_current(); =20 - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - if (params->has_throttle_trigger_threshold) { s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; } @@ -1328,20 +1237,32 @@ static void migrate_params_apply(MigrateSetParamete= rs *params) =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); + + if (params->tls_creds->type =3D=3D QTYPE_QNULL) { + s->parameters.tls_creds =3D NULL; + } else { + s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.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); + + if (params->tls_hostname->type =3D=3D QTYPE_QNULL) { + s->parameters.tls_hostname =3D NULL; + } else { + s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->= u.s); + } } =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); + + if (params->tls_authz->type =3D=3D QTYPE_QNULL) { + s->parameters.tls_authz =3D NULL; + } else { + s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); + } } =20 if (params->has_max_bandwidth) { @@ -1456,9 +1377,9 @@ static void migrate_post_update_params(MigrateSetPara= meters *new, Error **errp) =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) { - MigrationParameters tmp; + MigrationParameters tmp =3D {}; =20 - migrate_params_test_apply(params, &tmp); + migrate_params_copy_compat(&tmp, params); =20 if (!migrate_params_check(&tmp, errp)) { /* Invalid parameter */ --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744399043; cv=none; d=zohomail.com; s=zohoarc; b=molJHHN8Sf/ZPpjMdS/HfIP7E++Ucs7BZtpKOr03gncrsaiSDcQPIqmgx6VdV/qblnPFX0TSQOdZCd0Wtq5U0sBCao9hEVKkv9z+49x/J8IaEElVc81Em7ftEow8UPzGFf1dGhT5kA/jniXU3VgGqHbAvU1rqxkWyDvKwv338TU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744399043; 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=wiggmXZfcSJMF4WwfJFc8gJ0k23q2nvbNQoDJXR/DnU=; b=a8X872j5cfKCew9y6JKlvEXrEjbjVVO8C7wyXtcx80Ouso3yi78PYjKg8pjgiTVZGSn0v4+Q/WX4fGPwS2fts6DrKsOYBs/MdTh3FNUAxxq/GRStHR7owMbkxywJiDc+yc+E5FK8LtoXsMoi/DYUxYDNX8auxl4OwKXXR9ZicEM= 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 1744399043006663.816558035915; Fri, 11 Apr 2025 12:17:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jrb-0005Yl-Ow; Fri, 11 Apr 2025 15:16:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jqm-0004Yz-IO for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:47 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3Jqj-0006EN-H4 for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:39 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DA49D21196; Fri, 11 Apr 2025 19:15:01 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5CE7A13886; Fri, 11 Apr 2025 19:15: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 CP3yBzRq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:15:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398901; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wiggmXZfcSJMF4WwfJFc8gJ0k23q2nvbNQoDJXR/DnU=; b=lTXtQc1Hi3D3Db+IShbsRwI7/gNEpPE1pTlTZjlYhdXNpy59cv+O9qXCQai/LhmjY9iBZm FiCrDF7GknwD0vJNm9l18Qj+tjuhpyE2mjJid2A6nM709xb4fIFLsknLZdBKqQNBr0JdS/ OkybTvsssEx0fNFo6523QHZcrEem1Sk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398901; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wiggmXZfcSJMF4WwfJFc8gJ0k23q2nvbNQoDJXR/DnU=; b=G7WhoQZLHdpQOTnNyErewFox5GB9I3ZNYXL3EXGjeOXEhAOiXdCOYUiJ5Up/I/vRGb0Uvo u/xcuJ336tw2jDCw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398901; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wiggmXZfcSJMF4WwfJFc8gJ0k23q2nvbNQoDJXR/DnU=; b=lTXtQc1Hi3D3Db+IShbsRwI7/gNEpPE1pTlTZjlYhdXNpy59cv+O9qXCQai/LhmjY9iBZm FiCrDF7GknwD0vJNm9l18Qj+tjuhpyE2mjJid2A6nM709xb4fIFLsknLZdBKqQNBr0JdS/ OkybTvsssEx0fNFo6523QHZcrEem1Sk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398901; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wiggmXZfcSJMF4WwfJFc8gJ0k23q2nvbNQoDJXR/DnU=; b=G7WhoQZLHdpQOTnNyErewFox5GB9I3ZNYXL3EXGjeOXEhAOiXdCOYUiJ5Up/I/vRGb0Uvo u/xcuJ336tw2jDCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 07/13] migration: Introduce new MigrationConfig structure Date: Fri, 11 Apr 2025 16:14:37 -0300 Message-Id: <20250411191443.22565-8-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-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)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; 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: 1744399045912019100 Content-Type: text/plain; charset="utf-8" Add a new migration structure to consolidate the capabilities and parameters. This structure will be used in place of the s->parameters and s->capabilities data structures in the next few patches. The QAPI migration types now look like this: /* options previously known as parameters */ { 'struct': 'MigrationConfigBase', 'data': { } } /* for compat with query-migrate-parameters */ { 'struct': 'MigrationParameters', 'base': 'MigrationConfigBase', 'data': { } } /* for compat with migrate-set-parameters */ { 'struct': 'MigrateSetParameters', 'base': 'MigrationConfigBase', 'data': { } } /* to replace MigrationParameters in the MigrationState */ { 'struct': 'MigrationConfig', 'base': 'MigrationConfigBase' 'data': { } } The above keeps the query/set-parameters commands stable. For the capabilities as well as the options added in the future, we have a choice of where to put them: 1) In MigrationConfigBase, this means that the existing query/set-parameters commands will be updated to deal with capabilities/new options. { 'struct': 'MigrationConfigBase', 'data': { } } { 'struct': 'MigrationConfig', 'base': 'MigrationConfigBase' 'data': { } } 2) In MigrationConfig, this means that the existing commands will be frozen in time. { 'struct': 'MigrationConfigBase', 'data': { } } { 'struct': 'MigrationConfig', 'base': 'MigrationConfigBase' 'data': { } } For now, I've chosen the option 1, all capabilities and new options go into MigrationConfigBase. This gives the option to keep the existing commands for as long as we'd like. Note that the query/set capabilities commands will have to go, we can treat parameters as generic configuration options, but capabilities are just too different. Signed-off-by: Fabiano Rosas --- qapi/migration.json | 163 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 160 insertions(+), 3 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 5a4d5a2d3e..5e39f21adc 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1063,10 +1063,108 @@ # @tls-creds, @tls-hostname are mandatory and a valid string is # expected. (Since 10.1) # +# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length +# Encoding). This feature allows us to minimize migration traffic +# for certain work loads, by sending compressed difference of the +# pages +# +# @rdma-pin-all: Controls whether or not the entire VM memory +# footprint is mlock()'d on demand or all at once. Refer to +# docs/rdma.txt for usage. Disabled by default. (since 2.0) +# +# @zero-blocks: During storage migration encode blocks of zeroes +# efficiently. This essentially saves 1MB of zeroes per block on +# the wire. Enabling requires source and target VM to support +# this feature. To enable it is sufficient to enable the +# capability on the source VM. The feature is disabled by +# default. (since 1.6) +# +# @events: generate events for each migration state change (since 2.4) +# +# @auto-converge: If enabled, QEMU will automatically throttle down +# the guest to speed up convergence of RAM migration. (since 1.6) +# +# @postcopy-ram: Start executing on the migration target before all of +# RAM has been migrated, pulling the remaining pages along as +# needed. The capacity must have the same setting on both source +# and target or migration will not even start. NOTE: If the +# migration fails during postcopy the VM will fail. (since 2.6) +# +# @x-colo: If enabled, migration will never end, and the state of the +# VM on the primary side will be migrated continuously to the VM +# on secondary side, this process is called COarse-Grain LOck +# Stepping (COLO) for Non-stop Service. (since 2.8) +# +# @release-ram: if enabled, qemu will free the migrated ram pages on +# the source during postcopy-ram migration. (since 2.9) +# +# @return-path: If enabled, migration will use the return path even +# for precopy. (since 2.10) +# +# @pause-before-switchover: Pause outgoing migration before +# serialising device state and before disabling block IO (since +# 2.11) +# +# @multifd: Use more than one fd for migration (since 4.0) +# +# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps. +# (since 2.12) +# +# @postcopy-blocktime: Calculate downtime for postcopy live migration +# (since 3.0) +# +# @late-block-activate: If enabled, the destination will not activate +# block devices (and thus take locks) immediately at the end of +# migration. (since 3.0) +# +# @x-ignore-shared: If enabled, QEMU will not migrate shared memory +# that is accessible on the destination machine. (since 4.0) +# +# @validate-uuid: Send the UUID of the source to allow the destination +# to ensure it is the same. (since 4.2) +# +# @background-snapshot: If enabled, the migration stream will be a +# snapshot of the VM exactly at the point when the migration +# procedure starts. The VM RAM is saved with running VM. +# (since 6.0) +# +# @zero-copy-send: Controls behavior on sending memory pages on +# migration. When true, enables a zero-copy mechanism for sending +# memory pages, if host supports it. Requires that QEMU be +# permitted to use locked memory for guest RAM pages. (since 7.1) +# +# @postcopy-preempt: If enabled, the migration process will allow +# postcopy requests to preempt precopy stream, so postcopy +# requests will be handled faster. This is a performance feature +# and should not affect the correctness of postcopy migration. +# (since 7.1) +# +# @switchover-ack: If enabled, migration will not stop the source VM +# and complete the migration until an ACK is received from the +# destination that it's OK to do so. Exactly when this ACK is +# sent depends on the migrated devices that use this feature. For +# example, a device can use it to make sure some of its data is +# sent and loaded in the destination before doing switchover. +# This can reduce downtime if devices that support this capability +# are present. 'return-path' capability must be enabled to use +# it. (since 8.1) +# +# @dirty-limit: If enabled, migration will throttle vCPUs as needed to +# keep their dirty page rate within @vcpu-dirty-limit. This can +# improve responsiveness of large guests during live migration, +# and can result in more stable read performance. Requires KVM +# with accelerator property "dirty-ring-size" set. (Since 8.1) +# +# @mapped-ram: Migrate using fixed offsets in the migration file for +# each RAM page. Requires a migration URI that supports seeking, +# such as a file. (since 9.0) +# # Features: # -# @unstable: Members @x-checkpoint-delay and -# @x-vcpu-dirty-limit-period are experimental. +# @unstable: Members @x-checkpoint-delay, @x-vcpu-dirty-limit-period, +# @x-colo and @x-ignore-shared are experimental. +# @deprecated: Member @zero-blocks is deprecated as being part of +# block migration which was already removed. # # Since: 10.1 ## @@ -1099,7 +1197,29 @@ '*mode': 'MigMode', '*zero-page-detection': 'ZeroPageDetection', '*direct-io': 'bool', - '*tls': 'bool' } } + '*tls': 'bool', + '*xbzrle': 'bool', + '*rdma-pin-all': 'bool', + '*auto-converge': 'bool', + '*zero-blocks': { 'type': 'bool', 'features': [ 'deprecated' ]= }, + '*events': 'bool', + '*postcopy-ram': 'bool', + '*x-colo': { 'type': 'bool', 'features': [ 'unstable' ] }, + '*release-ram': 'bool', + '*return-path': 'bool', + '*pause-before-switchover': 'bool', + '*multifd': 'bool', + '*dirty-bitmaps': 'bool', + '*postcopy-blocktime': 'bool', + '*late-block-activate': 'bool', + '*x-ignore-shared': { 'type': 'bool', 'features': [ 'unstable'= ] }, + '*validate-uuid': 'bool', + '*background-snapshot': 'bool', + '*zero-copy-send': 'bool', + '*postcopy-preempt': 'bool', + '*switchover-ack': 'bool', + '*dirty-limit': 'bool', + '*mapped-ram': 'bool' } } =20 ## # @MigrationParameters: @@ -2395,3 +2515,40 @@ 'data': { 'job-id': 'str', 'tag': 'str', 'devices': ['str'] } } + +## +# @MigrationConfig: +# +# Migration configuration options +# +# @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) +# +# Since: 10.1 +## +{ 'struct': 'MigrationConfig', + 'base': 'MigrationConfigBase', + 'data': { '*tls-creds': 'str', + '*tls-hostname': 'str', + '*tls-authz': 'str' } } --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398963; cv=none; d=zohomail.com; s=zohoarc; b=XWXSzVAx4y3stYSxyKU4FjVQkusLe9gpQM3U7D5NP04Dg2UZ7m3TW0ukcIZ6xFM0QV8hV7n6lb251eQ9scyOSOogL9+GV5/hnSjyovZfXbNfy+WPsHhR4ALUVkBpRcZk5ET/nzMW+JHZZ87edSnEZLkFztCKtU2ip2vW83PLdNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398963; 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=s/6/Hr6Qzthq8gpYRe2kMn2+wfIBy/9/b9okQW3RkDU=; b=LfVIpM6w6d/RB+it7aD0ndZQ1xks+7Lc6cHKAQAA20nPZR9CgSPzQDzTbYn2XK15zIIue3u9Dmg9SVal82KdZkSN5O9cp5RedwcyjvunhwsAiHRc09jXJqm3NTB8ogQTG2SYTH63Hu6nYaE10Ap7yQzfaWFPXELleFv15Fr9N5I= 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 1744398963083692.7589720075479; Fri, 11 Apr 2025 12:16:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jqt-0004cl-MR; Fri, 11 Apr 2025 15:15:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3JqL-0003yH-Tb for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:24 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3JqF-0006AB-E9 for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:10 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1FD2F1F453; Fri, 11 Apr 2025 19:15: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 5BBE213886; Fri, 11 Apr 2025 19:15: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 kKmbBzZq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:15:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398904; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s/6/Hr6Qzthq8gpYRe2kMn2+wfIBy/9/b9okQW3RkDU=; b=ix59tJ3wpxNO6LsOJK5/fcKnTz7YbYAfZ1uBh1MBW4MJ7fiZ7M/UVEbVBMoonwmyctNO6m hsUO5xqSfIBlb80+aOwIp1rqrPcFnLD5z2Kmf9OTBKViLv+ZJOP5linYok1TKMyeKSHlcJ zHwqh8xm+gQXRM5DopLC6ztZlo8o2Rk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398904; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s/6/Hr6Qzthq8gpYRe2kMn2+wfIBy/9/b9okQW3RkDU=; b=vTVOHMEuzyg1QEC69hIQYJMCVHCCsYIBMhlBULyio8hMIwvw7/6F/l1SA26/9cIHP2tnqS 6Hh2nJc/aXKAj/BA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398904; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s/6/Hr6Qzthq8gpYRe2kMn2+wfIBy/9/b9okQW3RkDU=; b=ix59tJ3wpxNO6LsOJK5/fcKnTz7YbYAfZ1uBh1MBW4MJ7fiZ7M/UVEbVBMoonwmyctNO6m hsUO5xqSfIBlb80+aOwIp1rqrPcFnLD5z2Kmf9OTBKViLv+ZJOP5linYok1TKMyeKSHlcJ zHwqh8xm+gQXRM5DopLC6ztZlo8o2Rk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398904; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s/6/Hr6Qzthq8gpYRe2kMn2+wfIBy/9/b9okQW3RkDU=; b=vTVOHMEuzyg1QEC69hIQYJMCVHCCsYIBMhlBULyio8hMIwvw7/6F/l1SA26/9cIHP2tnqS 6Hh2nJc/aXKAj/BA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 08/13] migration: Replace s->parameters with s->config Date: Fri, 11 Apr 2025 16:14:38 -0300 Message-Id: <20250411191443.22565-9-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -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: 1744398964590019000 Content-Type: text/plain; charset="utf-8" The concepts of 'parameters' and 'capabilities' are almost functionally identical and there is a consensus that their usage is confusing, particularly when it comes to determine to which category a new option should belong. The new MigrationConfig type was introduced to eliminate the distinction between parameters and capabilities and contains the union of both groups. Replace internal usages of MigrationParameters with MigrationConfig. For the user-facing migrate-set-parameters and query-migrate-parameters, the old types MigrateSetParameters and MigrationParameters are still used. Note that migrate_params_check (now migrate_config_check) will be used in the future also for capabilities validation and for any future command that uses MigrationConfig. Signed-off-by: Fabiano Rosas --- migration/migration.c | 25 ++- migration/migration.h | 4 +- migration/options.c | 371 ++++++++++++++++++++---------------------- migration/options.h | 8 +- migration/ram.c | 4 +- 5 files changed, 192 insertions(+), 220 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2c3bb98df8..9324d4f44e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -119,7 +119,7 @@ static void migration_downtime_start(MigrationState *s) /* * This is unfortunate: incoming migration actually needs the outgoing * migration state (MigrationState) to be there too, e.g. to query - * capabilities, parameters, using locks, setup errors, etc. + * options, using locks, setup errors, etc. * * NOTE: when calling this, making sure current_migration exists and not * been freed yet! Otherwise trying to access the refcount is already @@ -1664,7 +1664,7 @@ void migration_remove_notifier(NotifierWithReturn *no= tify) int migration_call_notifiers(MigrationState *s, MigrationEventType type, Error **errp) { - MigMode mode =3D s->parameters.mode; + MigMode mode =3D s->config.mode; MigrationEvent e; int ret; =20 @@ -1735,7 +1735,7 @@ bool migration_thread_is_self(void) =20 bool migrate_mode_is_cpr(MigrationState *s) { - MigMode mode =3D s->parameters.mode; + MigMode mode =3D s->config.mode; return mode =3D=3D MIG_MODE_CPR_REBOOT || mode =3D=3D MIG_MODE_CPR_TRANSFER; } @@ -1750,9 +1750,8 @@ int migrate_init(MigrationState *s, Error **errp) } =20 /* - * Reinitialise all migration state, except - * parameters/capabilities that the user set, and - * locks. + * Reinitialise all migration state, except options that the user + * set, and locks. */ s->to_dst_file =3D NULL; s->state =3D MIGRATION_STATUS_NONE; @@ -2212,7 +2211,7 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 - if (s->parameters.mode =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { + if (s->config.mode =3D=3D MIG_MODE_CPR_TRANSFER && !cpr_channel) { error_setg(errp, "missing 'cpr' migration channel"); return; } @@ -2237,7 +2236,7 @@ void qmp_migrate(const char *uri, bool has_channels, * in which case the target will not listen for the incoming migration * connection, so qmp_migrate_finish will fail to connect, and then re= cover. */ - if (s->parameters.mode =3D=3D MIG_MODE_CPR_TRANSFER) { + if (s->config.mode =3D=3D MIG_MODE_CPR_TRANSFER) { migrate_hup_add(s, cpr_state_ioc(), (GSourceFunc)qmp_migrate_finis= h_cb, QAPI_CLONE(MigrationAddress, addr)); =20 @@ -4068,21 +4067,21 @@ static bool migration_object_check(MigrationState *= ms, Error **errp) { /* Assuming all off */ bool old_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; - g_autoptr(MigrationParameters) globals =3D NULL; + g_autoptr(MigrationConfig) globals =3D NULL; =20 /* * Copy the values that were already set via qdev properties * (-global). */ - globals =3D QAPI_CLONE(MigrationParameters, &ms->parameters); + globals =3D QAPI_CLONE(MigrationConfig, &ms->config); =20 /* - * Set the has_* fields because migrate_params_check() only + * Set the has_* fields because migrate_config_check() only * validates new fields. */ - migrate_params_init(globals); + migrate_config_init(globals); =20 - if (!migrate_params_check(globals, errp)) { + if (!migrate_config_check(globals, errp)) { return false; } =20 diff --git a/migration/migration.h b/migration/migration.h index d53f7cad84..8e6aa595b6 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -317,9 +317,7 @@ struct MigrationState { */ uint64_t threshold_size; =20 - /* params from 'migrate-set-parameters' */ - MigrationParameters parameters; - + MigrationConfig config; MigrationStatus state; =20 /* State related to return path */ diff --git a/migration/options.c b/migration/options.c index 87599e4fdd..7c41fbbce6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -41,7 +41,7 @@ * for sending the last part */ #define DEFAULT_MIGRATE_SET_DOWNTIME 300 =20 -/* Define default autoconverge cpu throttle migration parameters */ +/* Define default autoconverge cpu throttle migration options */ #define DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD 50 #define DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL 20 #define DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT 10 @@ -72,7 +72,7 @@ #define DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH 0 =20 /* - * Parameters for self_announce_delay giving a stream of RARP/ARP + * Defaults for self_announce_delay giving a stream of RARP/ARP * packets after migration. */ #define DEFAULT_MIGRATE_ANNOUNCE_INITIAL 50 @@ -104,78 +104,77 @@ const Property migration_properties[] =3D { DEFINE_PROP_BOOL("multifd-clean-tls-termination", MigrationState, multifd_clean_tls_termination, true), =20 - /* Migration parameters */ DEFINE_PROP_UINT8("x-throttle-trigger-threshold", MigrationState, - parameters.throttle_trigger_threshold, + config.throttle_trigger_threshold, DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD), DEFINE_PROP_UINT8("x-cpu-throttle-initial", MigrationState, - parameters.cpu_throttle_initial, + config.cpu_throttle_initial, DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL), DEFINE_PROP_UINT8("x-cpu-throttle-increment", MigrationState, - parameters.cpu_throttle_increment, + config.cpu_throttle_increment, DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT), DEFINE_PROP_BOOL("x-cpu-throttle-tailslow", MigrationState, - parameters.cpu_throttle_tailslow, false), + config.cpu_throttle_tailslow, false), DEFINE_PROP_SIZE("x-max-bandwidth", MigrationState, - parameters.max_bandwidth, MAX_THROTTLE), + config.max_bandwidth, MAX_THROTTLE), DEFINE_PROP_SIZE("avail-switchover-bandwidth", MigrationState, - parameters.avail_switchover_bandwidth, 0), + config.avail_switchover_bandwidth, 0), DEFINE_PROP_UINT64("x-downtime-limit", MigrationState, - parameters.downtime_limit, + config.downtime_limit, DEFAULT_MIGRATE_SET_DOWNTIME), DEFINE_PROP_UINT32("x-checkpoint-delay", MigrationState, - parameters.x_checkpoint_delay, + config.x_checkpoint_delay, DEFAULT_MIGRATE_X_CHECKPOINT_DELAY), DEFINE_PROP_UINT8("multifd-channels", MigrationState, - parameters.multifd_channels, + config.multifd_channels, DEFAULT_MIGRATE_MULTIFD_CHANNELS), DEFINE_PROP_MULTIFD_COMPRESSION("multifd-compression", MigrationState, - parameters.multifd_compression, + config.multifd_compression, DEFAULT_MIGRATE_MULTIFD_COMPRESSION), DEFINE_PROP_UINT8("multifd-zlib-level", MigrationState, - parameters.multifd_zlib_level, + config.multifd_zlib_level, DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL), DEFINE_PROP_UINT8("multifd-qatzip-level", MigrationState, - parameters.multifd_qatzip_level, + config.multifd_qatzip_level, DEFAULT_MIGRATE_MULTIFD_QATZIP_LEVEL), DEFINE_PROP_UINT8("multifd-zstd-level", MigrationState, - parameters.multifd_zstd_level, + config.multifd_zstd_level, DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL), DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, - parameters.xbzrle_cache_size, + config.xbzrle_cache_size, DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), DEFINE_PROP_SIZE("max-postcopy-bandwidth", MigrationState, - parameters.max_postcopy_bandwidth, + config.max_postcopy_bandwidth, DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH), DEFINE_PROP_UINT8("max-cpu-throttle", MigrationState, - parameters.max_cpu_throttle, + config.max_cpu_throttle, DEFAULT_MIGRATE_MAX_CPU_THROTTLE), DEFINE_PROP_SIZE("announce-initial", MigrationState, - parameters.announce_initial, + config.announce_initial, DEFAULT_MIGRATE_ANNOUNCE_INITIAL), DEFINE_PROP_SIZE("announce-max", MigrationState, - parameters.announce_max, + config.announce_max, DEFAULT_MIGRATE_ANNOUNCE_MAX), DEFINE_PROP_SIZE("announce-rounds", MigrationState, - parameters.announce_rounds, + config.announce_rounds, DEFAULT_MIGRATE_ANNOUNCE_ROUNDS), DEFINE_PROP_SIZE("announce-step", MigrationState, - parameters.announce_step, + config.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_STRING("tls-creds", MigrationState, config.tls_creds), + DEFINE_PROP_STRING("tls-hostname", MigrationState, config.tls_hostname= ), + DEFINE_PROP_STRING("tls-authz", MigrationState, config.tls_authz), DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, - parameters.x_vcpu_dirty_limit_period, + config.x_vcpu_dirty_limit_period, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), DEFINE_PROP_UINT64("vcpu-dirty-limit", MigrationState, - parameters.vcpu_dirty_limit, + config.vcpu_dirty_limit, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT), DEFINE_PROP_MIG_MODE("mode", MigrationState, - parameters.mode, + config.mode, MIG_MODE_NORMAL), DEFINE_PROP_ZERO_PAGE_DETECTION("zero-page-detection", MigrationState, - parameters.zero_page_detection, + config.zero_page_detection, ZERO_PAGE_DETECTION_MULTIFD), =20 /* Migration capabilities */ @@ -650,48 +649,46 @@ void qmp_migrate_set_capabilities(MigrationCapability= StatusList *params, } } =20 -/* parameters */ - const BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.block_bitmap_mapping; + return s->config.block_bitmap_mapping; } =20 bool migrate_has_block_bitmap_mapping(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.has_block_bitmap_mapping; + return s->config.has_block_bitmap_mapping; } =20 uint32_t migrate_checkpoint_delay(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.x_checkpoint_delay; + return s->config.x_checkpoint_delay; } =20 uint8_t migrate_cpu_throttle_increment(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.cpu_throttle_increment; + return s->config.cpu_throttle_increment; } =20 uint8_t migrate_cpu_throttle_initial(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.cpu_throttle_initial; + return s->config.cpu_throttle_initial; } =20 bool migrate_cpu_throttle_tailslow(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.cpu_throttle_tailslow; + return s->config.cpu_throttle_tailslow; } =20 bool migrate_direct_io(void) @@ -708,7 +705,7 @@ 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 && + return s->config.direct_io && s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM] && s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; } @@ -717,35 +714,35 @@ uint64_t migrate_downtime_limit(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.downtime_limit; + return s->config.downtime_limit; } =20 uint8_t migrate_max_cpu_throttle(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.max_cpu_throttle; + return s->config.max_cpu_throttle; } =20 uint64_t migrate_max_bandwidth(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.max_bandwidth; + return s->config.max_bandwidth; } =20 uint64_t migrate_avail_switchover_bandwidth(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.avail_switchover_bandwidth; + return s->config.avail_switchover_bandwidth; } =20 uint64_t migrate_max_postcopy_bandwidth(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.max_postcopy_bandwidth; + return s->config.max_postcopy_bandwidth; } =20 MigMode migrate_mode(void) @@ -753,7 +750,7 @@ MigMode migrate_mode(void) MigMode mode =3D cpr_get_incoming_mode(); =20 if (mode =3D=3D MIG_MODE_NONE) { - mode =3D migrate_get_current()->parameters.mode; + mode =3D migrate_get_current()->config.mode; } =20 assert(mode >=3D 0 && mode < MIG_MODE__MAX); @@ -764,52 +761,52 @@ int migrate_multifd_channels(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.multifd_channels; + return s->config.multifd_channels; } =20 MultiFDCompression migrate_multifd_compression(void) { MigrationState *s =3D migrate_get_current(); =20 - assert(s->parameters.multifd_compression < MULTIFD_COMPRESSION__MAX); - return s->parameters.multifd_compression; + assert(s->config.multifd_compression < MULTIFD_COMPRESSION__MAX); + return s->config.multifd_compression; } =20 int migrate_multifd_zlib_level(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.multifd_zlib_level; + return s->config.multifd_zlib_level; } =20 int migrate_multifd_qatzip_level(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.multifd_qatzip_level; + return s->config.multifd_qatzip_level; } =20 int migrate_multifd_zstd_level(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.multifd_zstd_level; + return s->config.multifd_zstd_level; } =20 uint8_t migrate_throttle_trigger_threshold(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.throttle_trigger_threshold; + return s->config.throttle_trigger_threshold; } =20 const char *migrate_tls_authz(void) { MigrationState *s =3D migrate_get_current(); =20 - if (s->parameters.tls_authz && - *s->parameters.tls_authz) { - return s->parameters.tls_authz; + if (s->config.tls_authz && + *s->config.tls_authz) { + return s->config.tls_authz; } =20 return NULL; @@ -819,9 +816,9 @@ const char *migrate_tls_creds(void) { MigrationState *s =3D migrate_get_current(); =20 - if (s->parameters.tls_creds && - *s->parameters.tls_creds) { - return s->parameters.tls_creds; + if (s->config.tls_creds && + *s->config.tls_creds) { + return s->config.tls_creds; } =20 return NULL; @@ -831,9 +828,9 @@ const char *migrate_tls_hostname(void) { MigrationState *s =3D migrate_get_current(); =20 - if (s->parameters.tls_hostname && - *s->parameters.tls_hostname) { - return s->parameters.tls_hostname; + if (s->config.tls_hostname && + *s->config.tls_hostname) { + return s->config.tls_hostname; } =20 return NULL; @@ -848,35 +845,33 @@ uint64_t migrate_vcpu_dirty_limit_period(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.x_vcpu_dirty_limit_period; + return s->config.x_vcpu_dirty_limit_period; } =20 uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.xbzrle_cache_size; + return s->config.xbzrle_cache_size; } =20 ZeroPageDetection migrate_zero_page_detection(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->parameters.zero_page_detection; + return s->config.zero_page_detection; } =20 -/* parameters helpers */ - AnnounceParameters *migrate_announce_params(void) { static AnnounceParameters ap; =20 MigrationState *s =3D migrate_get_current(); =20 - ap.initial =3D s->parameters.announce_initial; - ap.max =3D s->parameters.announce_max; - ap.rounds =3D s->parameters.announce_rounds; - ap.step =3D s->parameters.announce_step; + ap.initial =3D s->config.announce_initial; + ap.max =3D s->config.announce_max; + ap.rounds =3D s->config.announce_rounds; + ap.step =3D s->config.announce_step; =20 return ≈ } @@ -889,74 +884,74 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) /* 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->throttle_trigger_threshold =3D s->config.throttle_trigger_thre= shold; params->has_cpu_throttle_initial =3D true; - params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; + params->cpu_throttle_initial =3D s->config.cpu_throttle_initial; params->has_cpu_throttle_increment =3D true; - params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; + params->cpu_throttle_increment =3D s->config.cpu_throttle_increment; 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 ? - s->parameters.tls_creds : ""); - params->tls_hostname =3D g_strdup(s->parameters.tls_hostname ? - s->parameters.tls_hostname : ""); - params->tls_authz =3D g_strdup(s->parameters.tls_authz ? - s->parameters.tls_authz : ""); + params->cpu_throttle_tailslow =3D s->config.cpu_throttle_tailslow; + params->tls_creds =3D g_strdup(s->config.tls_creds ? + s->config.tls_creds : ""); + params->tls_hostname =3D g_strdup(s->config.tls_hostname ? + s->config.tls_hostname : ""); + params->tls_authz =3D g_strdup(s->config.tls_authz ? + s->config.tls_authz : ""); params->has_max_bandwidth =3D true; - params->max_bandwidth =3D s->parameters.max_bandwidth; + params->max_bandwidth =3D s->config.max_bandwidth; params->has_avail_switchover_bandwidth =3D true; - params->avail_switchover_bandwidth =3D s->parameters.avail_switchover_= bandwidth; + params->avail_switchover_bandwidth =3D s->config.avail_switchover_band= width; params->has_downtime_limit =3D true; - params->downtime_limit =3D s->parameters.downtime_limit; + params->downtime_limit =3D s->config.downtime_limit; params->has_x_checkpoint_delay =3D true; - params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; + params->x_checkpoint_delay =3D s->config.x_checkpoint_delay; params->has_multifd_channels =3D true; - params->multifd_channels =3D s->parameters.multifd_channels; + params->multifd_channels =3D s->config.multifd_channels; params->has_multifd_compression =3D true; - params->multifd_compression =3D s->parameters.multifd_compression; + params->multifd_compression =3D s->config.multifd_compression; params->has_multifd_zlib_level =3D true; - params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; + params->multifd_zlib_level =3D s->config.multifd_zlib_level; params->has_multifd_qatzip_level =3D true; - params->multifd_qatzip_level =3D s->parameters.multifd_qatzip_level; + params->multifd_qatzip_level =3D s->config.multifd_qatzip_level; params->has_multifd_zstd_level =3D true; - params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; + params->multifd_zstd_level =3D s->config.multifd_zstd_level; params->has_xbzrle_cache_size =3D true; - params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; + params->xbzrle_cache_size =3D s->config.xbzrle_cache_size; params->has_max_postcopy_bandwidth =3D true; - params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; + params->max_postcopy_bandwidth =3D s->config.max_postcopy_bandwidth; params->has_max_cpu_throttle =3D true; - params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; + params->max_cpu_throttle =3D s->config.max_cpu_throttle; params->has_announce_initial =3D true; - params->announce_initial =3D s->parameters.announce_initial; + params->announce_initial =3D s->config.announce_initial; params->has_announce_max =3D true; - params->announce_max =3D s->parameters.announce_max; + params->announce_max =3D s->config.announce_max; params->has_announce_rounds =3D true; - params->announce_rounds =3D s->parameters.announce_rounds; + params->announce_rounds =3D s->config.announce_rounds; params->has_announce_step =3D true; - params->announce_step =3D s->parameters.announce_step; + params->announce_step =3D s->config.announce_step; =20 - if (s->parameters.has_block_bitmap_mapping) { + if (s->config.has_block_bitmap_mapping) { params->has_block_bitmap_mapping =3D true; params->block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); + s->config.block_bitmap_mapping); } =20 params->has_x_vcpu_dirty_limit_period =3D true; - params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; + params->x_vcpu_dirty_limit_period =3D s->config.x_vcpu_dirty_limit_per= iod; params->has_vcpu_dirty_limit =3D true; - params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; + params->vcpu_dirty_limit =3D s->config.vcpu_dirty_limit; params->has_mode =3D true; - params->mode =3D s->parameters.mode; + params->mode =3D s->config.mode; params->has_zero_page_detection =3D true; - params->zero_page_detection =3D s->parameters.zero_page_detection; + params->zero_page_detection =3D s->config.zero_page_detection; params->has_direct_io =3D true; - params->direct_io =3D s->parameters.direct_io; + params->direct_io =3D s->config.direct_io; =20 return params; } =20 -void migrate_params_init(MigrationParameters *params) +void migrate_config_init(MigrationConfig *params) { /* these should match the parameters in migration_properties */ params->has_throttle_trigger_threshold =3D true; @@ -988,10 +983,10 @@ void migrate_params_init(MigrationParameters *params) } =20 /* - * Check whether the parameters are valid. Error will be put into errp + * Check whether the options 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_config_check(MigrationConfig *params, Error **errp) { ERRP_GUARD(); =20 @@ -1162,7 +1157,7 @@ bool migrate_params_check(MigrationParameters *params= , Error **errp) if (params->has_vcpu_dirty_limit && (params->vcpu_dirty_limit < 1)) { error_setg(errp, - "Parameter 'vcpu_dirty_limit' must be greater than 1 MB= /s"); + "Option 'vcpu_dirty_limit' must be greater than 1 MB/s"= ); return false; } =20 @@ -1176,12 +1171,12 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) =20 /* * Compatibility layer to convert MigrateSetParameters to - * MigrationParameters. In the existing QMP user interface, the + * MigrationConfig. In the existing QMP user interface, the * migrate-set-parameters command takes the TLS options as 'StrOrNull' * while the query-migrate-parameters command returns the TLS strings * as 'str'. */ -static void migrate_params_copy_compat(MigrationParameters *dst, +static void migrate_params_copy_compat(MigrationConfig *dst, MigrateSetParameters *src) { /* copy the common elements between the two */ @@ -1215,141 +1210,126 @@ static void migrate_params_copy_compat(MigrationP= arameters *dst, } } =20 -static void migrate_params_apply(MigrateSetParameters *params) +static void migrate_config_apply(MigrationConfig *new) { MigrationState *s =3D migrate_get_current(); =20 - if (params->has_throttle_trigger_threshold) { - s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; + if (new->has_throttle_trigger_threshold) { + s->config.throttle_trigger_threshold =3D new->throttle_trigger_thr= eshold; } =20 - if (params->has_cpu_throttle_initial) { - s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; + if (new->has_cpu_throttle_initial) { + s->config.cpu_throttle_initial =3D new->cpu_throttle_initial; } =20 - if (params->has_cpu_throttle_increment) { - s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; + if (new->has_cpu_throttle_increment) { + s->config.cpu_throttle_increment =3D new->cpu_throttle_increment; } =20 - if (params->has_cpu_throttle_tailslow) { - s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; + if (new->has_cpu_throttle_tailslow) { + s->config.cpu_throttle_tailslow =3D new->cpu_throttle_tailslow; } =20 - if (params->tls_creds) { - g_free(s->parameters.tls_creds); - - if (params->tls_creds->type =3D=3D QTYPE_QNULL) { - s->parameters.tls_creds =3D NULL; - } else { - s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); - } + if (new->tls_creds) { + g_free(s->config.tls_creds); + s->config.tls_creds =3D g_strdup(new->tls_creds); } =20 - if (params->tls_hostname) { - g_free(s->parameters.tls_hostname); - - if (params->tls_hostname->type =3D=3D QTYPE_QNULL) { - s->parameters.tls_hostname =3D NULL; - } else { - s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->= u.s); - } + if (new->tls_hostname) { + g_free(s->config.tls_hostname); + s->config.tls_hostname =3D g_strdup(new->tls_hostname); } =20 - if (params->tls_authz) { - g_free(s->parameters.tls_authz); - - if (params->tls_authz->type =3D=3D QTYPE_QNULL) { - s->parameters.tls_authz =3D NULL; - } else { - s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); - } + if (new->tls_authz) { + g_free(s->config.tls_authz); + s->config.tls_authz =3D g_strdup(new->tls_authz); } =20 - if (params->has_max_bandwidth) { - s->parameters.max_bandwidth =3D params->max_bandwidth; + if (new->has_max_bandwidth) { + s->config.max_bandwidth =3D new->max_bandwidth; } =20 - if (params->has_avail_switchover_bandwidth) { - s->parameters.avail_switchover_bandwidth =3D params->avail_switcho= ver_bandwidth; + if (new->has_avail_switchover_bandwidth) { + s->config.avail_switchover_bandwidth =3D new->avail_switchover_ban= dwidth; } =20 - if (params->has_downtime_limit) { - s->parameters.downtime_limit =3D params->downtime_limit; + if (new->has_downtime_limit) { + s->config.downtime_limit =3D new->downtime_limit; } =20 - if (params->has_x_checkpoint_delay) { - s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; + if (new->has_x_checkpoint_delay) { + s->config.x_checkpoint_delay =3D new->x_checkpoint_delay; } =20 - if (params->has_multifd_channels) { - s->parameters.multifd_channels =3D params->multifd_channels; + if (new->has_multifd_channels) { + s->config.multifd_channels =3D new->multifd_channels; } - if (params->has_multifd_compression) { - s->parameters.multifd_compression =3D params->multifd_compression; + if (new->has_multifd_compression) { + s->config.multifd_compression =3D new->multifd_compression; } - if (params->has_multifd_qatzip_level) { - s->parameters.multifd_qatzip_level =3D params->multifd_qatzip_leve= l; + if (new->has_multifd_qatzip_level) { + s->config.multifd_qatzip_level =3D new->multifd_qatzip_level; } - if (params->has_multifd_zlib_level) { - s->parameters.multifd_zlib_level =3D params->multifd_zlib_level; + if (new->has_multifd_zlib_level) { + s->config.multifd_zlib_level =3D new->multifd_zlib_level; } - if (params->has_multifd_zstd_level) { - s->parameters.multifd_zstd_level =3D params->multifd_zstd_level; + if (new->has_multifd_zstd_level) { + s->config.multifd_zstd_level =3D new->multifd_zstd_level; } - if (params->has_xbzrle_cache_size) { - s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; + if (new->has_xbzrle_cache_size) { + s->config.xbzrle_cache_size =3D new->xbzrle_cache_size; } - if (params->has_max_postcopy_bandwidth) { - s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; + if (new->has_max_postcopy_bandwidth) { + s->config.max_postcopy_bandwidth =3D new->max_postcopy_bandwidth; } - if (params->has_max_cpu_throttle) { - s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; + if (new->has_max_cpu_throttle) { + s->config.max_cpu_throttle =3D new->max_cpu_throttle; } - if (params->has_announce_initial) { - s->parameters.announce_initial =3D params->announce_initial; + if (new->has_announce_initial) { + s->config.announce_initial =3D new->announce_initial; } - if (params->has_announce_max) { - s->parameters.announce_max =3D params->announce_max; + if (new->has_announce_max) { + s->config.announce_max =3D new->announce_max; } - if (params->has_announce_rounds) { - s->parameters.announce_rounds =3D params->announce_rounds; + if (new->has_announce_rounds) { + s->config.announce_rounds =3D new->announce_rounds; } - if (params->has_announce_step) { - s->parameters.announce_step =3D params->announce_step; + if (new->has_announce_step) { + s->config.announce_step =3D new->announce_step; } =20 - if (params->has_block_bitmap_mapping) { + if (new->has_block_bitmap_mapping) { qapi_free_BitmapMigrationNodeAliasList( - s->parameters.block_bitmap_mapping); + s->config.block_bitmap_mapping); =20 - s->parameters.has_block_bitmap_mapping =3D true; - s->parameters.block_bitmap_mapping =3D + s->config.has_block_bitmap_mapping =3D true; + s->config.block_bitmap_mapping =3D QAPI_CLONE(BitmapMigrationNodeAliasList, - params->block_bitmap_mapping); + new->block_bitmap_mapping); } =20 - if (params->has_x_vcpu_dirty_limit_period) { - s->parameters.x_vcpu_dirty_limit_period =3D - params->x_vcpu_dirty_limit_period; + if (new->has_x_vcpu_dirty_limit_period) { + s->config.x_vcpu_dirty_limit_period =3D + new->x_vcpu_dirty_limit_period; } - if (params->has_vcpu_dirty_limit) { - s->parameters.vcpu_dirty_limit =3D params->vcpu_dirty_limit; + if (new->has_vcpu_dirty_limit) { + s->config.vcpu_dirty_limit =3D new->vcpu_dirty_limit; } =20 - if (params->has_mode) { - s->parameters.mode =3D params->mode; + if (new->has_mode) { + s->config.mode =3D new->mode; } =20 - if (params->has_zero_page_detection) { - s->parameters.zero_page_detection =3D params->zero_page_detection; + if (new->has_zero_page_detection) { + s->config.zero_page_detection =3D new->zero_page_detection; } =20 - if (params->has_direct_io) { - s->parameters.direct_io =3D params->direct_io; + if (new->has_direct_io) { + s->config.direct_io =3D new->direct_io; } } =20 -static void migrate_post_update_params(MigrateSetParameters *new, Error **= errp) +static void migrate_post_update_config(MigrationConfig *new, Error **errp) { MigrationState *s =3D migrate_get_current(); =20 @@ -1372,20 +1352,19 @@ static void migrate_post_update_params(MigrateSetPa= rameters *new, Error **errp) migration_rate_set(new->max_postcopy_bandwidth); } } - } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) { - MigrationParameters tmp =3D {}; + MigrationConfig tmp =3D {}; =20 migrate_params_copy_compat(&tmp, params); =20 - if (!migrate_params_check(&tmp, errp)) { + if (!migrate_config_check(&tmp, errp)) { /* Invalid parameter */ return; } =20 - migrate_params_apply(params); - migrate_post_update_params(params, errp); + migrate_config_apply(&tmp); + migrate_post_update_config(&tmp, errp); } diff --git a/migration/options.h b/migration/options.h index 762be4e641..20fdba4237 100644 --- a/migration/options.h +++ b/migration/options.h @@ -59,8 +59,6 @@ bool migrate_tls(void); =20 bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); =20 -/* parameters */ - const BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void); bool migrate_has_block_bitmap_mapping(void); =20 @@ -86,8 +84,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); +bool migrate_config_check(MigrationConfig *params, Error **errp); +void migrate_config_init(MigrationConfig *params); #endif diff --git a/migration/ram.c b/migration/ram.c index e0ba8e0d48..b938bd621e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -973,11 +973,11 @@ static void migration_dirty_limit_guest(void) * vcpu-dirty-limit untouched. */ if (dirtylimit_in_service() && - quota_dirtyrate =3D=3D s->parameters.vcpu_dirty_limit) { + quota_dirtyrate =3D=3D s->config.vcpu_dirty_limit) { return; } =20 - quota_dirtyrate =3D s->parameters.vcpu_dirty_limit; + quota_dirtyrate =3D s->config.vcpu_dirty_limit; =20 /* * Set all vCPU a quota dirtyrate, note that the second --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398970; cv=none; d=zohomail.com; s=zohoarc; b=U5qWOOx9Wrz8KAlVCiZ6mRgucVrCB7f+Ky/SFI10tJsCsOUqm8e+zzaTz7BWmvKAChn3AC68rCZfucYjk1A6XRiSI4rtq7rUb07aCW6KP3zL38voZOHKFm6nF4WiY7LehLn4b07p5r23I0sYKtR5ze3zQU4CDTg0fXBhUCV4rUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398970; 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=gmOuJfhu4nmcofr9v+dgZQBiOK8sKnICbiA5cFsu6+Q=; b=U8RlwhSnSBVtLfI/7zFQ6t14hVdGhUpIAWw/bvXvHr1OTS/sseYGM99Vvtf9F/RHREG6X+iRqF9T+6YuOxZE2t8e9ZsUodCw4wCufuoWro38OHhQ9bLZsXShXLRBMowdruKo5bBHsMnAZBXvDbgQQn+UXaj384w6PcGiye+Evxg= 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 1744398970942201.01782659600053; Fri, 11 Apr 2025 12:16:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jqk-0004Sn-DC; Fri, 11 Apr 2025 15:15:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jqb-00047t-Ay for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:33 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3JqV-0006BX-0O for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:27 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 292BB1F456; Fri, 11 Apr 2025 19:15:06 +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 9456613886; Fri, 11 Apr 2025 19:15:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uAqRFThq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:15:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398906; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gmOuJfhu4nmcofr9v+dgZQBiOK8sKnICbiA5cFsu6+Q=; b=IdLJga6jr0Ma8veqBW5nA2n2w0rZEST0h1O4hblv1EM7gnuEzURvp2fuBTYIT2oU7UT3rh Pg08dLggVK24d0KQTqJsQ0dQlAjWehnRehiHJC63gd0kcoKy+FsA0x8j0s/3WtkL9D8WMQ KL67BJBOz6eg04EkX/1UVYTSv8+QlwA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398906; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gmOuJfhu4nmcofr9v+dgZQBiOK8sKnICbiA5cFsu6+Q=; b=fk9fEdb2BbwXFMdjde5L3ReHjM3lm4qbLU7uAwY2C8mP7cvY+5LfxZXWbFO9mZSAifjJwl 4Ca0GPl7djYSemAA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=IdLJga6j; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=fk9fEdb2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398906; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gmOuJfhu4nmcofr9v+dgZQBiOK8sKnICbiA5cFsu6+Q=; b=IdLJga6jr0Ma8veqBW5nA2n2w0rZEST0h1O4hblv1EM7gnuEzURvp2fuBTYIT2oU7UT3rh Pg08dLggVK24d0KQTqJsQ0dQlAjWehnRehiHJC63gd0kcoKy+FsA0x8j0s/3WtkL9D8WMQ KL67BJBOz6eg04EkX/1UVYTSv8+QlwA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398906; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gmOuJfhu4nmcofr9v+dgZQBiOK8sKnICbiA5cFsu6+Q=; b=fk9fEdb2BbwXFMdjde5L3ReHjM3lm4qbLU7uAwY2C8mP7cvY+5LfxZXWbFO9mZSAifjJwl 4Ca0GPl7djYSemAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 09/13] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Date: Fri, 11 Apr 2025 16:14:39 -0300 Message-Id: <20250411191443.22565-10-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 292BB1F456 X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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: 1744398972654019000 Content-Type: text/plain; charset="utf-8" Now that we're removing mentions of 'parameters' from migration code, the "Parameter X expects..." message is a little confusing, although the "parameter" there refers to the QMP command parameter. There's also some instances which don't make sense grammatically. Remove all the usage of QERR_INVALID_PARAMETER_VALUE. 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 9324d4f44e..8ca1383b46 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2281,8 +2281,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 7c41fbbce6..0bdd9e23f6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -993,8 +993,7 @@ bool migrate_config_check(MigrationConfig *params, Erro= r **errp) if (params->has_throttle_trigger_threshold && (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; } @@ -1002,8 +1001,7 @@ bool migrate_config_check(MigrationConfig *params, Er= ror **errp) if (params->has_cpu_throttle_initial && (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; } @@ -1011,15 +1009,13 @@ bool migrate_config_check(MigrationConfig *params, = Error **errp) if (params->has_cpu_throttle_increment && (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->has_max_bandwidth && (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; @@ -1027,8 +1023,7 @@ bool migrate_config_check(MigrationConfig *params, Er= ror **errp) =20 if (params->has_avail_switchover_bandwidth && (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; @@ -1036,25 +1031,21 @@ bool migrate_config_check(MigrationConfig *params, = Error **errp) =20 if (params->has_downtime_limit && (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->has_multifd_channels && (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->has_multifd_zlib_level && (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; } @@ -1062,14 +1053,14 @@ bool migrate_config_check(MigrationConfig *params, = Error **errp) if (params->has_multifd_qatzip_level && ((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->has_multifd_zstd_level && (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; } @@ -1077,8 +1068,7 @@ bool migrate_config_check(MigrationConfig *params, Er= ror **errp) if (params->has_xbzrle_cache_size && (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; } @@ -1086,40 +1076,35 @@ bool migrate_config_check(MigrationConfig *params, = Error **errp) if (params->has_max_cpu_throttle && (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->has_announce_initial && 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->has_announce_max && 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->has_announce_rounds && 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->has_announce_step && (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 (params->has_block_bitmap_mapping && @@ -1148,8 +1133,7 @@ bool migrate_config_check(MigrationConfig *params, Er= ror **errp) if (params->has_x_vcpu_dirty_limit_period && (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 b938bd621e..c7d122c4a0 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -161,8 +161,7 @@ int xbzrle_cache_resize(uint64_t new_size, Error **errp) =20 /* Check for truncation */ if (new_size !=3D (size_t)new_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "exceeding address space"); + error_setg(errp, "xbzrle cache size integer overflow"); return -1; } =20 --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744398983; cv=none; d=zohomail.com; s=zohoarc; b=DcZTWp7pyPsD4h28sMAH6zGB/187rwiwu1HbYtEG5wY1iikML8JWletp0NhfNOF/8OxC36pVoJykmgjputz3pI1ihurHrOIQKV+lHh5dRrgu9i1tcK7/MqCDG625de5foDMPPZsY3AO8uLI13gxDlzPV1as4sOlDEwLi5e5YAlk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744398983; 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=U/m+pXLLfiGaLIZK5bBwSiENXUpk1Dej3SgeSnZkU/8=; b=KQW+vqEHKdFsNp/16OTgjPWFjQEptKDmpKfM5i1PoPBsAGAWTzogKmTuzDmmrvR1y4CMVxU1N+zngJCujBI3YF9rBcH1zNAhiDcObde0ukxK4PPSGcEN0/7ZUhlSEg8TSqr9vDpgy84zWdSgjdc/Qs7G8qt+mUMosUzOjlgWe5Y= 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 1744398983654497.6629444333503; Fri, 11 Apr 2025 12:16:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3JrJ-0005B8-9k; Fri, 11 Apr 2025 15:16:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jqk-0004Wm-8i for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:38 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3Jqf-0006DG-Aq for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:37 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1C7D71F457; Fri, 11 Apr 2025 19:15: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 937CB13886; Fri, 11 Apr 2025 19:15: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 +KlSFTpq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:15:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398908; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U/m+pXLLfiGaLIZK5bBwSiENXUpk1Dej3SgeSnZkU/8=; b=TMreZ2h5fwURomuvQivUjgDYMAfmk2DOg8gSBl/tYnVQBeuFvVbumFsGJdpgGY1ql+7bK1 +HPTZcHWb6FBNzG2DYOSMw3JdBPhb5ri/OIfLcz9m+Zzxu/EfxgYFKPblwGQo0xsNOmCAK BY71zPp3kPF04qCE9WmaeSto9h1VTug= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398908; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U/m+pXLLfiGaLIZK5bBwSiENXUpk1Dej3SgeSnZkU/8=; b=L4CmK2vWbJh2MbvgzaYQs/Z1jTFzMmIxi+QfOxKIHsvqvphr6jW4Ljpr+sZvg7NmYq9bXz zxu5eAerM0En9WBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=TMreZ2h5; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=L4CmK2vW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398908; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U/m+pXLLfiGaLIZK5bBwSiENXUpk1Dej3SgeSnZkU/8=; b=TMreZ2h5fwURomuvQivUjgDYMAfmk2DOg8gSBl/tYnVQBeuFvVbumFsGJdpgGY1ql+7bK1 +HPTZcHWb6FBNzG2DYOSMw3JdBPhb5ri/OIfLcz9m+Zzxu/EfxgYFKPblwGQo0xsNOmCAK BY71zPp3kPF04qCE9WmaeSto9h1VTug= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398908; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U/m+pXLLfiGaLIZK5bBwSiENXUpk1Dej3SgeSnZkU/8=; b=L4CmK2vWbJh2MbvgzaYQs/Z1jTFzMmIxi+QfOxKIHsvqvphr6jW4Ljpr+sZvg7NmYq9bXz zxu5eAerM0En9WBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 10/13] migration: Replace s->capabilities with s->config Date: Fri, 11 Apr 2025 16:14:40 -0300 Message-Id: <20250411191443.22565-11-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 1C7D71F457 X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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: 1744398985999019100 Content-Type: text/plain; charset="utf-8" Continuing with the removal of parameters and capabilities, replace the internal usage of s->capabilities with MigrationConfig. To keep compatibility with the special format of the user-facing migrate-set-capabilities and query-migrate-capabilities, introduce a few compatibility routines to convert between MigrationCapabilityStatusList and MigrationConfig. Signed-off-by: Fabiano Rosas --- migration/migration.c | 4 +- migration/migration.h | 1 - migration/options.c | 361 +++++++++++++++++++++++++----------------- migration/options.h | 16 +- migration/savevm.c | 8 +- 5 files changed, 227 insertions(+), 163 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 8ca1383b46..031e0ade16 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4064,8 +4064,6 @@ 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 }; g_autoptr(MigrationConfig) globals =3D NULL; =20 /* @@ -4089,7 +4087,7 @@ static bool migration_object_check(MigrationState *ms= , Error **errp) * 'globals' because the values are already in s->config. */ =20 - return migrate_caps_check(old_caps, ms->capabilities, errp); + return migrate_caps_check(&ms->config, errp); } =20 static const TypeInfo migration_type =3D { diff --git a/migration/migration.h b/migration/migration.h index 8e6aa595b6..c5a7d356e8 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -356,7 +356,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 0bdd9e23f6..562f58263f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -80,9 +80,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) - #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */ =20 @@ -176,30 +173,40 @@ const Property migration_properties[] =3D { DEFINE_PROP_ZERO_PAGE_DETECTION("zero-page-detection", MigrationState, config.zero_page_detection, ZERO_PAGE_DETECTION_MULTIFD), - - /* Migration capabilities */ - DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), - DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), - DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), - DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), - DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), - DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), - DEFINE_PROP_MIG_CAP("x-postcopy-preempt", - MIGRATION_CAPABILITY_POSTCOPY_PREEMPT), - DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO), - DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM), - DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH), - DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD), - DEFINE_PROP_MIG_CAP("x-background-snapshot", - MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT), + DEFINE_PROP_BOOL("x-xbzrle", + MigrationState, config.xbzrle, false), + DEFINE_PROP_BOOL("x-rdma-pin-all", + MigrationState, config.rdma_pin_all, false), + DEFINE_PROP_BOOL("x-auto-converge", + MigrationState, config.auto_converge, false), + DEFINE_PROP_BOOL("x-zero-blocks", + MigrationState, config.zero_blocks, false), + DEFINE_PROP_BOOL("x-events", + MigrationState, config.events, false), + DEFINE_PROP_BOOL("x-postcopy-ram", + MigrationState, config.postcopy_ram, false), + DEFINE_PROP_BOOL("x-postcopy-preempt", + MigrationState, config.postcopy_preempt, false), + DEFINE_PROP_BOOL("x-colo", + MigrationState, config.x_colo, false), + DEFINE_PROP_BOOL("x-release-ram", + MigrationState, config.release_ram, false), + DEFINE_PROP_BOOL("x-return-path", + MigrationState, config.return_path, false), + DEFINE_PROP_BOOL("x-multifd", + MigrationState, config.multifd, false), + DEFINE_PROP_BOOL("x-background-snapshot", + MigrationState, config.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, config.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, config.switchover_ack, false), + DEFINE_PROP_BOOL("x-dirty-limit", + MigrationState, config.dirty_limit, false), + DEFINE_PROP_BOOL("mapped-ram", + MigrationState, config.mapped_ram, false), }; const size_t migration_properties_count =3D ARRAY_SIZE(migration_propertie= s); =20 @@ -207,7 +214,7 @@ bool migrate_auto_converge(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; + return s->config.auto_converge; } =20 bool migrate_send_switchover_start(void) @@ -221,144 +228,142 @@ bool migrate_background_snapshot(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; + return s->config.background_snapshot; } =20 bool migrate_colo(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; + return s->config.x_colo; } =20 bool migrate_dirty_bitmaps(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; + return s->config.dirty_bitmaps; } =20 bool migrate_dirty_limit(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_DIRTY_LIMIT]; + return s->config.dirty_limit; } =20 bool migrate_events(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; + return s->config.events; } =20 bool migrate_mapped_ram(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM]; + return s->config.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->config.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->config.late_block_activate; } =20 bool migrate_multifd(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; + return s->config.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->config.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->config.postcopy_blocktime; } =20 bool migrate_postcopy_preempt(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; + return s->config.postcopy_preempt; } =20 bool migrate_postcopy_ram(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; + return s->config.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->config.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->config.release_ram; } =20 bool migrate_return_path(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; + return s->config.return_path; } =20 bool migrate_switchover_ack(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_SWITCHOVER_ACK]; + return s->config.switchover_ack; } =20 bool migrate_validate_uuid(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; + return s->config.validate_uuid; } =20 bool migrate_xbzrle(void) { MigrationState *s =3D migrate_get_current(); =20 - return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; + return s->config.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->config.zero_copy_send; } =20 -/* pseudo capabilities */ - bool migrate_multifd_flush_after_each_section(void) { MigrationState *s =3D migrate_get_current(); @@ -403,63 +408,25 @@ WriteTrackingSupport migrate_query_write_tracking(voi= d) return WT_SUPPORT_COMPATIBLE; } =20 -/* Migration capabilities set */ -struct MigrateCapsSet { - int size; /* Capability set size */ - MigrationCapability caps[]; /* Variadic array of capabilities */ -}; -typedef struct MigrateCapsSet MigrateCapsSet; - -/* Define and initialize MigrateCapsSet */ -#define INITIALIZE_MIGRATE_CAPS_SET(_name, ...) \ - MigrateCapsSet _name =3D { \ - .size =3D sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \ - .caps =3D { __VA_ARGS__ } \ - } - -/* Background-snapshot compatibility check list */ -static const -INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot, - MIGRATION_CAPABILITY_POSTCOPY_RAM, - MIGRATION_CAPABILITY_DIRTY_BITMAPS, - MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME, - MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE, - MIGRATION_CAPABILITY_RETURN_PATH, - MIGRATION_CAPABILITY_MULTIFD, - MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER, - MIGRATION_CAPABILITY_AUTO_CONVERGE, - MIGRATION_CAPABILITY_RELEASE_RAM, - MIGRATION_CAPABILITY_RDMA_PIN_ALL, - MIGRATION_CAPABILITY_XBZRLE, - MIGRATION_CAPABILITY_X_COLO, - MIGRATION_CAPABILITY_VALIDATE_UUID, - MIGRATION_CAPABILITY_ZERO_COPY_SEND); - static bool migrate_incoming_started(void) { return !!migration_incoming_get_current()->transport_data; } =20 -/** - * @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(MigrationConfig *new, Error **errp) { - ERRP_GUARD(); + MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); + bool postcopy_already_on =3D s->config.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"= ); @@ -467,32 +434,32 @@ 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_MULTIFD]) { + if (new->multifd) { error_setg(errp, "Postcopy is not yet compatible with multifd"= ); 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. @@ -508,41 +475,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; } @@ -554,22 +525,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_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; @@ -582,21 +553,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; @@ -616,37 +587,143 @@ MigrationCapabilityStatusList *qmp_query_migrate_cap= abilities(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_config_get_cap_compat(&s->config, i); QAPI_LIST_APPEND(tail, caps); } =20 return head; } =20 +static bool *migrate_config_get_cap_addr(MigrationConfig *config, int i) +{ + bool *cap_addr =3D NULL; + + switch (i) { + case MIGRATION_CAPABILITY_XBZRLE: + cap_addr =3D &config->xbzrle; + break; + case MIGRATION_CAPABILITY_RDMA_PIN_ALL: + cap_addr =3D &config->rdma_pin_all; + break; + case MIGRATION_CAPABILITY_AUTO_CONVERGE: + cap_addr =3D &config->auto_converge; + break; + case MIGRATION_CAPABILITY_ZERO_BLOCKS: + cap_addr =3D &config->zero_blocks; + break; + case MIGRATION_CAPABILITY_EVENTS: + cap_addr =3D &config->events; + break; + case MIGRATION_CAPABILITY_POSTCOPY_RAM: + cap_addr =3D &config->postcopy_ram; + break; + case MIGRATION_CAPABILITY_X_COLO: + cap_addr =3D &config->x_colo; + break; + case MIGRATION_CAPABILITY_RELEASE_RAM: + cap_addr =3D &config->release_ram; + break; + case MIGRATION_CAPABILITY_RETURN_PATH: + cap_addr =3D &config->return_path; + break; + case MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER: + cap_addr =3D &config->pause_before_switchover; + break; + case MIGRATION_CAPABILITY_MULTIFD: + cap_addr =3D &config->multifd; + break; + case MIGRATION_CAPABILITY_DIRTY_BITMAPS: + cap_addr =3D &config->dirty_bitmaps; + break; + case MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME: + cap_addr =3D &config->postcopy_blocktime; + break; + case MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE: + cap_addr =3D &config->late_block_activate; + break; + case MIGRATION_CAPABILITY_X_IGNORE_SHARED: + cap_addr =3D &config->x_ignore_shared; + break; + case MIGRATION_CAPABILITY_VALIDATE_UUID: + cap_addr =3D &config->validate_uuid; + break; + case MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT: + cap_addr =3D &config->background_snapshot; + break; + case MIGRATION_CAPABILITY_ZERO_COPY_SEND: + cap_addr =3D &config->zero_copy_send; + break; + case MIGRATION_CAPABILITY_POSTCOPY_PREEMPT: + cap_addr =3D &config->postcopy_preempt; + break; + case MIGRATION_CAPABILITY_SWITCHOVER_ACK: + cap_addr =3D &config->switchover_ack; + break; + case MIGRATION_CAPABILITY_DIRTY_LIMIT: + cap_addr =3D &config->dirty_limit; + break; + case MIGRATION_CAPABILITY_MAPPED_RAM: + cap_addr =3D &config->mapped_ram; + break; + default: + g_assert_not_reached(); + } + + return cap_addr; +} + +/* Compatibility for code that reads capabilities in a loop */ +bool migrate_config_get_cap_compat(MigrationConfig *config, int i) +{ + return *(migrate_config_get_cap_addr(config, i)); +} + +/* Compatibility for code that writes capabilities in a loop */ +static void migrate_config_set_cap_compat(MigrationConfig *config, int i, + bool val) +{ + *(migrate_config_get_cap_addr(config, i)) =3D val; +} + +/* + * Set capabilities for compatibility with the old + * migrate-set-capabilities command. + */ +static void migrate_config_set_caps_compat(MigrationConfig *config, + MigrationCapabilityStatusList *= caps) +{ + MigrationCapabilityStatusList *cap; + + for (cap =3D caps; cap; cap =3D cap->next) { + migrate_config_set_cap_compat(config, cap->value->capability, + cap->value->state); + } +} + void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, Error **errp) { MigrationState *s =3D migrate_get_current(); - MigrationCapabilityStatusList *cap; - bool new_caps[MIGRATION_CAPABILITY__MAX]; + g_autoptr(MigrationConfig) new =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->config in + * case the incoming config has a capability that conflicts with + * another that's already set. + */ + new =3D QAPI_CLONE(MigrationConfig, &s->config); + migrate_config_set_caps_compat(new, params); =20 - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + if (!migrate_caps_check(new, errp)) { return; } =20 - for (cap =3D params; cap; cap =3D cap->next) { - s->capabilities[cap->value->capability] =3D cap->value->state; - } + migrate_config_set_caps_compat(&s->config, params); } =20 const BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void) @@ -705,9 +782,7 @@ bool migrate_direct_io(void) * isolated to the main migration thread while multifd channels * process the aligned data with O_DIRECT enabled. */ - return s->config.direct_io && - s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM] && - s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; + return s->config.direct_io && s->config.mapped_ram && s->config.multif= d; } =20 uint64_t migrate_downtime_limit(void) diff --git a/migration/options.h b/migration/options.h index 20fdba4237..6455bce985 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,21 +41,11 @@ 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_caps_check(bool *old_caps, bool *new_caps, Error **errp); =20 const BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void); bool migrate_has_block_bitmap_mapping(void); @@ -86,4 +74,6 @@ ZeroPageDetection migrate_zero_page_detection(void); =20 bool migrate_config_check(MigrationConfig *params, Error **errp); void migrate_config_init(MigrationConfig *params); +bool migrate_config_get_cap_compat(MigrationConfig *config, int i); +bool migrate_caps_check(MigrationConfig *new, Error **errp); #endif diff --git a/migration/savevm.c b/migration/savevm.c index ce158c3512..c81cbc3ee7 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -290,7 +290,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_config_get_cap_compat(&s->config, i)) { result++; } } @@ -312,7 +313,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_config_get_cap_compat(&s->config, i)) { state->capabilities[j++] =3D i; } } @@ -362,7 +364,7 @@ static bool configuration_validate_capabilities(SaveSta= te *state) continue; } source_state =3D test_bit(i, source_caps_bm); - target_state =3D s->capabilities[i]; + target_state =3D migrate_config_get_cap_compat(&s->config, i); if (source_state !=3D target_state) { error_report("Capability %s is %s, but received capability is = %s", MigrationCapability_str(i), --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744399043; cv=none; d=zohomail.com; s=zohoarc; b=DNnRXeHKfxNjjUfMj8h0ZSfcPN8moI3RBl4lZDLe4P1mC5RDxaSGie5BgIm8q73eUexDRuv6BL214/6H3CxzXrblxDKI/hm/MkNSVGWSYFVNzP+JJrP9NJixt7qGhbG5kA73mi0hLsmdabuLI5YrOipTTWhMWZMQZINlJtXftu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744399043; 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=JU+eRkPqVQ3PT79Hg9r6qcE8IGdXjfU30n9ZL+zRtA0=; b=nnuCZTqstTA7XqDLNLApqT/Li2/j2wiAhWtcfkYk9f/We6Kv63eqpGA72HvtKiOOUEZSScleRqhPXTXhqA6jnH4EsnlDYhmA9vJcIFvqpk0tj8C/qJmzH6hJyOo7cSqyA+1oi6mx64HOUvGjgHiN8KxDjvCwVYZ4HICYD/cTsNw= 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 1744399043009825.8566648039886; Fri, 11 Apr 2025 12:17:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jrg-0005qW-Pc; Fri, 11 Apr 2025 15:16:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jqt-0004dv-Og for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:48 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3Jqq-0006HK-LF for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:47 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1957821197; Fri, 11 Apr 2025 19:15: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 9044B13886; Fri, 11 Apr 2025 19:15:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2C+JFDxq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:15:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398910; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JU+eRkPqVQ3PT79Hg9r6qcE8IGdXjfU30n9ZL+zRtA0=; b=Zava9YdVKyeRvG6OeXAkFeFcHdD2Na+n/BruvhWgQ3uAmOt5WdEimULGCLgoMzJ/Y/MdOd 9Au6L+jDv1bZJJxhAAyzoS+P4WAXodVcM9p1nlz5wPyVBPMT3Fe5UhM8D6tZZIDOIJNpwh h1MGaUYMYBJfRwN5d/FRSglU1IP5wVo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398910; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JU+eRkPqVQ3PT79Hg9r6qcE8IGdXjfU30n9ZL+zRtA0=; b=dAYH6WDMYrI/Y9RhkQCtF8gIq6QVHxzPcLJy+nBkoTEJQHlprpjJbXQyIz3Uop7OvyPeTz /JIozFC+31MJwCBA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398910; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JU+eRkPqVQ3PT79Hg9r6qcE8IGdXjfU30n9ZL+zRtA0=; b=Zava9YdVKyeRvG6OeXAkFeFcHdD2Na+n/BruvhWgQ3uAmOt5WdEimULGCLgoMzJ/Y/MdOd 9Au6L+jDv1bZJJxhAAyzoS+P4WAXodVcM9p1nlz5wPyVBPMT3Fe5UhM8D6tZZIDOIJNpwh h1MGaUYMYBJfRwN5d/FRSglU1IP5wVo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398910; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JU+eRkPqVQ3PT79Hg9r6qcE8IGdXjfU30n9ZL+zRtA0=; b=dAYH6WDMYrI/Y9RhkQCtF8gIq6QVHxzPcLJy+nBkoTEJQHlprpjJbXQyIz3Uop7OvyPeTz /JIozFC+31MJwCBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 11/13] migration: Merge parameters and capability checks Date: Fri, 11 Apr 2025 16:14:41 -0300 Message-Id: <20250411191443.22565-12-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-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)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; 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: 1744399045953019100 Content-Type: text/plain; charset="utf-8" Since parameters and capabilities are now stored in the same structure and both use the same method to validate the input (i.e. copy, set a temporary, validate the temporary and overwrite), it's possible to use the same routine for both. With this all distinction from capabilities and parameters is removed, except for the user-facing pieces that have to maintain compatibility. Note that capabilities need to be validated against conflicting capabilities that are already set and also against capabilities that the user might have set on the same command. Therefore they cannot check the has_* fields, otherwise the amount of combinations would be too large. Signed-off-by: Fabiano Rosas --- migration/migration.c | 6 +- migration/options.c | 528 ++++++++++++++++++++++-------------------- migration/options.h | 1 - 3 files changed, 272 insertions(+), 263 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 031e0ade16..55d839abd0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4078,16 +4078,12 @@ static bool migration_object_check(MigrationState *= ms, Error **errp) */ migrate_config_init(globals); =20 - if (!migrate_config_check(globals, errp)) { - return false; - } - /* * After the validation succeeds, there's no need to apply the * 'globals' because the values are already in s->config. */ =20 - return migrate_caps_check(&ms->config, errp); + return migrate_config_check(globals, errp); } =20 static const TypeInfo migration_type =3D { diff --git a/migration/options.c b/migration/options.c index 562f58263f..4e3792dec3 100644 --- a/migration/options.c +++ b/migration/options.c @@ -413,170 +413,6 @@ static bool migrate_incoming_started(void) return !!migration_incoming_get_current()->transport_data; } =20 -bool migrate_caps_check(MigrationConfig *new, Error **errp) -{ - MigrationState *s =3D migrate_get_current(); - MigrationIncomingState *mis =3D migration_incoming_get_current(); - bool postcopy_already_on =3D s->config.postcopy_ram; - ERRP_GUARD(); - - - if (new->zero_blocks) { - warn_report("zero-blocks capability is deprecated"); - } - -#ifndef CONFIG_REPLICATION - 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"= ); - return false; - } -#endif - - 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 (!postcopy_already_on && - runstate_check(RUN_STATE_INMIGRATE) && - !postcopy_ram_supported_by_host(mis, errp)) { - error_prepend(errp, "Postcopy is not supported: "); - return false; - } - - if (new->x_ignore_shared) { - error_setg(errp, "Postcopy is not compatible with ignore-share= d"); - return false; - } - - if (new->multifd) { - error_setg(errp, "Postcopy is not yet compatible with multifd"= ); - return false; - } - } - - if (new->background_snapshot) { - WriteTrackingSupport wt_support; - - /* - * Check if 'background-snapshot' capability is supported by - * host kernel and compatible with guest memory configuration. - */ - wt_support =3D migrate_query_write_tracking(); - if (wt_support < WT_SUPPORT_AVAILABLE) { - error_setg(errp, "Background-snapshot is not supported by host= kernel"); - return false; - } - if (wt_support < WT_SUPPORT_COMPATIBLE) { - error_setg(errp, "Background-snapshot is not compatible " - "with guest memory configuration"); - 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; - } - } - -#ifdef CONFIG_LINUX - 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->zero_copy_send) { - error_setg(errp, - "Zero copy currently only available on Linux"); - return false; - } -#endif - - if (new->postcopy_preempt) { - if (!new->postcopy_ram) { - error_setg(errp, "Postcopy preempt requires postcopy-ram"); - return false; - } - - if (migrate_incoming_started()) { - error_setg(errp, - "Postcopy preempt must be set before incoming start= s"); - return false; - } - } - - if (new->multifd) { - if (migrate_incoming_started()) { - error_setg(errp, "Multifd must be set before incoming starts"); - return false; - } - } - - if (new->switchover_ack) { - if (!new->return_path) { - error_setg(errp, "Capability 'switchover-ack' requires capabil= ity " - "'return-path'"); - return false; - } - } - if (new->dirty_limit) { - if (new->auto_converge) { - error_setg(errp, "dirty-limit conflicts with auto-converge" - " either of then available currently"); - return false; - } - - if (!kvm_enabled() || !kvm_dirty_ring_enabled()) { - error_setg(errp, "dirty-limit requires KVM with accelerator" - " property 'dirty-ring-size' set"); - return false; - } - } - - if (new->multifd) { - if (new->xbzrle) { - error_setg(errp, "Multifd is not compatible with xbzrle"); - return false; - } - } - - if (new->mapped_ram) { - if (new->xbzrle) { - error_setg(errp, - "Mapped-ram migration is incompatible with xbzrle"); - return false; - } - - if (new->postcopy_ram) { - error_setg(errp, - "Mapped-ram migration is incompatible with postcopy= "); - return false; - } - } - - return true; -} - MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; @@ -594,6 +430,10 @@ MigrationCapabilityStatusList *qmp_query_migrate_capab= ilities(Error **errp) return head; } =20 +/* + * Compatibility for code that accesses capability values by index + * (deprecated) instead of accessing the fields by name. + */ static bool *migrate_config_get_cap_addr(MigrationConfig *config, int i) { bool *cap_addr =3D NULL; @@ -672,31 +512,37 @@ static bool *migrate_config_get_cap_addr(MigrationCon= fig *config, int i) return cap_addr; } =20 -/* Compatibility for code that reads capabilities in a loop */ bool migrate_config_get_cap_compat(MigrationConfig *config, int i) { return *(migrate_config_get_cap_addr(config, i)); } =20 -/* Compatibility for code that writes capabilities in a loop */ -static void migrate_config_set_cap_compat(MigrationConfig *config, int i, - bool val) -{ - *(migrate_config_get_cap_addr(config, i)) =3D val; -} - /* - * Set capabilities for compatibility with the old - * migrate-set-capabilities command. + * For compatibility with the old migrate-set-capabilities + * command. Convert the user-facing MigrationCapabilityStatusList into + * the internal representation MigrationConfig. */ static void migrate_config_set_caps_compat(MigrationConfig *config, - MigrationCapabilityStatusList *= caps) + MigrationCapabilityStatusList *= caps, + bool tmp_config) { MigrationCapabilityStatusList *cap; =20 + /* + * The value that'll be written to the has_* fields. It should be + * 'true' for a temporary config so migrate_config_check() can see + * that the value is new. For the permanent config, it must be + * 'false' because the has_* fields of s->config are never used. + */ + bool has_field_value =3D !tmp_config; + for (cap =3D caps; cap; cap =3D cap->next) { - migrate_config_set_cap_compat(config, cap->value->capability, - cap->value->state); + int i =3D cap->value->capability; + bool val =3D cap->value->state; + bool *cap_addr =3D migrate_config_get_cap_addr(config, i); + + *cap_addr =3D val; + *(cap_addr - sizeof(bool)) =3D has_field_value; } } =20 @@ -717,13 +563,12 @@ void qmp_migrate_set_capabilities(MigrationCapability= StatusList *params, * another that's already set. */ new =3D QAPI_CLONE(MigrationConfig, &s->config); - migrate_config_set_caps_compat(new, params); + migrate_config_set_caps_compat(new, params, true); =20 - if (!migrate_caps_check(new, errp)) { + if (!migrate_config_check(new, errp)) { return; } - - migrate_config_set_caps_compat(&s->config, params); + migrate_config_set_caps_compat(&s->config, params, false); } =20 const BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void) @@ -1026,172 +871,192 @@ MigrationParameters *qmp_query_migrate_parameters(= Error **errp) return params; } =20 -void migrate_config_init(MigrationConfig *params) +void migrate_config_init(MigrationConfig *config) { - /* these should match the parameters in migration_properties */ - 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_avail_switchover_bandwidth =3D true; - params->has_block_bitmap_mapping =3D true; + config->has_throttle_trigger_threshold =3D true; + config->has_cpu_throttle_initial =3D true; + config->has_cpu_throttle_increment =3D true; + config->has_cpu_throttle_tailslow =3D true; + config->has_max_bandwidth =3D true; + config->has_downtime_limit =3D true; + config->has_x_checkpoint_delay =3D true; + config->has_multifd_channels =3D true; + config->has_multifd_compression =3D true; + config->has_multifd_zlib_level =3D true; + config->has_multifd_qatzip_level =3D true; + config->has_multifd_zstd_level =3D true; + config->has_xbzrle_cache_size =3D true; + config->has_max_postcopy_bandwidth =3D true; + config->has_max_cpu_throttle =3D true; + config->has_announce_initial =3D true; + config->has_announce_max =3D true; + config->has_announce_rounds =3D true; + config->has_announce_step =3D true; + config->has_x_vcpu_dirty_limit_period =3D true; + config->has_vcpu_dirty_limit =3D true; + config->has_mode =3D true; + config->has_zero_page_detection =3D true; + config->has_direct_io =3D true; + config->has_avail_switchover_bandwidth =3D true; + config->has_block_bitmap_mapping =3D true; + + config->has_xbzrle =3D true; + config->has_rdma_pin_all =3D true; + config->has_auto_converge =3D true; + config->has_zero_blocks =3D true; + config->has_events =3D true; + config->has_postcopy_ram =3D true; + config->has_postcopy_preempt =3D true; + config->has_x_colo =3D true; + config->has_release_ram =3D true; + config->has_return_path =3D true; + config->has_multifd =3D true; + config->has_background_snapshot =3D true; +#ifdef CONFIG_LINUX + config->has_zero_copy_send =3D true; +#endif + config->has_switchover_ack =3D true; + config->has_dirty_limit =3D true; + config->has_mapped_ram =3D true; } =20 /* * Check whether the options are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. */ -bool migrate_config_check(MigrationConfig *params, Error **errp) +bool migrate_config_check(MigrationConfig *new, Error **errp) { + MigrationIncomingState *mis =3D migration_incoming_get_current(); + bool old_postcopy_ram =3D migrate_get_current()->config.postcopy_ram; ERRP_GUARD(); =20 - if (params->has_throttle_trigger_threshold && - (params->throttle_trigger_threshold < 1 || - params->throttle_trigger_threshold > 100)) { + if (new->has_throttle_trigger_threshold && + (new->throttle_trigger_threshold < 1 || + new->throttle_trigger_threshold > 100)) { error_setg(errp, "Option throttle_trigger_threshold expects " "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 (new->has_cpu_throttle_initial && + (new->cpu_throttle_initial < 1 || + new->cpu_throttle_initial > 99)) { error_setg(errp, "Option cpu_throttle_initial expects " "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 (new->has_cpu_throttle_increment && + (new->cpu_throttle_increment < 1 || + new->cpu_throttle_increment > 99)) { error_setg(errp, "Option cpu_throttle_increment expects " "an integer in the range of 1 to 99"); return false; } =20 - if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { + if (new->has_max_bandwidth && (new->max_bandwidth > SIZE_MAX)) { 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->has_avail_switchover_bandwidth && - (params->avail_switchover_bandwidth > SIZE_MAX)) { + if (new->has_avail_switchover_bandwidth && + (new->avail_switchover_bandwidth > SIZE_MAX)) { 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->has_downtime_limit && - (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { + if (new->has_downtime_limit && + (new->downtime_limit > MAX_MIGRATE_DOWNTIME)) { error_setg(errp, "Option downtime_limit expects " "an integer in the range of 0 to " stringify(MAX_MIGRATE_DOWNTIME)" ms"); return false; } =20 - if (params->has_multifd_channels && (params->multifd_channels < 1)) { + if (new->has_multifd_channels && (new->multifd_channels < 1)) { error_setg(errp, "Option multifd_channels expects " "a value between 1 and 255"); return false; } =20 - if (params->has_multifd_zlib_level && - (params->multifd_zlib_level > 9)) { + if (new->has_multifd_zlib_level && + (new->multifd_zlib_level > 9)) { error_setg(errp, "Option multifd_zlib_level expects " "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 (new->has_multifd_qatzip_level && + ((new->multifd_qatzip_level > 9) || + (new->multifd_qatzip_level < 1))) { error_setg(errp, "Option multifd_qatzip_level expects " "a value between 1 and 9"); return false; } =20 - if (params->has_multifd_zstd_level && - (params->multifd_zstd_level > 20)) { + if (new->has_multifd_zstd_level && + (new->multifd_zstd_level > 20)) { error_setg(errp, "Option multifd_zstd_level expects " "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 (new->has_xbzrle_cache_size && + (new->xbzrle_cache_size < qemu_target_page_size() || + !is_power_of_2(new->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->has_max_cpu_throttle && - (params->max_cpu_throttle < params->cpu_throttle_initial || - params->max_cpu_throttle > 99)) { + if (new->has_max_cpu_throttle && + (new->max_cpu_throttle < new->cpu_throttle_initial || + new->max_cpu_throttle > 99)) { error_setg(errp, "max_Option cpu_throttle expects " "an integer in the range of cpu_throttle_initial to 99"= ); return false; } =20 - if (params->has_announce_initial && - params->announce_initial > 100000) { + if (new->has_announce_initial && + new->announce_initial > 100000) { error_setg(errp, "Option announce_initial expects " "a value between 0 and 100000"); return false; } - if (params->has_announce_max && - params->announce_max > 100000) { + if (new->has_announce_max && + new->announce_max > 100000) { error_setg(errp, "Option announce_max expects " "a value between 0 and 100000"); return false; } - if (params->has_announce_rounds && - params->announce_rounds > 1000) { + if (new->has_announce_rounds && + new->announce_rounds > 1000) { error_setg(errp, "Option announce_rounds expects " "a value between 0 and 1000"); return false; } - if (params->has_announce_step && - (params->announce_step < 1 || - params->announce_step > 10000)) { + if (new->has_announce_step && + (new->announce_step < 1 || + new->announce_step > 10000)) { error_setg(errp, "Option announce_step expects " "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 (new->has_block_bitmap_mapping && + !check_dirty_bitmap_mig_alias_map(new->block_bitmap_mapping, errp)= ) { 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 && *params->tls_creds))) { + ((new->has_multifd_compression && new->multifd_compression) || + (new->tls_creds && *new->tls_creds))) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; @@ -1205,26 +1070,175 @@ bool migrate_config_check(MigrationConfig *params,= 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 (new->has_x_vcpu_dirty_limit_period && + (new->x_vcpu_dirty_limit_period < 1 || + new->x_vcpu_dirty_limit_period > 1000)) { error_setg(errp, "Option x-vcpu-dirty-limit-period expects " "a value between 1 and 1000"); return false; } =20 - if (params->has_vcpu_dirty_limit && - (params->vcpu_dirty_limit < 1)) { + if (new->has_vcpu_dirty_limit && + (new->vcpu_dirty_limit < 1)) { error_setg(errp, "Option '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 (new->has_direct_io && new->direct_io && !qemu_has_direct_io()) { error_setg(errp, "No build-time support for direct-io"); return false; } =20 + if (new->zero_blocks) { + warn_report("zero-blocks capability is deprecated"); + } + +#ifndef CONFIG_REPLICATION + 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"= ); + return false; + } +#endif + + 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_postcopy_ram && runstate_check(RUN_STATE_INMIGRATE) && + !postcopy_ram_supported_by_host(mis, errp)) { + error_prepend(errp, "Postcopy is not supported: "); + return false; + } + + if (new->x_ignore_shared) { + error_setg(errp, "Postcopy is not compatible with ignore-share= d"); + return false; + } + + if (new->multifd) { + error_setg(errp, "Postcopy is not yet compatible with multifd"= ); + return false; + } + } + + if (new->background_snapshot) { + WriteTrackingSupport wt_support; + + /* + * Check if 'background-snapshot' capability is supported by + * host kernel and compatible with guest memory configuration. + */ + wt_support =3D migrate_query_write_tracking(); + if (wt_support < WT_SUPPORT_AVAILABLE) { + error_setg(errp, "Background-snapshot is not supported by host= kernel"); + return false; + } + if (wt_support < WT_SUPPORT_COMPATIBLE) { + error_setg(errp, "Background-snapshot is not compatible " + "with guest memory configuration"); + 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; + } + } + + if (new->zero_copy_send) { +#ifdef CONFIG_LINUX + if (!new->multifd || new->xbzrle || + migrate_multifd_compression() || migrate_tls()) { + error_setg(errp, + "Zero copy only available for non-compressed non-TL= S multifd migration"); + return false; + } +#else + error_setg(errp, + "Zero copy currently only available on Linux"); + return false; +#endif + } + + if (new->postcopy_preempt) { + if (!new->postcopy_ram) { + error_setg(errp, "Postcopy preempt requires postcopy-ram"); + return false; + } + + if (migrate_incoming_started()) { + error_setg(errp, + "Postcopy preempt must be set before incoming start= s"); + return false; + } + } + + if (new->multifd) { + if (migrate_incoming_started()) { + error_setg(errp, "Multifd must be set before incoming starts"); + return false; + } + + if (new->xbzrle) { + error_setg(errp, "Multifd is not compatible with xbzrle"); + return false; + } + } + + if (new->switchover_ack) { + if (!new->return_path) { + error_setg(errp, "Capability 'switchover-ack' requires capabil= ity " + "'return-path'"); + return false; + } + } + if (new->dirty_limit) { + if (new->auto_converge) { + error_setg(errp, "dirty-limit conflicts with auto-converge" + " either of then available currently"); + return false; + } + + if (!kvm_enabled() || !kvm_dirty_ring_enabled()) { + error_setg(errp, "dirty-limit requires KVM with accelerator" + " property 'dirty-ring-size' set"); + return false; + } + } + + if (new->mapped_ram) { + if (new->xbzrle) { + error_setg(errp, + "Mapped-ram migration is incompatible with xbzrle"); + return false; + } + + if (new->postcopy_ram) { + error_setg(errp, + "Mapped-ram migration is incompatible with postcopy= "); + return false; + } + } + return true; } =20 diff --git a/migration/options.h b/migration/options.h index 6455bce985..61ee854bb0 100644 --- a/migration/options.h +++ b/migration/options.h @@ -46,7 +46,6 @@ bool migrate_postcopy(void); bool migrate_rdma(void); bool migrate_tls(void); =20 - const BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void); bool migrate_has_block_bitmap_mapping(void); =20 --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744399020; cv=none; d=zohomail.com; s=zohoarc; b=LoXN2i1zEZ48W5BmtSsPUSXn+VmzQRte6FzSOT8zrS2K6kuyx+5T44PYEK0RrKp6IuKrRJ3iOBpE/kHDl66Pyw+uMp4GD2LFYVa1BYR45jAbk99o69fopqFeLcGI/lO/xvr2+cJv/Y3GpbBokveFtHJPxrJUauPidKz8IYn49iQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744399020; 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=PjML+RX+PjFRckNNQBvkO92ypjVOyICOB4cRRLNzFM8=; b=PvBDczSrVzTRYMEwYVhypdSbJMFY7ddjNF8OOm3IKS0a6M8bZVDD0mLRh608vLfdekJIqAn0smmh1jU9rwfNXydvk/xdtP6tWOASOfaHbFvFwHgS1Zl1pKJfFKPXyvvcEJW0cJFwfIngfyfdicoNcSEpZdl2hVwfqETpztB0rXU= 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 1744399020002496.9514107520937; Fri, 11 Apr 2025 12:17:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jrc-0005bE-6c; Fri, 11 Apr 2025 15:16:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jqz-0004qN-Ed for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:54 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3Jqx-0006Kn-JB for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:53 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1994E2119A; Fri, 11 Apr 2025 19:15:12 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8FB0A13886; Fri, 11 Apr 2025 19:15: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 8N4DFD5q+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:15:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398912; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PjML+RX+PjFRckNNQBvkO92ypjVOyICOB4cRRLNzFM8=; b=Y6wB7KoC25Iz4JkkJ7hNcNv8nY9RTfuKPFD6AE2M9fc1CwkpI/MJqOMemoni/ELBo9ZDZC xxGWY9rkA9be3urMLw1l+QZK1OpFBzawcb6fpb4vdw+GbgpWu0EjQTuP7bKzTF2tG+unAo bEWWRZn3DnDUrxKw3jO/ks+KQ/QF2wc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398912; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PjML+RX+PjFRckNNQBvkO92ypjVOyICOB4cRRLNzFM8=; b=ocQKVrs2UGCGGpYk+/XQ9dDJtWi+xsFvVX3lcaBK7VPTWnH16086uFP6FABCxyfdAPjnry 9FNFO1NLxm57DVDQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398912; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PjML+RX+PjFRckNNQBvkO92ypjVOyICOB4cRRLNzFM8=; b=Y6wB7KoC25Iz4JkkJ7hNcNv8nY9RTfuKPFD6AE2M9fc1CwkpI/MJqOMemoni/ELBo9ZDZC xxGWY9rkA9be3urMLw1l+QZK1OpFBzawcb6fpb4vdw+GbgpWu0EjQTuP7bKzTF2tG+unAo bEWWRZn3DnDUrxKw3jO/ks+KQ/QF2wc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398912; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PjML+RX+PjFRckNNQBvkO92ypjVOyICOB4cRRLNzFM8=; b=ocQKVrs2UGCGGpYk+/XQ9dDJtWi+xsFvVX3lcaBK7VPTWnH16086uFP6FABCxyfdAPjnry 9FNFO1NLxm57DVDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 12/13] [PoC] migration: Add query/set commands for MigrationConfig Date: Fri, 11 Apr 2025 16:14:42 -0300 Message-Id: <20250411191443.22565-13-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1744399021785019100 Content-Type: text/plain; charset="utf-8" Add the QMP commands query-migrate-config and migrate-set-config to read and write the migration configuration options. Signed-off-by: Fabiano Rosas --- migration/options.c | 24 ++++++++++++++++++++++++ migration/options.h | 2 +- qapi/migration.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/migration/options.c b/migration/options.c index 4e3792dec3..c85ee2e506 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1441,3 +1441,27 @@ void qmp_migrate_set_parameters(MigrateSetParameters= *params, Error **errp) migrate_config_apply(&tmp); migrate_post_update_config(&tmp, errp); } + +void qmp_migrate_set_config(MigrationConfig *config, Error **errp) +{ + if (!migrate_config_check(config, errp)) { + /* Invalid parameter */ + return; + } + + migrate_config_apply(config); + migrate_post_update_config(config, errp); +} + +MigrationConfig *qmp_query_migrate_config(Error **errp) +{ + MigrationState *s =3D migrate_get_current(); + MigrationConfig *config =3D g_new0(MigrationConfig, 1); + + QAPI_CLONE_MEMBERS(MigrationConfig, config, &s->config); + + /* set the has_* fields for every option */ + migrate_config_init(config); + + return config; +} diff --git a/migration/options.h b/migration/options.h index 61ee854bb0..0e36dafe80 100644 --- a/migration/options.h +++ b/migration/options.h @@ -72,7 +72,7 @@ uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); =20 bool migrate_config_check(MigrationConfig *params, Error **errp); -void migrate_config_init(MigrationConfig *params); +void migrate_config_init(MigrationConfig *config); bool migrate_config_get_cap_compat(MigrationConfig *config, int i); bool migrate_caps_check(MigrationConfig *new, Error **errp); #endif diff --git a/qapi/migration.json b/qapi/migration.json index 5e39f21adc..bb2487dbc6 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -2552,3 +2552,45 @@ 'data': { '*tls-creds': 'str', '*tls-hostname': 'str', '*tls-authz': 'str' } } + +## +# @query-migrate-config: +# +# Returns information about the current migration configuration +# options +# +# Returns: @MigrationConfig +# +# Since: 10.1 +# +# .. qmp-example:: +# +# -> { "execute": "query-migrate-config" } +# <- { "return": { +# "multifd-channels": 2, +# "cpu-throttle-increment": 10, +# "cpu-throttle-initial": 20, +# "max-bandwidth": 33554432, +# "downtime-limit": 300 +# } +# } +## +{ 'command': 'query-migrate-config', + 'returns': 'MigrationConfig' } + +## +# @migrate-set-config: +# +# Set various migration configuration options. +# +# Since: 10.1 +# +# .. qmp-example:: +# +# -> { "execute": "migrate-set-config" , +# "arguments": { "max-bandwidth": 33554432, +# "downtime-limit": 300 } } +# <- { "return": {} } +## +{ 'command': 'migrate-set-config', 'boxed': true, + 'data': 'MigrationConfig' } --=20 2.35.3 From nobody Sun Nov 16 01:14:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1744399000; cv=none; d=zohomail.com; s=zohoarc; b=ZgUKm8KNnMIXVGYuORURnxVwfoYkZYuHeEc6zfW3IiWVF7118YaIv9V0LfD5XfTusldI+7PGhSG0weoH+/Gg07cguJegy7nrUIgfVjm5v6+4evnd38C6FZip05rZGf4pdhg5vh+pu9cz8yZf+ZvRlZonWmWZ8WaoBhLkiCQ8TeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744399000; 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=wMSYZrglyZ0bVCrbEJjpGUCI3SzYAtQY0LUNx1m5Tfc=; b=mL1XMHVp+ODVRWe7fz6SoybrU1d8TlIDA3eH2yNnyMhNB4XQ6OAxHF9EjCY7SNNzMYmGsoYBlDWNVBPSfAA+31eyP0tLTpdsQjHQVvgx4SD4QqZ1et3biF+2xBzl47ijau/b2NNTLfy99WnWqqzzXgxN7IN94hUjXnMlsIOP8vg= 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 1744399000927355.1709486789074; Fri, 11 Apr 2025 12:16:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3Jrf-0005o6-S1; Fri, 11 Apr 2025 15:16:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Jr5-00050W-Jt for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:16:04 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u3Jr3-0006LF-N8 for qemu-devel@nongnu.org; Fri, 11 Apr 2025 15:15:59 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 15E6B21195; Fri, 11 Apr 2025 19:15:14 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8F2FD13886; Fri, 11 Apr 2025 19:15:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ID7eE0Bq+We5WQAAD6G6ig (envelope-from ); Fri, 11 Apr 2025 19:15:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wMSYZrglyZ0bVCrbEJjpGUCI3SzYAtQY0LUNx1m5Tfc=; b=P58p2MLKytH/D+lg/4KMLQr5vFmc7Q2ufi8oIYKKotcMH6b+M/2UVXs+/pscQfWEaGfPZg tl9D9pX0UFPEvQgjvY8Lyv5MukLDdbZvUBNvlsQ/wIDqZKO+uz6F2ZBxoPdcq4POkd+cfT 9b0KS//2NN/JetAyxD9Or7Epka5eeY8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wMSYZrglyZ0bVCrbEJjpGUCI3SzYAtQY0LUNx1m5Tfc=; b=7JsoBV/7E18D+oPbkw4ZEjR7wUE3AM38g/4Sl3frk3uHK00oj5GF4xP3tL9nWvKEzWFf7w CV3/HiJf7g5Q4tAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=P58p2MLK; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="7JsoBV/7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744398914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wMSYZrglyZ0bVCrbEJjpGUCI3SzYAtQY0LUNx1m5Tfc=; b=P58p2MLKytH/D+lg/4KMLQr5vFmc7Q2ufi8oIYKKotcMH6b+M/2UVXs+/pscQfWEaGfPZg tl9D9pX0UFPEvQgjvY8Lyv5MukLDdbZvUBNvlsQ/wIDqZKO+uz6F2ZBxoPdcq4POkd+cfT 9b0KS//2NN/JetAyxD9Or7Epka5eeY8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744398914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wMSYZrglyZ0bVCrbEJjpGUCI3SzYAtQY0LUNx1m5Tfc=; b=7JsoBV/7E18D+oPbkw4ZEjR7wUE3AM38g/4Sl3frk3uHK00oj5GF4xP3tL9nWvKEzWFf7w CV3/HiJf7g5Q4tAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [RFC PATCH 13/13] [PoC] migration: Allow migrate commands to provide the migration config Date: Fri, 11 Apr 2025 16:14:43 -0300 Message-Id: <20250411191443.22565-14-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250411191443.22565-1-farosas@suse.de> References: <20250411191443.22565-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 15E6B21195 X-Spamd-Result: default: False [-3.01 / 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)[]; 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]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action 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: 1744399002419019000 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. Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 5 +++-- migration/migration.c | 8 ++++---- qapi/migration.json | 10 ++++++++++ system/vl.c | 3 ++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 49c26daed3..44d2265002 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -429,7 +429,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: @@ -715,7 +715,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 55d839abd0..a1f04cef32 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1894,8 +1894,8 @@ 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) + MigrationConfig *config, bool has_exit_on_error, + bool exit_on_error, Error **errp) { Error *local_err =3D NULL; static bool once =3D true; @@ -2159,8 +2159,8 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *cha= nnel, return G_SOURCE_REMOVE; } =20 -void qmp_migrate(const char *uri, bool has_channels, - MigrationChannelList *channels, bool has_detach, bool det= ach, +void qmp_migrate(const char *uri, bool has_channels, MigrationChannelList = *channels, + MigrationConfig *config, bool has_detach, bool detach, bool has_resume, bool resume, Error **errp) { bool resume_requested; diff --git a/qapi/migration.json b/qapi/migration.json index bb2487dbc6..5bd8f0f1b2 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1638,6 +1638,10 @@ # # @resume: resume one paused migration, default "off". (since 3.0) # +# @config: migration configuration options, previously set via +# @migrate-set-parameters and @migrate-set-capabilities. (since +# 10.1) +# # Since: 0.14 # # .. admonition:: Notes @@ -1702,6 +1706,7 @@ { 'command': 'migrate', 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], + '*config': 'MigrationConfig', '*detach': 'bool', '*resume': 'bool' } } =20 ## @@ -1721,6 +1726,10 @@ # error details could be retrieved with query-migrate. # (since 9.1) # +# @config: migration configuration options, previously set via +# @migrate-set-parameters and @migrate-set-capabilities. (since +# 10.1) +# # Since: 2.3 # # .. admonition:: Notes @@ -1774,6 +1783,7 @@ { 'command': 'migrate-incoming', 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], + '*config': 'MigrationConfig', '*exit-on-error': 'bool' } } =20 ## diff --git a/system/vl.c b/system/vl.c index ec93988a03..ea7040ef8d 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2826,7 +2826,8 @@ void qmp_x_exit_preconfig(Error **errp) g_new0(MigrationChannelList, 1); =20 channels->value =3D incoming_channels[MIGRATION_CHANNEL_TYPE_M= AIN]; - qmp_migrate_incoming(NULL, true, channels, true, true, &local_= err); + qmp_migrate_incoming(NULL, true, channels, NULL, true, true, + &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); --=20 2.35.3