On Fri, Apr 06, 2018 at 08:21:00PM +0200, Laszlo Ersek wrote:
On 04/06/18 20:10, Eric Blake wrote:
[...]
# key=value pairs also support Python or JSON object literal subset
notations,
# without spaces. Dictionaries/objects {} are supported as are arrays [].
#
# example-command
arg-name1={'key':'value','obj'={'prop':"value"}}
#
# Both JSON and Python formatting should work, including both styles of
# string literal quotes. Both paradigms of literal values should work,
# including null/true/false for JSON and None/True/False for Python.
A couple of examples of the the key-value pairs and using JSON dicts
with 'qmp-shell'.
Key-value pairs:
(QEMU) blockdev-snapshot node=node-Base snapshot-file=./overlay1.qcow2
overlay=node-Overlay1
[...]
A combination key-value pairs and JSON dicts:
(QEMU) blockdev-add driver=qcow2 node-name=node-overlay1
file={"driver":"file","filename":"overlay1.qcow2"}
[...]
This looks awesome, because it should let me provide messy nested
input
(which I'll obviously compose in my $EDITOR and then paste it), and then
the QMP shell will both validate and pretty print that. I'm going to try
this.
A couple of notes when using the 'qmp-shell':
- Assuming you started QEMU with: `[...] -qmp
unix:/tmp/qmp-sock,server,nowait`, you might want to use the '-p'
command-line option to prett-print the JSON:
$ qmp-shell -v -p /tmp/qmp-sock
- It also provides a persistent command history in a convenient file:
'~/.qmp-shell_history'
--
/kashyap