Skip to content
Snippets Groups Projects
  • Markus Armbruster's avatar
    624fa80c
    monitor: Drop query-qmp-schema 'gen': false hack · 624fa80c
    Markus Armbruster authored
    
    QMP commands return their response as a generated QAPI type, which the
    monitor core converts to JSON via QObject.
    
    query-qmp-schema's response is the generated introspection data.  This
    is a QLitObject since commit 7d0f982b "qapi: generate a literal
    qobject for introspection", v2.12).  Before, it was a string.  Instead
    of converting QLitObject / string -> QObject -> QAPI type
    SchemaInfoList -> QObject -> JSON, we take a shortcut: the command is
    'gen': false, so it can return the QObject instead of the QAPI type.
    Slightly simpler and more efficient.
    
    The next commit will filter the response for output policy, and this
    is easier in the SchemaInfoList representation.  Drop the shortcut.
    
    This replaces the manual command registration by a generated one.  The
    manual registration makes the command available before the machine is
    built by passing flag QCO_ALLOW_PRECONFIG.  To keep it available
    there, we need need to add 'allow-preconfig': true to its definition
    in the schema.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20210318155519.1224118-7-armbru@redhat.com>
    624fa80c
    History
    monitor: Drop query-qmp-schema 'gen': false hack
    Markus Armbruster authored
    
    QMP commands return their response as a generated QAPI type, which the
    monitor core converts to JSON via QObject.
    
    query-qmp-schema's response is the generated introspection data.  This
    is a QLitObject since commit 7d0f982b "qapi: generate a literal
    qobject for introspection", v2.12).  Before, it was a string.  Instead
    of converting QLitObject / string -> QObject -> QAPI type
    SchemaInfoList -> QObject -> JSON, we take a shortcut: the command is
    'gen': false, so it can return the QObject instead of the QAPI type.
    Slightly simpler and more efficient.
    
    The next commit will filter the response for output policy, and this
    is easier in the SchemaInfoList representation.  Drop the shortcut.
    
    This replaces the manual command registration by a generated one.  The
    manual registration makes the command available before the machine is
    built by passing flag QCO_ALLOW_PRECONFIG.  To keep it available
    there, we need need to add 'allow-preconfig': true to its definition
    in the schema.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20210318155519.1224118-7-armbru@redhat.com>