Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This new command lists all the instances of VirtIODevices with their canonical QOM path and name. [Jonah: @virtio_list duplicates information that already exists in the QOM composition tree. However, extracting necessary information from this tree seems to be a bit convoluted. Instead, we still create our own list of realized virtio devices but use @qmp_qom_get with the device's canonical QOM path to confirm that the device exists and is realized. If the device exists but is actually not realized, then we remove it from our list (for synchronicity to the QOM composition tree). Also, the QMP command @x-query-virtio is redundant as @qom-list and @qom-get are sufficient to search '/machine/' for realized virtio devices. However, @x-query-virtio is much more convenient in listing realized virtio devices.] Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com> Message-Id: <1642678168-20447-4-git-send-email-jonah.palmer@oracle.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
- Loading branch information
Showing
8 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "qemu/osdep.h" | ||
#include "qapi/error.h" | ||
#include "qapi/qapi-commands-virtio.h" | ||
|
||
static void *qmp_virtio_unsupported(Error **errp) | ||
{ | ||
error_setg(errp, "Virtio is disabled"); | ||
return NULL; | ||
} | ||
|
||
VirtioInfoList *qmp_x_query_virtio(Error **errp) | ||
{ | ||
return qmp_virtio_unsupported(errp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ qapi_all_modules = [ | |
'sockets', | ||
'trace', | ||
'transaction', | ||
'virtio', | ||
'yank', | ||
] | ||
if have_system | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,3 +93,4 @@ | |
{ 'include': 'audio.json' } | ||
{ 'include': 'acpi.json' } | ||
{ 'include': 'pci.json' } | ||
{ 'include': 'virtio.json' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# -*- Mode: Python -*- | ||
# vim: filetype=python | ||
# | ||
|
||
## | ||
# = Virtio devices | ||
## | ||
|
||
## | ||
# @VirtioInfo: | ||
# | ||
# Basic information about a given VirtIODevice | ||
# | ||
# @path: The VirtIODevice's canonical QOM path | ||
# | ||
# @name: Name of the VirtIODevice | ||
# | ||
# Since: 7.0 | ||
# | ||
## | ||
{ 'struct': 'VirtioInfo', | ||
'data': { 'path': 'str', | ||
'name': 'str' } } | ||
|
||
## | ||
# @x-query-virtio: | ||
# | ||
# Returns a list of all realized VirtIODevices | ||
# | ||
# Features: | ||
# @unstable: This command is meant for debugging. | ||
# | ||
# Returns: List of gathered VirtIODevices | ||
# | ||
# Since: 7.0 | ||
# | ||
# Example: | ||
# | ||
# -> { "execute": "x-query-virtio" } | ||
# <- { "return": [ | ||
# { | ||
# "path": "/machine/peripheral-anon/device[4]/virtio-backend", | ||
# "name": "virtio-input" | ||
# }, | ||
# { | ||
# "path": "/machine/peripheral/crypto0/virtio-backend", | ||
# "name": "virtio-crypto" | ||
# }, | ||
# { | ||
# "path": "/machine/peripheral-anon/device[2]/virtio-backend", | ||
# "name": "virtio-scsi" | ||
# }, | ||
# { | ||
# "path": "/machine/peripheral-anon/device[1]/virtio-backend", | ||
# "name": "virtio-net" | ||
# }, | ||
# { | ||
# "path": "/machine/peripheral-anon/device[0]/virtio-backend", | ||
# "name": "virtio-serial" | ||
# } | ||
# ] | ||
# } | ||
# | ||
## | ||
|
||
{ 'command': 'x-query-virtio', | ||
'returns': [ 'VirtioInfo' ], | ||
'features': [ 'unstable' ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters