From nobody Wed May 14 16:48:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152285332234244.85396640637623; Wed, 4 Apr 2018 07:48:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1AD17EBAF; Wed, 4 Apr 2018 14:48:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BFFD7A403; Wed, 4 Apr 2018 14:48:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 596D6181D0BB; Wed, 4 Apr 2018 14:48:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w34Eg7NY020307 for ; Wed, 4 Apr 2018 10:42:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0487A84438; Wed, 4 Apr 2018 14:42:07 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D774A8443D for ; Wed, 4 Apr 2018 14:42:06 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id E2649104518; Wed, 4 Apr 2018 16:42:01 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Apr 2018 16:41:29 +0200 Message-Id: <08a17088696fcd8fa6ca1d45530c7213c71ff5b9.1522852107.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 40/68] qemu: Generalize macro for getting VIR_MIGRATE_* typed params X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 04 Apr 2018 14:48:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" So far it's used only for CPU throttling parameters which are all ints, but we'll soon want to use it for more parameters with different types. Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration_params.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 9d2ac6bee5..2caf4dd1c9 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -112,6 +112,17 @@ qemuMigrationParamsFree(qemuMigrationParamsPtr migPara= ms) } =20 =20 +#define GET(API, PARAM, VAR) \ + do { \ + int rc; \ + if ((rc =3D API(params, nparams, VIR_MIGRATE_PARAM_ ## PARAM, \ + &migParams->params.VAR)) < 0) \ + goto error; \ + \ + if (rc =3D=3D 1) \ + migParams->params.VAR ## _set =3D true; \ + } while (0) + qemuMigrationParamsPtr qemuMigrationParamsFromFlags(virTypedParameterPtr params, int nparams, @@ -132,27 +143,13 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr par= ams, } } =20 -#define GET(PARAM, VAR) \ - do { \ - int rc; \ - if ((rc =3D virTypedParamsGetInt(params, nparams, \ - VIR_MIGRATE_PARAM_ ## PARAM, \ - &migParams->params.VAR)) < 0) \ - goto error; \ - \ - if (rc =3D=3D 1) \ - migParams->params.VAR ## _set =3D true; \ - } while (0) - if (params) { if (party =3D=3D QEMU_MIGRATION_SOURCE) { - GET(AUTO_CONVERGE_INITIAL, cpuThrottleInitial); - GET(AUTO_CONVERGE_INCREMENT, cpuThrottleIncrement); + GET(virTypedParamsGetInt, AUTO_CONVERGE_INITIAL, cpuThrottleIn= itial); + GET(virTypedParamsGetInt, AUTO_CONVERGE_INCREMENT, cpuThrottle= Increment); } } =20 -#undef GET - if ((migParams->params.cpuThrottleInitial_set || migParams->params.cpuThrottleIncrement_set) && !(flags & VIR_MIGRATE_AUTO_CONVERGE)) { @@ -168,6 +165,8 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr param= s, return NULL; } =20 +#undef GET + =20 /** * qemuMigrationParamsApply --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list