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
Thanks, great tip !!!! This allowed me to workaround one of my problems. Long live FOSS people ! You/we’re great!