]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_snapshot: introduce external snapshot revert support
authorPavel Hrdina <phrdina@redhat.com>
Fri, 5 May 2023 15:55:05 +0000 (17:55 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 22 Aug 2023 14:06:20 +0000 (16:06 +0200)
commit8e664737813378d2a1bdeacc2ca8e942327e2cab
tree2f8ac8f04e2c995d28101ffa0afc6bd39750edd6
parent96fa494f881c008096c50dd7553d7db69b4841e4
qemu_snapshot: introduce external snapshot revert support

When reverting to external snapshot we need to create new overlay qcow2
files from the disk files the VM had when the snapshot was taken.

There are some specifics and limitations when reverting to a snapshot:

1) When reverting to last snapshot we need to first create new overlay
   files before we can safely delete the old overlay files in case the
   creation fails so we have still recovery option when we error out.

   These new files will not have the suffix as when the snapshot was
   created as renaming the original files in order to use the same file
   names as when the snapshot was created would add unnecessary
   complexity to the code.

2) When reverting to any snapshot we will always create overlay files
   for every disk the VM had when the snapshot was done. Otherwise we
   would have to figure out if there is any other qcow2 image already
   using any of the VM disks as backing store and that itself might be
   extremely complex and in some cases impossible.

3) When reverting from any state the current overlay files will be
   always removed as that VM state is not meant to be saved. It's the
   same as with internal snapshots. If user want's to keep the current
   state before reverting they need to create a new snapshot. For now
   this will only work if the current snapshot is the last.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_snapshot.c