summary refs log tree commit diff stats
path: root/util/qemu-config.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-04-15 13:30:04 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2015-04-24 14:18:06 -0400
commit43d0a2c1af5bc77ed067636db956209779351dfe (patch)
tree884dc0744698afb790ec6be93d7feb6d7d164a19 /util/qemu-config.c
parent6540e9f35bfeea2baf4509745516172070dca412 (diff)
downloadfocaccia-qemu-43d0a2c1af5bc77ed067636db956209779351dfe.tar.gz
focaccia-qemu-43d0a2c1af5bc77ed067636db956209779351dfe.zip
qmp-commands: fix incorrect uses of ":O" specifier
As far as the QMP parser is concerned, neither the 'O' nor the 'q' format specifiers
put any constraint on the command.  However, there are two differences:

1) from a documentation point of view 'O' says that this command takes
a dictionary.  The dictionary will be converted to QemuOpts in the
handler to match the corresponding HMP command.

2) 'O' sets QMP_ACCEPT_UNKNOWNS, resulting in the command accepting invalid
extra arguments.  For example the following is accepted:

   { "execute": "send-key",
        "arguments": { "keys": [ { "type": "qcode", "data": "ctrl" },
                                 { "type": "qcode", "data": "alt" },
                                 { "type": "qcode", "data": "delete" } ], "foo": "bar" } }

Neither send-key nor migrate-set-capabilities take a QemuOpts-like
dictionary; they take an array of dictionaries.  And neither command
really wants to have extra unknown arguments.  Thus, the right
specifier to use in this case is 'q'; with this patch the above
command fails with

   {"error": {"class": "GenericError", "desc": "Invalid parameter 'foo'"}}

as intended.

Reported-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'util/qemu-config.c')
0 files changed, 0 insertions, 0 deletions