qemu: snapshot: Write metadata of previously-'current' snapshot on update
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 <2cf5c04c61aa466e4a47bfedc747d17279c72ffc@redhat.com>
Reviewed-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>

olafhering/libvirt,jfehlig/libvirt,crobinso/libvirt,nertpinx/libvirt,nertpinx/libvirt,zippy2/libvirt,zippy2/libvirt,crobinso/libvirt,crobinso/libvirt,libvirt/libvirt,crobinso/libvirt,nertpinx/libvirt,jfehlig/libvirt,zippy2/libvirt,libvirt/libvirt,jfehlig/libvirt,libvirt/libvirt,olafhering/libvirt,nertpinx/libvirt,zippy2/libvirt,olafhering/libvirt,olafhering/libvirt,libvirt/libvirt,jfehlig/libvirt,nertpinx/libvirt