|
From: | Mike Lovell |
Subject: | Re: [Qemu-discuss] read monitor commands from a file |
Date: | Fri, 14 Dec 2012 18:16:59 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
On 12/13/2012 08:47 PM, Shijesta Victor wrote:
Is it possible to read monitor commands off a file? I couldn't get this working.What I need is this:I would have a list of commands in a file, and I want it as if these commands were typed at the monitor prompt one after another.
it might be possible to hack something together when running the monitor on a socket. then you can just connect to the socket, write the commands you want, and read the responses. i believe this is how libvirt originally controlled a qemu process.
to get the monitor to use a local unix socket, add '-monitor unix:/path/to/sock,server,nowait' to the command line. then you can use something like `nc -U /path/to/sock < /path/to/command.txt` to connect to the socket and give the commands to the monitor. you could also use tcp or udp sockets but you'll probably want to limit it to listening on localhost.
if you are going to do very many things with the monitor, you might want to look at the qmp interfaces. qmp (qemu management protocol) is a way to talk to the monitor that is a bit nicer for programmatic interaction. it uses json and is documented in the QMP/ directory of the qemu source. there is also some example python in that directory for talking to the monitor.
mike
[Prev in Thread] | Current Thread | [Next in Thread] |