From nobody Thu May 15 02:17:38 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 1517243546065117.67541736772785; Mon, 29 Jan 2018 08:32:26 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81569776EB; Mon, 29 Jan 2018 16:32:24 +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 5215160CD3; Mon, 29 Jan 2018 16:32: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 0E49118033DB; Mon, 29 Jan 2018 16:32:24 +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 w0TGWLfK012300 for ; Mon, 29 Jan 2018 11:32:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 83A2860C82; Mon, 29 Jan 2018 16:32:21 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-232.phx2.redhat.com [10.3.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 439EF60C90 for ; Mon, 29 Jan 2018 16:32:19 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 11:32:01 -0500 Message-Id: <20180129163209.22424-4-jferlan@redhat.com> In-Reply-To: <20180129163209.22424-1-jferlan@redhat.com> References: <20180129163209.22424-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 03/11] qemu: Introduce qemuMonitor[JSON]QueryDump 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 29 Jan 2018 16:32:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add the query-dump API's in order to allow the dump-guest-memory to be used to monitor progress. This will use the dump stats extraction helper to fill a return buffer. Signed-off-by: John Ferlan --- src/qemu/qemu_monitor.c | 9 +++++++++ src/qemu/qemu_monitor.h | 2 ++ src/qemu/qemu_monitor_json.c | 37 +++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 4 files changed, 51 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 23153967c..a8ca9a566 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2773,6 +2773,15 @@ qemuMonitorMigrateCancel(qemuMonitorPtr mon) } =20 =20 +qemuMonitorDumpStatsPtr +qemuMonitorQueryDump(qemuMonitorPtr mon) +{ + QEMU_CHECK_MONITOR_JSON_NULL(mon); + + return qemuMonitorJSONQueryDump(mon); +} + + /** * Returns 1 if @capability is supported, 0 if it's not, or -1 on error. */ diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 37f335e9f..5749af168 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -787,6 +787,8 @@ int qemuMonitorMigrateCancel(qemuMonitorPtr mon); int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon, const char *capability); =20 +qemuMonitorDumpStatsPtr qemuMonitorQueryDump(qemuMonitorPtr mon); + int qemuMonitorDumpToFd(qemuMonitorPtr mon, int fd, const char *dumpformat); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a8cb8ce6b..33ec3347e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3170,6 +3170,43 @@ int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon) return ret; } =20 + +/* qemuMonitorJSONQueryDump: + * @mon: Monitor pointer + * + * Attempt to make a "query-dump" call, check for errors, and get/return + * the current from the reply + * + * Returns: @stats on success, NULL on failure + */ +qemuMonitorDumpStatsPtr +qemuMonitorJSONQueryDump(qemuMonitorPtr mon) +{ + virJSONValuePtr cmd =3D qemuMonitorJSONMakeCommand("query-dump", NULL); + virJSONValuePtr reply =3D NULL; + virJSONValuePtr result =3D NULL; + qemuMonitorDumpStatsPtr ret =3D NULL; + + if (!cmd) + return NULL; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + result =3D virJSONValueObjectGetObject(reply, "return"); + + ret =3D qemuMonitorJSONExtractDumpStats(result); + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} + + int qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon, const char *capability) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 739a99293..f9fcba77f 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -162,6 +162,9 @@ int qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitorP= tr mon, =20 int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon); =20 +qemuMonitorDumpStatsPtr +qemuMonitorJSONQueryDump(qemuMonitorPtr mon); + int qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon, const char *capability); =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list