qemu: snapshot: Always rewrite backingStore data when reusing existing images

Don't adopt the backing store data when reusing images provided by the
user. This will force a backing chain re-probe as users might have
passed in something unexpected in the overlay where our view of the
backing chain would not correspond.

This is done only for inactive snapshots as there we have way less
verification.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2020-01-24 14:14:58 +01:00
parent 201156ec6e
commit 8e9e73a984

View File

@ -14699,7 +14699,8 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
if (virStorageSourceInitChainElement(newsrc, defdisk->src, false) < 0)
goto cleanup;
if (virStorageSourceHasBacking(defdisk->src)) {
if (!reuse &&
virStorageSourceHasBacking(defdisk->src)) {
defdisk->src->readonly = true;
newsrc->backingStore = g_steal_pointer(&defdisk->src);
} else {