Issue
How can I send loadvm command to a qemu instance running on my windows 10 machine?. I want to load a snapshot when the VM is running. Also I don't want to use Qemu monitor window, I want to command Qemu from my c# project.
Solution
To programmatically control QEMU from another program, you need to:
- create a QMP monitor connection when QEMU is started which your program can talk to (you could have it listen on a TCP socket, or (at least on Linux) you can set it up to use a file descriptor which you pass QEMU when you start it)
- connect to that monitor from your program and send it commands
QMP is similar to the HMP 'human monitor' in what it can do, but it is intended for software to use: it is a JSON format protocol so responses are easier to parse, and there are guarantees about backwards compatibility (which the human monitor protocol does not make). QMP is how programs like libvirt control QEMU.
See the introduction to QMP and the QMP reference manual for more details.
NB: bear in mind that anything that can connect to a QMP monitor has effectively complete control over the QEMU process, including being able to take it over and run arbitrary code. So it's important to protect the monitor connection so that no unauthorised user can get access to it (eg by using a UNIX socket with filesystem permissions restricting it to the user that runs the QEMU process, or by using filedescriptors). Definitely do not use a TCP socket exposed to the internet.
Answered By - Peter Maydell
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.