]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: snapshot: Write metadata of previously-'current' snapshot on update
authorPeter Krempa <pkrempa@redhat.com>
Mon, 23 Nov 2020 10:56:12 +0000 (11:56 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 24 Nov 2020 16:59:26 +0000 (17:59 +0100)
commit5d8acaa8bcce1be943726e7763bacdf1a4e49fe6
tree611ff34769c21a35db1ce8314e1f05cd1a6b763c
parent926563dc3a6c3f1598c5a54626acf31b7d3a6043
qemu: snapshot: Write metadata of previously-'current' snapshot on update

Whether a snapshot definition is considered 'current' or active is
stored in the metadata XML libvirt writes when we create metadata.

This means that if we are changing the 'current' snapshot we must
re-write the metadata of the previously 'current' snapshot to update the
field to prevent having multiple active snapshots.

Unfortunately the snapshot creation code didn't do this properly, which
resulted in the following error:

error : qemuDomainSnapshotLoad:430 : internal error: Too many snapshots claiming to be current for domain snapshot-test

being printed if libvirtd was terminated and restarted.

Introduce qemuSnapshotSetCurrent which writes out the old snapshot's
metadata when updating the current snapshot.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_snapshot.c