• E
    qemu: query command line options in QMP · bd56d0d8
    Eric Blake 提交于
    Ever since the conversion to using only QMP for probing features
    of qemu 1.2 and newer, we have been unable to detect features
    that are added only by additional command line options.  For
    example, we'd like to know if '-machine mem-merge=on' (added
    in qemu 1.5) is present.  To do this, we will take advantage
    of qemu 1.5's query-command-line-parameters QMP call [1].
    
    This patch wires up the framework for probing the command results;
    if the QMP command is missing, or if a particular command line
    option does not output any parameters (for example, -net uses
    a polymorphic parser, which showed up as no parameters as of qemu
    1.5), we silently treat that command as having no results.
    
    [1] https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg05180.html
    
    * src/qemu/qemu_monitor.h (qemuMonitorGetOptions)
    (qemuMonitorSetOptions)
    (qemuMonitorGetCommandLineOptionParameters): New functions.
    * src/qemu/qemu_monitor_json.h
    (qemuMonitorJSONGetCommandLineOptionParameters): Likewise.
    * src/qemu/qemu_monitor.c (_qemuMonitor): Add cache field.
    (qemuMonitorDispose): Clean it.
    (qemuMonitorGetCommandLineOptionParameters): Implement new function.
    * src/qemu/qemu_monitor_json.c
    (qemuMonitorJSONGetCommandLineOptionParameters): Likewise.
    (testQemuMonitorJSONGetCommandLineParameters): Test it.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    bd56d0d8
qemu_monitor.h 26.9 KB