qemu: backup: Fix handling of backing store for backup target images
qemu: backup: Fix handling of backing store for backup target images

We always tried to install backing store for the image even if it didn't
make sense, e.g. for a full backup into a raw image. Additionally we
didn't record the backing file into the qcow2 metadata so the image
itself contained the diff of data but reading from it would be
incomplete as it depends on the backing image.

This patch fixes both issues by carefully installing the correct backing
file when appropriate and also recording it into the metadata when
creating the image.

https://bugzilla.redhat.com/show_bug.cgi?id=1813310

Signed-off-by: Peter Krempa <2cf5c04c61aa466e4a47bfedc747d17279c72ffc@redhat.com>
Reviewed-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>

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