• M
    qapi: Improve how keyval input visitor reports unexpected dicts · 31478f26
    Markus Armbruster 提交于
    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: NMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: NKevin Wolf <kwolf@redhat.com>
    Message-Id: <1488317230-26248-23-git-send-email-armbru@redhat.com>
    31478f26
qobject-input-visitor.c 19.1 KB