From nobody Wed May 8 00:02:27 2024 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 1509055463829417.7595411924817; Thu, 26 Oct 2017 15:04:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3387382114; Thu, 26 Oct 2017 22:04:21 +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 103136BF7B; Thu, 26 Oct 2017 22:04:21 +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 C970E1805965; Thu, 26 Oct 2017 22:04:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM47mW031929 for ; Thu, 26 Oct 2017 18:04:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3699258858; Thu, 26 Oct 2017 22:04:07 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F2B9A5C88A for ; Thu, 26 Oct 2017 22:04:04 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 7A8491000C1; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3387382114 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:50 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/12] qemu: Generalize PARSE macro in qemuMonitorJSONGetMigrationParams 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 26 Oct 2017 22:04:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The macro (now called PARSE_SET) is now usable for any type which needs a *_set bool for indicating a valid value. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor_json.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 05cc634d2..16554d5b2 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2679,20 +2679,23 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mo= n, =20 result =3D virJSONValueObjectGet(reply, "return"); =20 -#define PARSE(VAR, FIELD) = \ +#define PARSE_SET(API, VAR, FIELD) = \ do { = \ - if (virJSONValueObjectGetNumberInt(result, FIELD, = \ - ¶ms->VAR) =3D=3D 0) = \ + if (API(result, FIELD, ¶ms->VAR) =3D=3D 0) = \ params->VAR ## _set =3D true; = \ } while (0) =20 - PARSE(compressLevel, "compress-level"); - PARSE(compressThreads, "compress-threads"); - PARSE(decompressThreads, "decompress-threads"); - PARSE(cpuThrottleInitial, "cpu-throttle-initial"); - PARSE(cpuThrottleIncrement, "cpu-throttle-increment"); +#define PARSE_INT(VAR, FIELD) = \ + PARSE_SET(virJSONValueObjectGetNumberInt, VAR, FIELD) =20 -#undef PARSE + PARSE_INT(compressLevel, "compress-level"); + PARSE_INT(compressThreads, "compress-threads"); + PARSE_INT(decompressThreads, "decompress-threads"); + PARSE_INT(cpuThrottleInitial, "cpu-throttle-initial"); + PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment"); + +#undef PARSE_SET +#undef PARSE_INT =20 if (virJSONValueObjectGetNumberUlong(result, "downtime-limit", ¶ms->downtimeLimit) =3D=3D 0) --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055451488999.7059898990733; Thu, 26 Oct 2017 15:04:11 -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 B64DDC0587E7; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48554173B1; Thu, 26 Oct 2017 22:04:09 +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 D8CD46EF21; Thu, 26 Oct 2017 22:04:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM46oU031910 for ; Thu, 26 Oct 2017 18:04:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id B016B173B2; Thu, 26 Oct 2017 22:04:06 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A25C173B1 for ; Thu, 26 Oct 2017 22:04:04 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 7D05A10148C; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B64DDC0587E7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:51 +0200 Message-Id: <4f0cac939c2f965593ee74e94fb4dc3d290f72fc.1509052291.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.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] qemu: Use macro for parsing string migration parameters 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.32]); Thu, 26 Oct 2017 22:04:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor_json.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 16554d5b2..cb0bb0d0d 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2659,7 +2659,6 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, virJSONValuePtr result; virJSONValuePtr cmd =3D NULL; virJSONValuePtr reply =3D NULL; - const char *tlsStr =3D NULL; =20 memset(params, 0, sizeof(*params)); =20 @@ -2688,29 +2687,31 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mo= n, #define PARSE_INT(VAR, FIELD) = \ PARSE_SET(virJSONValueObjectGetNumberInt, VAR, FIELD) =20 +#define PARSE_STR(VAR, FIELD) = \ + do { = \ + const char *str; = \ + if ((str =3D virJSONValueObjectGetString(result, FIELD))) { = \ + if (VIR_STRDUP(params->VAR, str) < 0) = \ + goto cleanup; = \ + } = \ + } while (0) + PARSE_INT(compressLevel, "compress-level"); PARSE_INT(compressThreads, "compress-threads"); PARSE_INT(decompressThreads, "decompress-threads"); PARSE_INT(cpuThrottleInitial, "cpu-throttle-initial"); PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment"); + PARSE_STR(migrateTLSAlias, "tls-creds"); + PARSE_STR(migrateTLSHostname, "tls-hostname"); =20 #undef PARSE_SET #undef PARSE_INT +#undef PARSE_STR =20 if (virJSONValueObjectGetNumberUlong(result, "downtime-limit", ¶ms->downtimeLimit) =3D=3D 0) params->downtimeLimit_set =3D true; =20 - if ((tlsStr =3D virJSONValueObjectGetString(result, "tls-creds"))) { - if (VIR_STRDUP(params->migrateTLSAlias, tlsStr) < 0) - goto cleanup; - } - - if ((tlsStr =3D virJSONValueObjectGetString(result, "tls-hostname"))) { - if (VIR_STRDUP(params->migrateTLSHostname, tlsStr) < 0) - goto cleanup; - } - ret =3D 0; cleanup: virJSONValueFree(cmd); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055451529239.62735189562113; Thu, 26 Oct 2017 15:04:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C80785541; Thu, 26 Oct 2017 22:04:09 +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 4943A5B825; Thu, 26 Oct 2017 22:04:09 +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 9B1221804486; Thu, 26 Oct 2017 22:04:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM469O031911 for ; Thu, 26 Oct 2017 18:04:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id B0B8C5D727; Thu, 26 Oct 2017 22:04:06 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AE0E5D728 for ; Thu, 26 Oct 2017 22:04:04 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 80D0510148D; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C80785541 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:52 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/12] qemu: Use macro for parsing ull migration parameters 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 26 Oct 2017 22:04:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor_json.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index cb0bb0d0d..76fc84ed0 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2687,6 +2687,9 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, #define PARSE_INT(VAR, FIELD) = \ PARSE_SET(virJSONValueObjectGetNumberInt, VAR, FIELD) =20 +#define PARSE_ULONG(VAR, FIELD) = \ + PARSE_SET(virJSONValueObjectGetNumberUlong, VAR, FIELD) + #define PARSE_STR(VAR, FIELD) = \ do { = \ const char *str; = \ @@ -2703,15 +2706,13 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mo= n, PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment"); PARSE_STR(migrateTLSAlias, "tls-creds"); PARSE_STR(migrateTLSHostname, "tls-hostname"); + PARSE_ULONG(downtimeLimit, "downtime-limit"); =20 #undef PARSE_SET #undef PARSE_INT +#undef PARSE_ULONG #undef PARSE_STR =20 - if (virJSONValueObjectGetNumberUlong(result, "downtime-limit", - ¶ms->downtimeLimit) =3D=3D 0) - params->downtimeLimit_set =3D true; - ret =3D 0; cleanup: virJSONValueFree(cmd); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055451781206.67086224452987; Thu, 26 Oct 2017 15:04:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F22280461; Thu, 26 Oct 2017 22:04:09 +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 48F335D729; Thu, 26 Oct 2017 22:04:09 +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 05BE31805960; Thu, 26 Oct 2017 22:04:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM46vs031908 for ; Thu, 26 Oct 2017 18:04:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF071173B5; Thu, 26 Oct 2017 22:04:06 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A8C6173B2 for ; Thu, 26 Oct 2017 22:04:04 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 83E6C10148E; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8F22280461 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:53 +0200 Message-Id: <8806b71562732f37b7a3cb9b93b5a727919345e1.1509052291.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.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/12] qemu: Generalize APPEND macro in qemuMonitorJSONSetMigrationParams 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 26 Oct 2017 22:04:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The APPEND macro is now be usable for any type. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor_json.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 76fc84ed0..218bbd8bd 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2739,21 +2739,24 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mo= n, if (!(args =3D virJSONValueNewObject())) goto cleanup; =20 -#define APPEND(VAR, FIELD) = \ +#define APPEND(VALID, API, VAR, FIELD) = \ do { = \ - if (params->VAR ## _set && = \ - virJSONValueObjectAppendNumberInt(args, FIELD, = \ - params->VAR) < 0) = \ + if (VALID && API(args, FIELD, params->VAR) < 0) = \ goto cleanup; = \ } while (0) =20 - APPEND(compressLevel, "compress-level"); - APPEND(compressThreads, "compress-threads"); - APPEND(decompressThreads, "decompress-threads"); - APPEND(cpuThrottleInitial, "cpu-throttle-initial"); - APPEND(cpuThrottleIncrement, "cpu-throttle-increment"); +#define APPEND_INT(VAR, FIELD) = \ + APPEND(params->VAR ## _set, = \ + virJSONValueObjectAppendNumberInt, VAR, FIELD) + + APPEND_INT(compressLevel, "compress-level"); + APPEND_INT(compressThreads, "compress-threads"); + APPEND_INT(decompressThreads, "decompress-threads"); + APPEND_INT(cpuThrottleInitial, "cpu-throttle-initial"); + APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment"); =20 #undef APPEND +#undef APPEND_INT =20 if (params->migrateTLSAlias && virJSONValueObjectAppendString(args, "tls-creds", --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055460009557.7422943554554; Thu, 26 Oct 2017 15:04:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E2D96346; Thu, 26 Oct 2017 22:04:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 498AF6BF95; Thu, 26 Oct 2017 22:04:18 +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 141866EF24; Thu, 26 Oct 2017 22:04:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM49K4031947 for ; Thu, 26 Oct 2017 18:04:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 616A45D72B; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 108E05D727 for ; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 8742610148F; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6E2D96346 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:54 +0200 Message-Id: <0baf6cd3c448ea5a4d40a7a002f60b6494a455ab.1509052291.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.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/12] qemu: Use macro for setting string migration parameters 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 26 Oct 2017 22:04:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor_json.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 218bbd8bd..826133543 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2749,24 +2749,21 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mo= n, APPEND(params->VAR ## _set, = \ virJSONValueObjectAppendNumberInt, VAR, FIELD) =20 +#define APPEND_STR(VAR, FIELD) = \ + APPEND(params->VAR, = \ + virJSONValueObjectAppendString, VAR, FIELD) + APPEND_INT(compressLevel, "compress-level"); APPEND_INT(compressThreads, "compress-threads"); APPEND_INT(decompressThreads, "decompress-threads"); APPEND_INT(cpuThrottleInitial, "cpu-throttle-initial"); APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment"); + APPEND_STR(migrateTLSAlias, "tls-creds"); + APPEND_STR(migrateTLSHostname, "tls-hostname"); =20 #undef APPEND #undef APPEND_INT - - if (params->migrateTLSAlias && - virJSONValueObjectAppendString(args, "tls-creds", - params->migrateTLSAlias) < 0) - goto cleanup; - - if (params->migrateTLSHostname && - virJSONValueObjectAppendString(args, "tls-hostname", - params->migrateTLSHostname) < 0) - goto cleanup; +#undef APPEND_STR =20 if (virJSONValueObjectAppend(cmd, "arguments", args) < 0) goto cleanup; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055468953113.750764244901; Thu, 26 Oct 2017 15:04:28 -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 6FC525F73C; Thu, 26 Oct 2017 22:04:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C20B176C1; Thu, 26 Oct 2017 22:04:27 +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 1B5126EF30; Thu, 26 Oct 2017 22:04:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM4FBi032007 for ; Thu, 26 Oct 2017 18:04:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 31DC65CC1F; Thu, 26 Oct 2017 22:04:15 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8BA565CC0B for ; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 8A0AF101490; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6FC525F73C Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:55 +0200 Message-Id: <54576bb4d5419ddc84215adf04193b92615e1978.1509052291.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.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/12] qemu: Drop giant if statement from qemuMonitorSetMigrationParams 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.39]); Thu, 26 Oct 2017 22:04:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The check can be easily replaced with a simple test in the JSON implementation and we don't need to update it every time a new parameter is added. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor.c | 9 --------- src/qemu/qemu_monitor_json.c | 5 +++++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index dd9d64a20..71069827e 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2618,15 +2618,6 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, =20 QEMU_CHECK_MONITOR_JSON(mon); =20 - if (!params->compressLevel_set && - !params->compressThreads_set && - !params->decompressThreads_set && - !params->cpuThrottleInitial_set && - !params->cpuThrottleIncrement_set && - !params->migrateTLSAlias && - !params->migrateTLSHostname) - return 0; - return qemuMonitorJSONSetMigrationParams(mon, params); } =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 826133543..d3c37ded8 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2765,6 +2765,11 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, #undef APPEND_INT #undef APPEND_STR =20 + if (virJSONValueObjectKeysNumber(args) =3D=3D 0) { + ret =3D 0; + goto cleanup; + } + if (virJSONValueObjectAppend(cmd, "arguments", args) < 0) goto cleanup; args =3D NULL; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055464588711.0795143685821; Thu, 26 Oct 2017 15:04:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E490B883BF; Thu, 26 Oct 2017 22:04:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC1405D743; Thu, 26 Oct 2017 22:04:22 +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 871086EF2A; Thu, 26 Oct 2017 22:04:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM4CRs031981 for ; Thu, 26 Oct 2017 18:04:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3E51C1899C; Thu, 26 Oct 2017 22:04:12 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99C8F5B839 for ; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 8C3D7101491; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E490B883BF Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:56 +0200 Message-Id: <0d8dc8fe6684b07262d8da36098c6274bea221e3.1509052291.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.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/12] qemumonitorjsontest: Rename 1st CHECK macro in migration params test 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 26 Oct 2017 22:04:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The first CHECK macro in the test is used for checking integer values. Let's make it a bit more generic to be usable for any numeric type and use it for a new CHECK_INT macro. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/qemumonitorjsontest.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 4d3b738e5..1dcff6672 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1813,7 +1813,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) ¶ms) < 0) goto cleanup; =20 -#define CHECK(VAR, FIELD, VALUE) = \ +#define CHECK_NUM(VAR, FIELD, VALUE, FMT) = \ do { = \ if (!params.VAR ## _set) { = \ virReportError(VIR_ERR_INTERNAL_ERROR, "%s is not set", FIELD)= ; \ @@ -1821,19 +1821,23 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParam= s(const void *data) } = \ if (params.VAR !=3D VALUE) { = \ virReportError(VIR_ERR_INTERNAL_ERROR, = \ - "Invalid %s: %d, expected %d", = \ + "Invalid %s: " FMT ", expected " FMT, = \ FIELD, params.VAR, VALUE); = \ goto cleanup; = \ } = \ } while (0) =20 - CHECK(compressLevel, "compress-level", 1); - CHECK(compressThreads, "compress-threads", 8); - CHECK(decompressThreads, "decompress-threads", 2); - CHECK(cpuThrottleInitial, "cpu-throttle-initial", 20); - CHECK(cpuThrottleIncrement, "cpu-throttle-increment", 10); +#define CHECK_INT(VAR, FIELD, VALUE) = \ + CHECK_NUM(VAR, FIELD, VALUE, "%d") =20 -#undef CHECK + CHECK_INT(compressLevel, "compress-level", 1); + CHECK_INT(compressThreads, "compress-threads", 8); + CHECK_INT(decompressThreads, "decompress-threads", 2); + CHECK_INT(cpuThrottleInitial, "cpu-throttle-initial", 20); + CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10); + +#undef CHECK_NUM +#undef CHECK_INT =20 #define CHECK(VAR, FIELD, VALUE) = \ do { = \ --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055465746375.74336050969396; Thu, 26 Oct 2017 15:04:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5EAC25F73A; Thu, 26 Oct 2017 22:04:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CEE35C8A1; Thu, 26 Oct 2017 22:04:24 +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 0AF866EF2E; Thu, 26 Oct 2017 22:04:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM4CNF031986 for ; Thu, 26 Oct 2017 18:04:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A15760600; Thu, 26 Oct 2017 22:04:12 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2015418EEE for ; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 8E375101492; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5EAC25F73A Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:57 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/12] qemumonitorjsontest: Rename 2nd CHECK macro in migration params test 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 26 Oct 2017 22:04:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The second CHECK macro was used for string parameters. Let's rename it to CHECK_STR and move it up to have all checks in one place. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/qemumonitorjsontest.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 1dcff6672..2cefdcac9 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1830,16 +1830,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams= (const void *data) #define CHECK_INT(VAR, FIELD, VALUE) = \ CHECK_NUM(VAR, FIELD, VALUE, "%d") =20 - CHECK_INT(compressLevel, "compress-level", 1); - CHECK_INT(compressThreads, "compress-threads", 8); - CHECK_INT(decompressThreads, "decompress-threads", 2); - CHECK_INT(cpuThrottleInitial, "cpu-throttle-initial", 20); - CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10); - -#undef CHECK_NUM -#undef CHECK_INT - -#define CHECK(VAR, FIELD, VALUE) = \ +#define CHECK_STR(VAR, FIELD, VALUE) = \ do { = \ if (!params.VAR) { = \ virReportError(VIR_ERR_INTERNAL_ERROR, "%s is not set", FIELD)= ; \ @@ -1853,10 +1844,17 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParam= s(const void *data) } = \ } while (0) =20 - CHECK(migrateTLSAlias, "tls-creds", "tls0"); - CHECK(migrateTLSHostname, "tls-hostname", ""); + CHECK_INT(compressLevel, "compress-level", 1); + CHECK_INT(compressThreads, "compress-threads", 8); + CHECK_INT(decompressThreads, "decompress-threads", 2); + CHECK_INT(cpuThrottleInitial, "cpu-throttle-initial", 20); + CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10); + CHECK_STR(migrateTLSAlias, "tls-creds", "tls0"); + CHECK_STR(migrateTLSHostname, "tls-hostname", ""); =20 -#undef CHECK +#undef CHECK_NUM +#undef CHECK_INT +#undef CHECK_STR =20 ret =3D 0; =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055463175902.3921544105652; Thu, 26 Oct 2017 15:04:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1101782100; Thu, 26 Oct 2017 22:04:21 +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 D77DD5E1C0; Thu, 26 Oct 2017 22:04:20 +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 9EABE1805964; Thu, 26 Oct 2017 22:04:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM49Lm031953 for ; Thu, 26 Oct 2017 18:04:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA3421748A; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1046D17123 for ; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 90CBD101493; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1101782100 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:58 +0200 Message-Id: <79b143964bb58c4bf31d6349c1d3e9dfc057b8cd.1509052291.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.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/12] qemu: Add support for setting downtime-limit migration parameter 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 26 Oct 2017 22:04:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We already support setting the maximum downtime with a dedicated virDomainMigrateSetMaxDowntime API. This patch does not implement another way of setting the downtime by adding a new public migration parameter. It just makes sure any parameter we are able to get from a QEMU monitor by query-migrate-parameters can be passed back to QEMU via migrate-set-parameters. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor.c | 5 +++-- src/qemu/qemu_monitor_json.c | 6 ++++++ tests/qemumonitorjsontest.c | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 71069827e..c88726735 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2607,14 +2607,15 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, VIR_DEBUG("compressLevel=3D%d:%d compressThreads=3D%d:%d " "decompressThreads=3D%d:%d cpuThrottleInitial=3D%d:%d " "cpuThrottleIncrement=3D%d:%d tlsAlias=3D%s " - "tlsHostname=3D%s", + "tlsHostname=3D%s downtimeLimit=3D%d:%llu", params->compressLevel_set, params->compressLevel, params->compressThreads_set, params->compressThreads, params->decompressThreads_set, params->decompressThreads, params->cpuThrottleInitial_set, params->cpuThrottleInitial, params->cpuThrottleIncrement_set, params->cpuThrottleIncreme= nt, NULLSTR(params->migrateTLSAlias), - NULLSTR(params->migrateTLSHostname)); + NULLSTR(params->migrateTLSHostname), + params->downtimeLimit_set, params->downtimeLimit); =20 QEMU_CHECK_MONITOR_JSON(mon); =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index d3c37ded8..a2f3e3317 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2753,6 +2753,10 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, APPEND(params->VAR, = \ virJSONValueObjectAppendString, VAR, FIELD) =20 +#define APPEND_ULONG(VAR, FIELD) = \ + APPEND(params->VAR ## _set, = \ + virJSONValueObjectAppendNumberUlong, VAR, FIELD) + APPEND_INT(compressLevel, "compress-level"); APPEND_INT(compressThreads, "compress-threads"); APPEND_INT(decompressThreads, "decompress-threads"); @@ -2760,10 +2764,12 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mo= n, APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment"); APPEND_STR(migrateTLSAlias, "tls-creds"); APPEND_STR(migrateTLSHostname, "tls-hostname"); + APPEND_ULONG(downtimeLimit, "downtime-limit"); =20 #undef APPEND #undef APPEND_INT #undef APPEND_STR +#undef APPEND_ULONG =20 if (virJSONValueObjectKeysNumber(args) =3D=3D 0) { ret =3D 0; diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 2cefdcac9..cc55b0c43 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1803,7 +1803,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) " \"compress-level\": 1," " \"cpu-throttle-initial\": 20," " \"tls-creds\": \"tls0\"," - " \"tls-hostname\": \"\"" + " \"tls-hostname\": \"\"," + " \"downtime-limit\": 500" " }" "}") < 0) { goto cleanup; @@ -1830,6 +1831,9 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) #define CHECK_INT(VAR, FIELD, VALUE) = \ CHECK_NUM(VAR, FIELD, VALUE, "%d") =20 +#define CHECK_ULONG(VAR, FIELD, VALUE) = \ + CHECK_NUM(VAR, FIELD, VALUE, "%llu") + #define CHECK_STR(VAR, FIELD, VALUE) = \ do { = \ if (!params.VAR) { = \ @@ -1851,9 +1855,11 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams= (const void *data) CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10); CHECK_STR(migrateTLSAlias, "tls-creds", "tls0"); CHECK_STR(migrateTLSHostname, "tls-hostname", ""); + CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL); =20 #undef CHECK_NUM #undef CHECK_INT +#undef CHECK_ULONG #undef CHECK_STR =20 ret =3D 0; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055465113583.0353858482852; Thu, 26 Oct 2017 15:04:25 -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 C4D1610476; Thu, 26 Oct 2017 22:04:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A36A5176A3; Thu, 26 Oct 2017 22:04:23 +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 6FBF36EF2C; Thu, 26 Oct 2017 22:04:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM49mK031952 for ; Thu, 26 Oct 2017 18:04:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id A97175D728; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0FD675D725 for ; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 933E6101494; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C4D1610476 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:03:59 +0200 Message-Id: <275ea8ae6d77bfbead2717bd84d992ea1116088b.1509052291.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.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/12] qemu: Rename TLS related migration parameters 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.38]); Thu, 26 Oct 2017 22:04:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The parameters used "migrate" prefix which is pretty redundant and qemuMonitorMigrationParams structure is our internal representation of QEMU migration parameters and it is supposed to use names which match QEMU names. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 23 +++++++++++------------ src/qemu/qemu_monitor.c | 7 +++---- src/qemu/qemu_monitor.h | 4 ++-- src/qemu/qemu_monitor_json.c | 8 ++++---- tests/qemumonitorjsontest.c | 8 ++++---- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index af744661f..e4e9e79cc 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -114,7 +114,7 @@ qemuMigrationCheckTLSCreds(virQEMUDriverPtr driver, goto cleanup; =20 /* NB: Could steal NULL pointer too! Let caller decide what to do. */ - VIR_STEAL_PTR(priv->migTLSAlias, migParams.migrateTLSAlias); + VIR_STEAL_PTR(priv->migTLSAlias, migParams.tlsCreds); =20 ret =3D 0; =20 @@ -225,7 +225,7 @@ qemuMigrationAddTLSObjects(virQEMUDriverPtr driver, *tlsAlias, &tlsProps) < 0) goto error; =20 - if (VIR_STRDUP(migParams->migrateTLSAlias, *tlsAlias) < 0) + if (VIR_STRDUP(migParams->tlsCreds, *tlsAlias) < 0) goto error; =20 return 0; @@ -2349,8 +2349,8 @@ qemuMigrationParamsClear(qemuMonitorMigrationParamsPt= r migParams) if (!migParams) return; =20 - VIR_FREE(migParams->migrateTLSAlias); - VIR_FREE(migParams->migrateTLSHostname); + VIR_FREE(migParams->tlsCreds); + VIR_FREE(migParams->tlsHostname); } =20 =20 @@ -2391,8 +2391,8 @@ qemuMigrationSetEmptyTLSParams(virQEMUDriverPtr drive= r, if (!priv->migTLSAlias) return 0; =20 - if (VIR_STRDUP(migParams->migrateTLSAlias, "") < 0 || - VIR_STRDUP(migParams->migrateTLSHostname, "") < 0) + if (VIR_STRDUP(migParams->tlsCreds, "") < 0 || + VIR_STRDUP(migParams->tlsHostname, "") < 0) return -1; =20 return 0; @@ -2508,8 +2508,8 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver, qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias); qemuDomainSecretInfoFree(&priv->migSecinfo); =20 - if (VIR_STRDUP(migParams.migrateTLSAlias, "") < 0 || - VIR_STRDUP(migParams.migrateTLSHostname, "") < 0 || + if (VIR_STRDUP(migParams.tlsCreds, "") < 0 || + VIR_STRDUP(migParams.tlsHostname, "") < 0 || qemuMigrationSetParams(driver, vm, asyncJob, &migParams) < 0) goto cleanup; =20 @@ -2774,7 +2774,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, goto stopjob; =20 /* Force reset of 'tls-hostname', it's a source only parameter */ - if (VIR_STRDUP(migParams.migrateTLSHostname, "") < 0) + if (VIR_STRDUP(migParams.tlsHostname, "") < 0) goto stopjob; =20 } else { @@ -3737,12 +3737,11 @@ qemuMigrationRun(virQEMUDriverPtr driver, * connect directly to the destination. */ if (spec->destType =3D=3D MIGRATION_DEST_CONNECT_HOST || spec->destType =3D=3D MIGRATION_DEST_FD) { - if (VIR_STRDUP(migParams->migrateTLSHostname, - spec->dest.host.name) < 0) + if (VIR_STRDUP(migParams->tlsHostname, spec->dest.host.name) <= 0) goto error; } else { /* Be sure there's nothing from a previous migration */ - if (VIR_STRDUP(migParams->migrateTLSHostname, "") < 0) + if (VIR_STRDUP(migParams->tlsHostname, "") < 0) goto error; } } else { diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index c88726735..3e2c69a9a 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2606,15 +2606,14 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, { VIR_DEBUG("compressLevel=3D%d:%d compressThreads=3D%d:%d " "decompressThreads=3D%d:%d cpuThrottleInitial=3D%d:%d " - "cpuThrottleIncrement=3D%d:%d tlsAlias=3D%s " - "tlsHostname=3D%s downtimeLimit=3D%d:%llu", + "cpuThrottleIncrement=3D%d:%d tlsCreds=3D%s tlsHostname=3D%s= " + "downtimeLimit=3D%d:%llu", params->compressLevel_set, params->compressLevel, params->compressThreads_set, params->compressThreads, params->decompressThreads_set, params->decompressThreads, params->cpuThrottleInitial_set, params->cpuThrottleInitial, params->cpuThrottleIncrement_set, params->cpuThrottleIncreme= nt, - NULLSTR(params->migrateTLSAlias), - NULLSTR(params->migrateTLSHostname), + NULLSTR(params->tlsCreds), NULLSTR(params->tlsHostname), params->downtimeLimit_set, params->downtimeLimit); =20 QEMU_CHECK_MONITOR_JSON(mon); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index bc8494fae..e123baaae 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -625,8 +625,8 @@ struct _qemuMonitorMigrationParams { =20 /* Value is either NULL, "", or some string. NULL indicates no support; * whereas, some string value indicates we can support setting/clearin= g */ - char *migrateTLSAlias; - char *migrateTLSHostname; + char *tlsCreds; + char *tlsHostname; =20 bool downtimeLimit_set; unsigned long long downtimeLimit; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a2f3e3317..9f238bc30 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2704,8 +2704,8 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, PARSE_INT(decompressThreads, "decompress-threads"); PARSE_INT(cpuThrottleInitial, "cpu-throttle-initial"); PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment"); - PARSE_STR(migrateTLSAlias, "tls-creds"); - PARSE_STR(migrateTLSHostname, "tls-hostname"); + PARSE_STR(tlsCreds, "tls-creds"); + PARSE_STR(tlsHostname, "tls-hostname"); PARSE_ULONG(downtimeLimit, "downtime-limit"); =20 #undef PARSE_SET @@ -2762,8 +2762,8 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, APPEND_INT(decompressThreads, "decompress-threads"); APPEND_INT(cpuThrottleInitial, "cpu-throttle-initial"); APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment"); - APPEND_STR(migrateTLSAlias, "tls-creds"); - APPEND_STR(migrateTLSHostname, "tls-hostname"); + APPEND_STR(tlsCreds, "tls-creds"); + APPEND_STR(tlsHostname, "tls-hostname"); APPEND_ULONG(downtimeLimit, "downtime-limit"); =20 #undef APPEND diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index cc55b0c43..aa5da8be9 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1853,8 +1853,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) CHECK_INT(decompressThreads, "decompress-threads", 2); CHECK_INT(cpuThrottleInitial, "cpu-throttle-initial", 20); CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10); - CHECK_STR(migrateTLSAlias, "tls-creds", "tls0"); - CHECK_STR(migrateTLSHostname, "tls-hostname", ""); + CHECK_STR(tlsCreds, "tls-creds", "tls0"); + CHECK_STR(tlsHostname, "tls-hostname", ""); CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL); =20 #undef CHECK_NUM @@ -1865,8 +1865,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) ret =3D 0; =20 cleanup: - VIR_FREE(params.migrateTLSAlias); - VIR_FREE(params.migrateTLSHostname); + VIR_FREE(params.tlsCreds); + VIR_FREE(params.tlsHostname); qemuMonitorTestFree(test); return ret; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055462019760.4622505217358; Thu, 26 Oct 2017 15:04:22 -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 7066681E09; Thu, 26 Oct 2017 22:04:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CDAC176A7; Thu, 26 Oct 2017 22:04:20 +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 1873C6EF28; Thu, 26 Oct 2017 22:04:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM49VE031954 for ; Thu, 26 Oct 2017 18:04:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id AB4CD58858; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13C675C886 for ; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 96D41101495; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7066681E09 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:04:00 +0200 Message-Id: <166c31616b2adf2db41f9a92abab2a5e0c07290f.1509052291.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.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/12] qemu: Add support for max-bandwidth migration parameter 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.25]); Thu, 26 Oct 2017 22:04:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We already support several ways of setting migration bandwidth and this is not adding another one. With this patch we are able to read and write this parameter using query-migrate-parameters and migrate-set-parameters in one call with all other parameters. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor.c | 3 ++- src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 2 ++ tests/qemumonitorjsontest.c | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 3e2c69a9a..04b18baf9 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2607,13 +2607,14 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, VIR_DEBUG("compressLevel=3D%d:%d compressThreads=3D%d:%d " "decompressThreads=3D%d:%d cpuThrottleInitial=3D%d:%d " "cpuThrottleIncrement=3D%d:%d tlsCreds=3D%s tlsHostname=3D%s= " - "downtimeLimit=3D%d:%llu", + "maxBandwidth=3D%d:%llu downtimeLimit=3D%d:%llu", params->compressLevel_set, params->compressLevel, params->compressThreads_set, params->compressThreads, params->decompressThreads_set, params->decompressThreads, params->cpuThrottleInitial_set, params->cpuThrottleInitial, params->cpuThrottleIncrement_set, params->cpuThrottleIncreme= nt, NULLSTR(params->tlsCreds), NULLSTR(params->tlsHostname), + params->maxBandwidth_set, params->maxBandwidth, params->downtimeLimit_set, params->downtimeLimit); =20 QEMU_CHECK_MONITOR_JSON(mon); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index e123baaae..7836dd332 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -628,6 +628,9 @@ struct _qemuMonitorMigrationParams { char *tlsCreds; char *tlsHostname; =20 + bool maxBandwidth_set; + unsigned long long maxBandwidth; + bool downtimeLimit_set; unsigned long long downtimeLimit; }; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9f238bc30..115610e50 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2706,6 +2706,7 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment"); PARSE_STR(tlsCreds, "tls-creds"); PARSE_STR(tlsHostname, "tls-hostname"); + PARSE_ULONG(maxBandwidth, "max-bandwidth"); PARSE_ULONG(downtimeLimit, "downtime-limit"); =20 #undef PARSE_SET @@ -2764,6 +2765,7 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment"); APPEND_STR(tlsCreds, "tls-creds"); APPEND_STR(tlsHostname, "tls-hostname"); + APPEND_ULONG(maxBandwidth, "max-bandwidth"); APPEND_ULONG(downtimeLimit, "downtime-limit"); =20 #undef APPEND diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index aa5da8be9..488c79cc3 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1804,6 +1804,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) " \"cpu-throttle-initial\": 20," " \"tls-creds\": \"tls0\"," " \"tls-hostname\": \"\"," + " \"max-bandwidth\": 1234567890," " \"downtime-limit\": 500" " }" "}") < 0) { @@ -1855,6 +1856,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10); CHECK_STR(tlsCreds, "tls-creds", "tls0"); CHECK_STR(tlsHostname, "tls-hostname", ""); + CHECK_ULONG(maxBandwidth, "max-bandwidth", 1234567890ULL); CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL); =20 #undef CHECK_NUM --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:02:27 2024 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 1509055489583967.1017712607182; Thu, 26 Oct 2017 15:04:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F3A66A7CE; Thu, 26 Oct 2017 22:04:48 +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 101005D728; Thu, 26 Oct 2017 22:04:48 +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 D46951805973; Thu, 26 Oct 2017 22:04:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QM4A03031974 for ; Thu, 26 Oct 2017 18:04:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4C76F173B1; Thu, 26 Oct 2017 22:04:10 +0000 (UTC) Received: from mamuti.net (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A9B0A173DE for ; Thu, 26 Oct 2017 22:04:09 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 99F90101498; Fri, 27 Oct 2017 00:04:02 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2F3A66A7CE Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 27 Oct 2017 00:04:01 +0200 Message-Id: <535c6dcddfdd5f7b5cdac4eb92d7fb557ec80672.1509052291.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.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/12] qemu: Add support for block-incremental migration parameter 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 26 Oct 2017 22:04:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We handle incremental storage migration in a different way. The support for this new (as of QEMU 2.10) parameter is only needed for full coverage of migration parameters used by QEMU. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor.c | 6 ++++-- src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 10 ++++++++++ tests/qemumonitorjsontest.c | 8 +++++++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 04b18baf9..611876ff8 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2607,7 +2607,8 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, VIR_DEBUG("compressLevel=3D%d:%d compressThreads=3D%d:%d " "decompressThreads=3D%d:%d cpuThrottleInitial=3D%d:%d " "cpuThrottleIncrement=3D%d:%d tlsCreds=3D%s tlsHostname=3D%s= " - "maxBandwidth=3D%d:%llu downtimeLimit=3D%d:%llu", + "maxBandwidth=3D%d:%llu downtimeLimit=3D%d:%llu " + "blockIncremental=3D%d:%d", params->compressLevel_set, params->compressLevel, params->compressThreads_set, params->compressThreads, params->decompressThreads_set, params->decompressThreads, @@ -2615,7 +2616,8 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, params->cpuThrottleIncrement_set, params->cpuThrottleIncreme= nt, NULLSTR(params->tlsCreds), NULLSTR(params->tlsHostname), params->maxBandwidth_set, params->maxBandwidth, - params->downtimeLimit_set, params->downtimeLimit); + params->downtimeLimit_set, params->downtimeLimit, + params->blockIncremental_set, params->blockIncremental); =20 QEMU_CHECK_MONITOR_JSON(mon); =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 7836dd332..f81fb7f2a 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -633,6 +633,9 @@ struct _qemuMonitorMigrationParams { =20 bool downtimeLimit_set; unsigned long long downtimeLimit; + + bool blockIncremental_set; + bool blockIncremental; }; =20 int qemuMonitorGetMigrationParams(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 115610e50..aa2599209 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2690,6 +2690,9 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, #define PARSE_ULONG(VAR, FIELD) = \ PARSE_SET(virJSONValueObjectGetNumberUlong, VAR, FIELD) =20 +#define PARSE_BOOL(VAR, FIELD) = \ + PARSE_SET(virJSONValueObjectGetBoolean, VAR, FIELD) + #define PARSE_STR(VAR, FIELD) = \ do { = \ const char *str; = \ @@ -2708,10 +2711,12 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mo= n, PARSE_STR(tlsHostname, "tls-hostname"); PARSE_ULONG(maxBandwidth, "max-bandwidth"); PARSE_ULONG(downtimeLimit, "downtime-limit"); + PARSE_BOOL(blockIncremental, "block-incremental"); =20 #undef PARSE_SET #undef PARSE_INT #undef PARSE_ULONG +#undef PARSE_BOOL #undef PARSE_STR =20 ret =3D 0; @@ -2758,6 +2763,10 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, APPEND(params->VAR ## _set, = \ virJSONValueObjectAppendNumberUlong, VAR, FIELD) =20 +#define APPEND_BOOL(VAR, FIELD) = \ + APPEND(params->VAR ## _set, = \ + virJSONValueObjectAppendBoolean, VAR, FIELD) + APPEND_INT(compressLevel, "compress-level"); APPEND_INT(compressThreads, "compress-threads"); APPEND_INT(decompressThreads, "decompress-threads"); @@ -2767,6 +2776,7 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, APPEND_STR(tlsHostname, "tls-hostname"); APPEND_ULONG(maxBandwidth, "max-bandwidth"); APPEND_ULONG(downtimeLimit, "downtime-limit"); + APPEND_BOOL(blockIncremental, "block-incremental"); =20 #undef APPEND #undef APPEND_INT diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 488c79cc3..aa2f67947 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1805,7 +1805,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) " \"tls-creds\": \"tls0\"," " \"tls-hostname\": \"\"," " \"max-bandwidth\": 1234567890," - " \"downtime-limit\": 500" + " \"downtime-limit\": 500," + " \"block-incremental\": true" " }" "}") < 0) { goto cleanup; @@ -1835,6 +1836,9 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(= const void *data) #define CHECK_ULONG(VAR, FIELD, VALUE) = \ CHECK_NUM(VAR, FIELD, VALUE, "%llu") =20 +#define CHECK_BOOL(VAR, FIELD, VALUE) = \ + CHECK_NUM(VAR, FIELD, VALUE, "%d") + #define CHECK_STR(VAR, FIELD, VALUE) = \ do { = \ if (!params.VAR) { = \ @@ -1858,10 +1862,12 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParam= s(const void *data) CHECK_STR(tlsHostname, "tls-hostname", ""); CHECK_ULONG(maxBandwidth, "max-bandwidth", 1234567890ULL); CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL); + CHECK_BOOL(blockIncremental, "block-incremental", true); =20 #undef CHECK_NUM #undef CHECK_INT #undef CHECK_ULONG +#undef CHECK_BOOL #undef CHECK_STR =20 ret =3D 0; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list