From nobody Wed Feb 11 10:17:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1489596016596294.6430145561965; Wed, 15 Mar 2017 09:40:16 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGb3jH016519; Wed, 15 Mar 2017 12:37:03 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb0rx025013 for ; Wed, 15 Mar 2017 12:37:00 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIT000870; Wed, 15 Mar 2017 12:36:59 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:27 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 15/23] qemu: monitor: Add monitor infrastructure for query-named-block-nodes 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add monitor tooling for calling query-named-block-nodes. The monitor returns the data as the raw JSON array that is returned from the monitor. Unfortunately the logic to extract the node names for a complete backing chain will be so complex that I won't be able to extract any meaningful subset of the data in the monitor code. --- src/qemu/qemu_monitor.c | 11 +++++++++++ src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 26 ++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 4 files changed, 41 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index e2af0ca02..36b8b5ea4 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4184,3 +4184,14 @@ qemuMonitorSetBlockThreshold(qemuMonitorPtr mon, return qemuMonitorJSONSetBlockThreshold(mon, nodename, threshold); } + + +virJSONValuePtr +qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon) +{ + VIR_DEBUG("mon=3D%p", mon); + + QEMU_CHECK_MONITOR_JSON_NULL(mon); + + return qemuMonitorJSONQueryNamedBlockNodes(mon); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 61d89a9cf..77e7aeeca 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1076,5 +1076,6 @@ int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon, const char *nodename, unsigned long long threshold); +virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon); #endif /* QEMU_MONITOR_H */ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6fb2af48a..141d56b3d 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7518,3 +7518,29 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon, return ret; } + + +virJSONValuePtr +qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon) +{ + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + virJSONValuePtr ret =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-named-block-nodes", NU= LL))) + return NULL; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D virJSONValueObjectStealArray(reply, "return"); + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + + return ret; +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index e0dd696d9..9c363a0a1 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -517,4 +517,7 @@ int qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon, unsigned long long threshold) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); +virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon) + ATTRIBUTE_NONNULL(1); + #endif /* QEMU_MONITOR_JSON_H */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list