]> xenbits.xensource.com Git - libvirt.git/commit
qemu: Add shortcut for HMP pass through
authorJiri Denemark <jdenemar@redhat.com>
Wed, 2 Feb 2011 15:37:10 +0000 (16:37 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 3 Feb 2011 21:20:30 +0000 (22:20 +0100)
commit2169472ab6cac3bdb1f32578de2b608a61a1d703
tree04c7eadb9869dc3304ddc27c0ec31b252bf688a8
parentbe23e2bd655ce1672b7b7d4aeb082e9b9d18facf
qemu: Add shortcut for HMP pass through

Currently users who want to use virDomainQemuMonitorCommand() API or
it's virsh equivalent has to use the same protocol as libvirt uses for
communication to qemu. Since the protocol is QMP with current qemu and
HMP much more usable for humans, one ends up typing something like the
following:

    virsh qemu-monitor-command DOM \
'{"execute":"human-monitor-command","arguments":{"command-line":"info kvm"}}'

which is not a very convenient way of debugging qemu.

This patch introduces --hmp option to qemu-monitor-command, which says
that the provided command is in HMP. If libvirt uses QMP to talk with
qemu, the command will automatically be converted into QMP. So the
example above is simplified to just

    virsh qemu-monitor-command --hmp DOM "info kvm"

Also the result is converted from

    {"return":"kvm support: enabled\r\n"}

to just plain HMP:

    kvm support: enabled

If libvirt talks to qemu in HMP, --hmp flag is obviously a noop.
include/libvirt/libvirt-qemu.h
src/internal.h
src/qemu/qemu_driver.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
tools/virsh.c
tools/virsh.pod