From nobody Sat May 18 12:05:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1684915396; cv=none; d=zohomail.com; s=zohoarc; b=kyIDxmWZMgmuiJJpRAjNww8LJ9faoazzhGwH6pv2gkrvZXDnqKbd1SqmHPetpkzTh8+knjfLPEGiFT71jA/KgO45UHydrknu9+xHXrkH5Z83LBQs/1pA+54wOukChyip190++64CiWvlywqvLf09Ix4oms+TeJteWUcRc7u963o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684915396; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=T4zMI22qMmNL0wBDYaFUk6vabFpqPSWvW2WR3At6huM=; b=beaM8BzJxR0TVTCoSS4EBa9xFAOtXz1cWsNdoHzq5X47lYmlB8OWzPa/7Z27a753C9YQKBK/2Ya36mlpUMPi+27yD9G4GAlVizTNoU1WQ8FWdYo3Xr9pxhU7fZ+oCkxM9jm7937+hJU0aQbjMfmeQP/urTTPjZX0OYzPv9uK+zg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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 1684915396343785.6664972894984; Wed, 24 May 2023 01:03:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1jSD-0004Px-7x; Wed, 24 May 2023 04:02: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 1q1jS5-0004N9-6j for qemu-devel@nongnu.org; Wed, 24 May 2023 04:02:35 -0400 Received: from mga09.intel.com ([134.134.136.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q1jS1-0008LI-EU for qemu-devel@nongnu.org; Wed, 24 May 2023 04:02:31 -0400 Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2023 01:02:26 -0700 Received: from tdx-lm.sh.intel.com ([10.239.53.27]) by fmsmga007.fm.intel.com with ESMTP; 24 May 2023 01:01:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684915349; x=1716451349; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4rVGc5Y7cM33mtO9y++6ZhZUj1e2rgnR+apua1L3e9k=; b=eHNXeHoNSdteZEMO1LPXYiClu92cOgTgnC0zvqSnaD2tGYhYdqK9rRqG bXfntFnmoXvAInXMozmipGr1nonAYh3pW+i0C3QcTg3kuTCRMnOn28KyK BRmsih7xFv6eOOXVmtlXS4alvAoaIr8iLzYWVy/MVr4xvqRw8Jw10FtjQ OG1l564FIVdAwVAKsDW+qLG7dPD8egRrFli1J8+SC2zLFGnwYYj8mo2eK dVddtdPhMK6kOOa5GbUdYYzNEz9HKlXHSIC1iBUZESU+QU0vPRFSR/GZ6 1gEzm/GYC7d15PVnVm5pgVoKQxrPlJI7icGPy2GvgxBfzyL0rYSViGYVz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="355849634" X-IronPort-AV: E=Sophos;i="6.00,188,1681196400"; d="scan'208";a="355849634" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="707411084" X-IronPort-AV: E=Sophos;i="6.00,188,1681196400"; d="scan'208";a="707411084" From: Wei Wang To: quintela@redhat.com, peterx@redhat.com, qemu-devel@nongnu.org Cc: Wei Wang Subject: [PATCH v1] migration: fix migrate_params_test_apply to set the dest param correctly Date: Wed, 24 May 2023 16:01:57 +0800 Message-Id: <20230524080157.530968-1-wei.w.wang@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=134.134.136.24; envelope-from=wei.w.wang@intel.com; helo=mga09.intel.com 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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @intel.com) X-ZM-MESSAGEID: 1684915396965100001 Content-Type: text/plain; charset="utf-8" qmp_migrate_set_parameters expects to use tmp for parameters check, so migrate_params_test_apply is expected to copy the related fields from params to tmp. So fix migrate_params_test_apply to use the function parameter, *dest, rather than the global one. The dest->has_xxx (xxx is the feature name) related fields need to be set, as they will be checked by migrate_params_check. Signed-off-by: Wei Wang --- migration/options.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index b62ab30cd5..a560483871 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1089,39 +1089,45 @@ bool migrate_params_check(MigrationParameters *para= ms, Error **errp) static void migrate_params_test_apply(MigrateSetParameters *params, MigrationParameters *dest) { - *dest =3D migrate_get_current()->parameters; - /* TODO use QAPI_CLONE() instead of duplicating it inline */ =20 if (params->has_compress_level) { + dest->has_compress_level =3D true; dest->compress_level =3D params->compress_level; } =20 if (params->has_compress_threads) { + dest->has_compress_threads =3D true; dest->compress_threads =3D params->compress_threads; } =20 if (params->has_compress_wait_thread) { + dest->has_compress_wait_thread =3D true; dest->compress_wait_thread =3D params->compress_wait_thread; } =20 if (params->has_decompress_threads) { + dest->has_decompress_threads =3D true; dest->decompress_threads =3D params->decompress_threads; } =20 if (params->has_throttle_trigger_threshold) { + dest->has_throttle_trigger_threshold =3D true; dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; } =20 if (params->has_cpu_throttle_initial) { + dest->has_cpu_throttle_initial =3D true; dest->cpu_throttle_initial =3D params->cpu_throttle_initial; } =20 if (params->has_cpu_throttle_increment) { + dest->has_cpu_throttle_increment =3D true; dest->cpu_throttle_increment =3D params->cpu_throttle_increment; } =20 if (params->has_cpu_throttle_tailslow) { + dest->has_cpu_throttle_tailslow =3D true; dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; } =20 @@ -1136,45 +1142,58 @@ static void migrate_params_test_apply(MigrateSetPar= ameters *params, } =20 if (params->has_max_bandwidth) { + dest->has_max_bandwidth =3D true; dest->max_bandwidth =3D params->max_bandwidth; } =20 if (params->has_downtime_limit) { + dest->has_downtime_limit =3D true; dest->downtime_limit =3D params->downtime_limit; } =20 if (params->has_x_checkpoint_delay) { + dest->has_x_checkpoint_delay =3D true; dest->x_checkpoint_delay =3D params->x_checkpoint_delay; } =20 if (params->has_block_incremental) { + dest->has_block_incremental =3D true; dest->block_incremental =3D params->block_incremental; } if (params->has_multifd_channels) { + dest->has_multifd_channels =3D true; dest->multifd_channels =3D params->multifd_channels; } if (params->has_multifd_compression) { + dest->has_multifd_compression =3D true; dest->multifd_compression =3D params->multifd_compression; } if (params->has_xbzrle_cache_size) { + dest->has_xbzrle_cache_size =3D true; dest->xbzrle_cache_size =3D params->xbzrle_cache_size; } if (params->has_max_postcopy_bandwidth) { + dest->has_max_postcopy_bandwidth =3D true; dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; } if (params->has_max_cpu_throttle) { + dest->has_max_cpu_throttle =3D true; dest->max_cpu_throttle =3D params->max_cpu_throttle; } if (params->has_announce_initial) { + dest->has_announce_initial =3D true; dest->announce_initial =3D params->announce_initial; } if (params->has_announce_max) { + dest->has_announce_max =3D true; dest->announce_max =3D params->announce_max; } if (params->has_announce_rounds) { + dest->has_announce_rounds =3D true; dest->announce_rounds =3D params->announce_rounds; } if (params->has_announce_step) { + dest->has_announce_step =3D true; dest->announce_step =3D params->announce_step; } =20 @@ -1321,6 +1340,7 @@ void qmp_migrate_set_parameters(MigrateSetParameters = *params, Error **errp) params->tls_hostname->u.s =3D strdup(""); } =20 + memset(&tmp, 0, sizeof(MigrationParameters)); migrate_params_test_apply(params, &tmp); =20 if (!migrate_params_check(&tmp, errp)) { --=20 2.27.0