Reputation: 382890
For example, I'm running a Linux guest, and I want to do something like this in my init script just after boot:
savevm-somehow
run-lengthy-benchmark
I know how to use the monitor from the host, but it is hard to stop at the correct point to do the savevm
: I could GDB step debug until there and then connect to the monitor, but that would be annoying.
Upvotes: 1
Views: 977
Reputation: 11403
In theory you could tell QEMU to put its monitor on a TCP port, and then also tell QEMU's networking to forward that port to the guest, and then from the guest connect to the forwarded port. I would worry about the possibility of deadlocks in this setup, though...
An approach I've used in the past is to script the QEMU monitor prompt using expect. There's an example here: https://translatedcode.wordpress.com/2015/07/06/tricks-for-debugging-qemu-savevm-snapshots/ which uses a hardcoded delay time, but you ought to also be able to get expect to look at the serial port output to decide when to send the commands.
Upvotes: 2