libvirt - QEMU Monitor Protocol (QMP)

Posted on Fri 20 May 2011 in Linux • 1 min read

Because libvirt self is using the qemu monitor to mange the guests, it is not available for the user. Since version 0.8.6 [1] its possbile to send a command throught libvirt to the monitor.

``` {.syntax .bash} virsh qemu-monitor-command

The problem is that you must use the QMP format to send a command like

``` {.syntax .bash}
$ virsh qemu-monitor-command    
   '{"execute":"human-monitor-command","arguments":{"command-line":"info kvm"}}'

The solution: Human Monitor Protocol / --hmp

With this nifty switch [2] its possible to use qemu monitor commands without the QMP format like

{.syntax .bash} $ virsh qemu-monitor-command --hmp 'info kvm' kvm support: enabled