mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-28 11:50:37 -07:00
python: support recording QMP session to a file
When running QMP commands with very large response payloads, it is often
not easy to spot the info you want. If we can save the response to a
file then tools like 'grep' or 'jq' can be used to extract information.
For convenience of processing, we merge the QMP command and response
dictionaries together:
{
"arguments": {},
"execute": "query-kvm",
"return": {
"enabled": false,
"present": true
}
}
Example usage
$ ./scripts/qmp/qmp-shell-wrap -l q.log -p -- ./build/qemu-system-x86_64 -display none
Welcome to the QMP low-level shell!
Connected
(QEMU) query-kvm
{
"return": {
"enabled": false,
"present": true
}
}
(QEMU) query-mice
{
"return": [
{
"absolute": false,
"current": true,
"index": 2,
"name": "QEMU PS/2 Mouse"
}
]
}
$ jq --slurp '. | to_entries[] | select(.value.execute == "query-kvm") |
.value.return.enabled' < q.log
false
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20220128161157.36261-3-berrange@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
439125293c
commit
5c66d7d8de
2 changed files with 25 additions and 7 deletions
|
|
@ -114,7 +114,10 @@ ignore_missing_imports = True
|
|||
# no Warning level messages displayed, use "--disable=all --enable=classes
|
||||
# --disable=W".
|
||||
disable=consider-using-f-string,
|
||||
consider-using-with,
|
||||
too-many-arguments,
|
||||
too-many-function-args, # mypy handles this with less false positives.
|
||||
too-many-instance-attributes,
|
||||
no-member, # mypy also handles this better.
|
||||
|
||||
[pylint.basic]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue