diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 18b2e478f6..80cd54bf33 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3144,6 +3144,8 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *vm, return -1; } + data->parentSnap = qemuSnapshotFindParentSnapForDisk(snap, data->snapDisk); + if (data->merge) { virStorageSource *snapDiskSrc = NULL; @@ -3185,8 +3187,6 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *vm, qemuSnapshotGetDisksWithBackingStore(vm, snap, data); } - data->parentSnap = qemuSnapshotFindParentSnapForDisk(snap, data->snapDisk); - if (data->parentSnap && !virDomainSnapshotIsExternal(data->parentSnap)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("deleting external snapshot that has internal snapshot as parent not supported")); @@ -3642,10 +3642,12 @@ qemuSnapshotDiscardExternal(virDomainObj *vm, if (!data->job) goto error; } else { - if (virStorageSourceInit(data->parentDomDisk->src) < 0 || - virStorageSourceUnlink(data->parentDomDisk->src) < 0) { - VIR_WARN("Failed to remove snapshot image '%s'", - data->snapDisk->name); + if (data->parentSnap && virDomainSnapshotIsExternal(data->parentSnap)) { + if (virStorageSourceInit(data->parentDomDisk->src) < 0 || + virStorageSourceUnlink(data->parentDomDisk->src) < 0) { + VIR_WARN("Failed to remove snapshot image '%s'", + data->snapDisk->name); + } } } }