QEMU Monitor Protocol

QEMU Monitor Protocol (QMP) is a JSON-based protocol that allows applications to communicate with a QEMU instance. The qemu-monitor-command provided by the virsh shell allows users to interact with the QEMU monitor from the command line.

To enumerate all available QMP commands for a particular virtual machine, run the following:

#virsh qemu-monitor-command 
<vm_name> ––pretty '{"execute":"query-commands"}'

There are many query commands that can expose a lot of internal information that is not exposed to OpenStack and is vital for effective root cause analysis. For example, query-block returns detailed information about block devices being used by the virtual machine.

#virsh qemu-monitor-command instance-00000002 --pretty ...

Get Mastering KVM Virtualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.