Well, nobody responded, so I went ahead and implemented what I described.  It's 
quite the Rube Goldberg machine.  The program in the vm that needs to trigger 
the checkpoint is running under another simulator inside the VM.  So the best I 
can have it do is make a file as a signal.  So I wrote a python script that 
waits for the signal file to appear, then runs:
$ssh <host> "virsh qemu-monitor-command --hmp centos8_1 'savevm savestate1'"
When the ssh command completes, the python script deletes the signal file and 
the original program proceeds.

This works... usually.  I notice that the VM occasionally hangs for a few 
minutes when taking a checkpoint.  Or sometimes the whole thing crashes with, 
"libvirt.libvirtError: Timed out during operation: cannot acquire state change 
lock (held by monitor=qemuDispatchDomainMonitorCommand)"

If anyone has any ideas that might help, I'd be happy to hear them. 🙂  But I'm 
basically just publishing my results so far in case anyone else is interested.

________________________________
From: Leek, Jim
Sent: Thursday, August 26, 2021 4:08 PM
To: qemu-discuss@nongnu.org <qemu-discuss@nongnu.org>
Subject: Take a checkpoint from inside of qemu

I'm running CentOS 8 inside qemu via virt-manager.  I would like a program 
running on the virtual machine to be able to trigger a savevm command on it's 
own VM.  (This is for debugging purposes on the program being run in the VM.)

The only way I can think of to do this is to have the program trigger a script 
that ssh's out of the guest, to the host, to trigger the savevm command.  
Something like this:

guest$ ssh <host> "virsh qemu-monitor-command --hmp centos8_1 'savevm 
savestate1'"

Is there any more straightforward method available?

Thanks,
Jim

Reply via email to