On Tue, Oct 05, 2021 at 04:24:21PM -0500, Eric Blake wrote: > On Tue, Oct 05, 2021 at 12:45:48PM -0400, Jonah Palmer wrote: > > From: Laurent Vivier <lviv...@redhat.com> > > > > This new command lists all the instances of VirtIODevice with > > their QOM paths and virtio type/name. > > > > Signed-off-by: Jonah Palmer <jonah.pal...@oracle.com> > > --- > > hw/virtio/meson.build | 2 ++ > > hw/virtio/virtio-stub.c | 14 ++++++++++ > > hw/virtio/virtio.c | 27 +++++++++++++++++++ > > include/hw/virtio/virtio.h | 1 + > > qapi/meson.build | 1 + > > qapi/qapi-schema.json | 1 + > > qapi/virtio.json | 66 > > ++++++++++++++++++++++++++++++++++++++++++++++ > > tests/qtest/qmp-cmd-test.c | 1 + > > 8 files changed, 113 insertions(+) > > create mode 100644 hw/virtio/virtio-stub.c > > create mode 100644 qapi/virtio.json > > > > [Jonah: VirtioInfo member 'type' is now of type string and no longer > > relies on defining a QAPI list of virtio device type enumerations > > to match the VirtIODevice name with qapi_enum_parse().] > > Hmm; depending on how much information you want to cram in strings, we > may want to rebase this series on top of Dan's work to add the > HumanReadableText QAPI type: > https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg07717.html
The HumanReadableText type is only needed for commands that return entirely unstructured data, eg returns a HumanReadableText, or an array of HumanReadableText. The command here is returning semi-structured data, so I don't think it needs to depend on HumanReadableText. > > > +++ b/qapi/virtio.json > > @@ -0,0 +1,66 @@ > > +# -*- Mode: Python -*- > > +# vim: filetype=python > > +# > > + > > +## > > +# = Virtio devices > > +## > > + > > +## > > +# @VirtioInfo: > > +# > > +# Information about a given VirtIODevice > > +# > > +# @path: VirtIO device canonical QOM path. > > +# > > +# @type: VirtIO device name. > > +# > > +# Since: 6.2 > > +# > > +## > > +{ 'struct': 'VirtioInfo', > > + 'data': { > > + 'path': 'str', > > + 'type': 'str' > > + } > > +} > > + > > +## > > +# @x-debug-query-virtio: > > +# > > +# Return a list of all initalized VirtIO devices > > +# > > +# Returns: list of gathered @VirtioInfo devices > > +# > > +# Since: 6.2 > > +# > > +# Example: > > +# > > +# -> { "execute": "x-debug-query-virtio" } > > +# <- { "return": [ > > +# { > > +# "path": "/machine/peripheral-anon/device[4]/virtio-backend", > > +# "type": "virtio-input" > > +# }, > > +# { > > +# "path": "/machine/peripheral/crypto0/virtio-backend", > > +# "type": "virtio-crypto" > > +# }, > > +# { > > +# "path": "/machine/peripheral-anon/device[2]/virtio-backend", > > +# "type": "virtio-scsi" > > +# }, > > +# { > > +# "path": "/machine/peripheral-anon/device[1]/virtio-backend", > > +# "type": "virtio-net" > > +# }, > > +# { > > +# "path": "/machine/peripheral-anon/device[0]/virtio-backend", > > +# "type": "virtio-serial" > > +# } > > +# ] > > +# } > > +# > > +## > > + > > +{ 'command': 'x-debug-query-virtio', 'returns': ['VirtioInfo'] } > > But for now, it looks like 'str' is the correct type. > > > -- > Eric Blake, Principal Software Engineer > Red Hat, Inc. +1-919-301-3266 > Virtualization: qemu.org | libvirt.org > Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|