mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 22:15:20 +00:00
qemuDomainSnapshotDiskPrepareOne: Fix logic of relative backing store update
Commit 2ace7a87a8aced68c250 introduced a logic bug by an improperly modified condition where we'd skip to the else branch when reusing of external images was requested and blockdev is available. The original intentions were to skip the backing store update with blockdev. Fix it by only asserting the boolean which was used to track whether we support update of the backing store only when blockdev is not present along with the appropriate rename. https://bugzilla.redhat.com/show_bug.cgi?id=1820016 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
30d3565181
commit
ae64a75a87
@ -15129,7 +15129,7 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
|
|||||||
{
|
{
|
||||||
virDomainDiskDefPtr persistdisk;
|
virDomainDiskDefPtr persistdisk;
|
||||||
bool supportsCreate;
|
bool supportsCreate;
|
||||||
bool supportsBacking;
|
bool updateRelativeBacking = false;
|
||||||
|
|
||||||
dd->disk = disk;
|
dd->disk = disk;
|
||||||
|
|
||||||
@ -15158,19 +15158,22 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
supportsCreate = virStorageFileSupportsCreate(dd->src);
|
supportsCreate = virStorageFileSupportsCreate(dd->src);
|
||||||
supportsBacking = virStorageFileSupportsBackingChainTraversal(dd->src);
|
|
||||||
|
|
||||||
if (supportsCreate || supportsBacking) {
|
/* relative backing store paths need to be updated so that relative
|
||||||
|
* block commit still works. With blockdev we must update it when doing
|
||||||
|
* commit anyways so it's skipped here */
|
||||||
|
if (!blockdev &&
|
||||||
|
virStorageFileSupportsBackingChainTraversal(dd->src))
|
||||||
|
updateRelativeBacking = true;
|
||||||
|
|
||||||
|
if (supportsCreate || updateRelativeBacking) {
|
||||||
if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0)
|
if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
dd->initialized = true;
|
dd->initialized = true;
|
||||||
|
|
||||||
/* relative backing store paths need to be updated so that relative
|
if (reuse) {
|
||||||
* block commit still works. With blockdev we must update it when doing
|
if (updateRelativeBacking) {
|
||||||
* commit anyways so it's skipped here */
|
|
||||||
if (reuse && !blockdev) {
|
|
||||||
if (supportsBacking) {
|
|
||||||
g_autofree char *backingStoreStr = NULL;
|
g_autofree char *backingStoreStr = NULL;
|
||||||
|
|
||||||
if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr) < 0)
|
if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user