On Sun, 3 Jan 2021 at 15:30, Peter Krempa <pkrempa@redhat.com> wrote:

Hi,


Hi Peter,

Thanks a lot for the prompt reply and for pointing me to the direction ("virsh restore" among all) and apologies for my very late reply.
In the past couple of weeks I had a thorough look at past messages in the mailing list as well as linked tutorials, notes and slides. 

The memory image created by libvirt this way is actually in the same
image format as 'virsh save' and 'virsh restore' uses.
[...]

 I think I bumped into two limitations for my particular use case, but I'd like to double check with you, just in case I'm again missing something.

1) When creating an external online snapshot (disks+memory) of a qemu-KVM VM, I'd like to store the backing files in a separate folder and rename the newly-created delta files with the respective names of the original disks (now the backing files). Is this possible at all? Say a VM has a disk vm/disk1.qcow2 and I take an external snapshot, I'd like the backing file to appear in snap/disk1.qcow2 and the new delta disk to appear as vm/disk1.qcow2. Currently I wait for the VM to be shutdown by the user before I move around disks as desired and run qemu-img rebase in unsafe mode to update the delta disks. Can I accomplish the same result while the VNF is running?

2) As you suggested, I now use "virsh restore" to launch a VM with the memory state I had previously backed up. The "virsh restore" API applies to a VM that is not running. However, I see that for internal snapshots, libvirt also supports a snapshot-revert operation on a /live/ VM. Is this possible at all with an external snapshot? If so, what are the commands needed? My current way of automating a snapshot-revert with an external online snapshot only applies to a shutdown VM. It consists in:
- shutting down the VM;
- erasing all its delta disks, replacing them with new ones;
- executing "virsh restore" on the memory state, making sure that the disk paths referenced in the embedded XML file are correct.
Does this seem reasonable? Can I do the same while the VNF is running?
I suppose that for a snapshot-delete operation on a live VM I just need to run "virsh blockpull" on each disk, but I couldn't figure out how to do a revert.

Thanks again!

Riccardo