Zend certified PHP/Magento developer

How to work with QEMU snapshots/savevm in a way that is predictable like virtual box?

Q: is there a way to have a running QEMU vm, where i have the option to (online or offline) save a restore-point as I go?

long text with investigation, alternatives already examined and small rants:

I’m having a hard time to grasp qemu multiple, completely incompatible, ways of storing and discarding state/changes to a vm and disks.

There is the -snapshot flag. But it doesn’t seem to be done (quote from doc

It is a work in progress and things may change as we progress.

), and depends on guest agent, which also doesn’t seem to be done and is somewhat broken as devs changed gears when migrating it from QMP to QAPI, and then scratched that halfway to work on libvirt overkill “solutions”.

Both those documents mention QEMU version 0.16~17… but my systems all have version 7.2+ so i’m not sure if it is some internal lib version or really old documents.

Then there’s filesystem snapshots -drive file=hda.qcow2,snapshot=on which doesn’t seem to work on my system. I mean, it works as everything is always trhown away when using that option. There’s no way to actually commit any data to a snapshot to the QCOW2 image.

Then, there is savevm monitor command, but while it is the only one that seems to actually make use of the QCOW2 snapshot capabilites, it will also store lots of undesirable CPU/memory state (they are more an annoyance that breaks things later on and only really help in rare QA cases, and i don’t see a way to easily discard them on next run and only keep the QCOW2 changes)

And there’s what I wanted. A way to always commit changes, but having a way to, when the machine is offline save that point in the storage as a snapshot.

But that last method is completely disconnected from qemu and the images. I have to create new file names as i progress, instead of adding save states.

I think the ideal state would be to have this offline state method, but using internal QCOW2 snapshot support instead of different files.

Finally, there’s another option that is the last offline use case, but done online. i.e. while running the vm, pause execution via qemu agent, create a new snapshot file on the external host, and instruct the running instance to switch to that new snapshot overlay and resume execution.