Search Posts

How to use QMP, send command remotely to qemu

To use qmp and send command to qemu from another process, start qemu by

qemu-kvm -m 4096m -hda win7.img -chardev socket,id=qmp,path=/tmp/test.qmp,server,nowait -mon chardev=qmp,mode=control 

This will create a file /tmp/test.gmp for interchange the command. Then you can start another terminal and invoke

cat command.txt |socat - /tmp/test.qmp 

command.txt:

{ "execute": "qmp_capabilities" }
{ "execute": "query-status" }
{ "execute": "query-commands" }
{ "execute": "stop" }
{ "execute": "screendump","arguments":{"filename":"peter.png"}  }
{ "execute": "cont" }
{ "execute": "human-monitor-command", "arguments": { "command-line": "info registers" } } 

!!! remark, must invoke { “execute”: “qmp_capabilities” } before invoke any qmp command

1 comment on How to use QMP, send command remotely to qemu

Leave a Reply

Your email address will not be published. Required fields are marked *