How to properly modify xml in snapshot memory / managed save file
I am trying to move virtual machines to a new location on the same host. I want to preserve not only snapshots, but domain manage saved state as well as snapshot saved state. The xml is embedded in the snapshot and domain saved state and paths base image files are hard coded. I tried to sed replace the paths and necessary info, but it seems like libvirt expects the xml to be a certain length so it fails parsing. Parsing fails at different points of the embedded xml when I change the length of the path in the embedded xml. How can I properly edit the snapshot and domain managed saved state xml?
On Sun, Feb 08, 2026 at 13:32:51 +0000, wrangle wrote:
I am trying to move virtual machines to a new location on the same host. I want to preserve not only snapshots, but domain manage saved state as well as snapshot saved state.
Libvirt provides APIs to be able to re-define the XML embedded in the save images. With virsh you can do: virsh managedsave-edit VMNAME and virsh save-image-edit --file IMAGEFILE
The xml is embedded in the snapshot and domain saved state and paths base image files are hard coded. I tried to sed replace the paths anda
For external snapshots with memory, the memory image a save image so to edit that you can use 'virsh save-image-edit' as there isn't a specific API which would take the snapshot name. Just use the name of the memory image as present in the snapshot XML.
necessary info, but it seems like libvirt expects the xml to be a certain length so it fails parsing. Parsing fails at different points of the embedded xml when I change the length of the path in the embedded xml.
That's right, the files need to be edited with the APIs.
participants (2)
-
Peter Krempa -
wrangle