From nobody Wed May 14 22:45:00 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1519927433114900.4545378014719; Thu, 1 Mar 2018 10:03:53 -0800 (PST) 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 B54567FDC9; Thu, 1 Mar 2018 18:03:51 +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 8BA725D793; Thu, 1 Mar 2018 18:03:51 +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 5417E4A474; Thu, 1 Mar 2018 18:03:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w21I3eUl017489 for ; Thu, 1 Mar 2018 13:03:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF1FE200A3A9; Thu, 1 Mar 2018 18:03:40 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AC832026E04 for ; Thu, 1 Mar 2018 18:03:40 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 1 Mar 2018 19:03:28 +0100 Message-Id: <20180301180334.4225-4-abologna@redhat.com> In-Reply-To: <20180301180334.4225-1-abologna@redhat.com> References: <20180301180334.4225-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH v3 3/9] qemu: Prefer qom-list-properties to device-list-properties 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]); Thu, 01 Mar 2018 18:03:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The former command is only implemented in the very latest QEMU version, but it's a proper superset of the latter and can thus be used as a drop-in replacement when available. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 10 +- src/qemu/qemu_monitor.c | 5 +- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 13 +- src/qemu/qemu_monitor_json.h | 3 +- .../caps_2.12.0-gicv2.aarch64.replies | 364 +++++++++++++- .../caps_2.12.0-gicv2.aarch64.xml | 2 +- .../caps_2.12.0-gicv3.aarch64.replies | 364 +++++++++++++- .../caps_2.12.0-gicv3.aarch64.xml | 2 +- .../qemucapabilitiesdata/caps_2.12.0.ppc64.replies | 384 ++++++++++++++- tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 2 +- .../caps_2.12.0.x86_64.replies | 544 +++++++++++++++++= +++- tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 2 +- 13 files changed, 1625 insertions(+), 71 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 42ede1db3e..fb6b492454 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2883,6 +2883,12 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps, int nvalues; char **values; size_t i; + const char *impl =3D "device-list-properties"; + + /* Prefer qom-list-properties if available, since it allows us to gath= er + * information about objects that device-list-properties doesn't suppo= rt */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES)) + impl =3D "qom-list-properties"; =20 if ((nvalues =3D qemuMonitorGetObjectTypes(mon, &values)) < 0) return -1; @@ -2899,9 +2905,7 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps, if (cap >=3D 0 && !virQEMUCapsGet(qemuCaps, cap)) continue; =20 - if ((nvalues =3D qemuMonitorGetObjectProps(mon, - type, - &values)) < 0) + if ((nvalues =3D qemuMonitorGetObjectProps(mon, impl, type, &value= s)) < 0) return -1; virQEMUCapsProcessStringFlags(qemuCaps, virQEMUCapsObjectProps[i].nprops, diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ad5c572aee..56aaffc632 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3943,14 +3943,15 @@ qemuMonitorGetObjectTypes(qemuMonitorPtr mon, =20 int qemuMonitorGetObjectProps(qemuMonitorPtr mon, + const char *impl, const char *type, char ***props) { - VIR_DEBUG("type=3D%s props=3D%p", type, props); + VIR_DEBUG("impl=3D%s type=3D%s props=3D%p", impl, type, props); =20 QEMU_CHECK_MONITOR_JSON(mon); =20 - return qemuMonitorJSONGetObjectProps(mon, type, props); + return qemuMonitorJSONGetObjectProps(mon, impl, type, props); } =20 =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 954ae88e4f..45ead25b7a 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1083,6 +1083,7 @@ int qemuMonitorGetKVMState(qemuMonitorPtr mon, int qemuMonitorGetObjectTypes(qemuMonitorPtr mon, char ***types); int qemuMonitorGetObjectProps(qemuMonitorPtr mon, + const char *impl, const char *type, char ***props); char *qemuMonitorGetTargetArch(qemuMonitorPtr mon); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a09e93e464..ddeb27587b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6023,6 +6023,7 @@ int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr m= on, =20 =20 int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, + const char *impl, const char *type, char ***props) { @@ -6036,7 +6037,7 @@ int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, =20 *props =3D NULL; =20 - if (!(cmd =3D qemuMonitorJSONMakeCommand("device-list-properties", + if (!(cmd =3D qemuMonitorJSONMakeCommand(impl, "s:typename", type, NULL))) return -1; @@ -6054,8 +6055,9 @@ int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, =20 if (!(data =3D virJSONValueObjectGetArray(reply, "return")) || (n =3D virJSONValueArraySize(data)) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("device-list-properties reply data was not an arr= ay")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s reply data was not an array"), + impl); goto cleanup; } =20 @@ -6068,8 +6070,9 @@ int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, const char *tmp; =20 if (!(tmp =3D virJSONValueObjectGetString(child, "name"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("device-list-properties reply data was missin= g 'name'")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s reply data was missing 'name'"), + impl); goto cleanup; } =20 diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index ec243becc4..13ca49efd6 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -442,9 +442,10 @@ int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr mo= n, ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); =20 int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, + const char *impl, const char *type, char ***props) - ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); + ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); char *qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon); =20 int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, diff --git a/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.replies b= /tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.replies index 2bccdaf586..bc591b24e9 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.replies +++ b/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.replies @@ -3402,10 +3402,18 @@ "description": "on/off", "type": "bool" }, + { + "name": "legacy-addr", + "type": "str" + }, { "name": "min_io_size", "type": "uint16" }, + { + "name": "type", + "type": "string" + }, { "name": "event_idx", "description": "on/off", [...] @@ -4075,7 +4147,7 @@ "id": "libvirt-13", "error": { "class": "DeviceNotFound", - "desc": "Device 'virtio-blk-ccw' not found" + "desc": "Class 'virtio-blk-ccw' not found" } } =20 @@ -4083,7 +4155,7 @@ "id": "libvirt-14", "error": { "class": "DeviceNotFound", - "desc": "Device 'virtio-net-ccw' not found" + "desc": "Class 'virtio-net-ccw' not found" } } =20 @@ -4091,7 +4163,7 @@ "id": "libvirt-15", "error": { "class": "DeviceNotFound", - "desc": "Device 'virtio-scsi-ccw' not found" + "desc": "Class 'virtio-scsi-ccw' not found" } } [...] diff --git a/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.xml index b4e5d0eddf..f6cd790480 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.xml @@ -190,7 +190,7 @@ 2011050 0 - 312776 + 317921 (v2.11.0-1777-g2e0cc0f) aarch64 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list