I have spent about a week trying to figure out how to backup/restore/restore a virt-manager VM including all snapshots.
If I examine the qcow2 file it contains all the snapshots that were made:
sudo qemu-img snapshot -l '../LinuxLiteV3.8.qcow2'
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 LinuxLite38_PreUD01 0 B 2020-11-06 23:37:14 00:00:00.000
2 snapshot1 0 B 2020-12-27 15:59:03 00:00:00.000
I can take this file to another instance of virt-manager, and recreate the VM and it will run, but virt-manager appears to have no knowledge of the snapshots.
Since the original VM still exists if necessary I could create xml files using:
virsh dumpxml LinuxLiteV3.8 --security-info --migratable >LinuxLiteV3.8
virsh snapshot-dumpxml LinuxLiteV3.8 LinuxLite38_PreUD01 --security-info >LinuxLite38_PreUD01.xml
virsh snapshot-dumpxml LinuxLiteV3.8 snapshot1 --security-info >snapshot1.xml
but I have no idea how to import the definitions into virt-manager.
IIUC virsh snapshot-create will create a new snapshot and not import an existing snapshot.
At this time, I am trying to recreate several machines that are defined as qemu:///system that I want to move to qemu:///session. I know virsh has a -c option that allows a choice to be made between qemu:///system and qemu:///session, but I don't know how to export/import.
I also am in the process of migrating my system to new hardware, so I need to be able to reload VMs and their snapshots on a new installation of virt-manager. I am assuming that this is essentially the same problem only I'm exporting on one system and importing on another.
It would be preferable to work with only the qcow2 file, but since I still have the original working install I have the option of working with the xml files.
virsh snapshot-create ...man virshsays forsnapshot-create: If --redefine is specified, then all XML elements produced by snapshot-dumpxml are valid; this can be used to migrate snapshot hierarchy from one machine to another... , or to make slight alterations in the snapshot metadata (such as host-specific aspects of the domain XML embedded in the snapshot). When this flag is supplied, the xmlfile argument is mandatory, and the domain's current snapshot will not be altered unless the --current flag is also given.