]> git.proxmox.com Git - mirror_qemu.git/commit
qapi: Improve how keyval input visitor reports unexpected dicts
authorMarkus Armbruster <armbru@redhat.com>
Tue, 28 Feb 2017 21:27:08 +0000 (22:27 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 7 Mar 2017 15:07:47 +0000 (16:07 +0100)
commit31478f26ab4ed82d35b763bbf259810d0c8b44e1
treed645d24279265bb083447941218b16e234348908
parent42e5f39378c6e7a0ada563779bbb6f470f7c03ff
qapi: Improve how keyval input visitor reports unexpected dicts

Incorrect option

    -blockdev node-name=foo,driver=file,filename=foo.img,aio.unmap=on

is rejected with "Invalid parameter type for 'aio', expected: string".
To make sense of this, you almost have to translate it into the
equivalent QMP command

    { "execute": "blockdev-add", "arguments": { "node-name": "foo", "driver": "file", "filename": "foo.img", "aio": { "unmap": true } } }

Improve the error message to "Parameters 'aio.*' are unexpected".
Take care not to confuse the case "unexpected nested parameters"
(i.e. the object is a QDict or QList) with the case "non-string scalar
parameter".  The latter is a misuse of the visitor, and should perhaps
be an assertion.  Note that test-qobject-input-visitor exercises this
misuse in test_visitor_in_int_keyval(), test_visitor_in_bool_keyval()
and test_visitor_in_number_keyval().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <1488317230-26248-23-git-send-email-armbru@redhat.com>
qapi/qobject-input-visitor.c