mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemuSnapshotCreateActiveExternal: Don't unlink memory snapshot image if it was existing before
When writing the memory snapshot into an existing file don't remove it if the snapshot fails later. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b30a8ee67d
commit
b396e9dd9d
@ -1356,6 +1356,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
|
|||||||
virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
|
virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
|
||||||
bool memory = snapdef->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
|
bool memory = snapdef->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
|
||||||
bool memory_unlink = false;
|
bool memory_unlink = false;
|
||||||
|
bool memory_existing = false;
|
||||||
bool thaw = false;
|
bool thaw = false;
|
||||||
bool pmsuspended = false;
|
bool pmsuspended = false;
|
||||||
int compressed;
|
int compressed;
|
||||||
@ -1451,12 +1452,15 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
xml = NULL;
|
xml = NULL;
|
||||||
|
|
||||||
|
memory_existing = virFileExists(snapdef->memorysnapshotfile);
|
||||||
|
|
||||||
if ((ret = qemuSaveImageCreate(driver, vm, snapdef->memorysnapshotfile,
|
if ((ret = qemuSaveImageCreate(driver, vm, snapdef->memorysnapshotfile,
|
||||||
data, compressor, 0,
|
data, compressor, 0,
|
||||||
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
|
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* the memory image was created, remove it on errors */
|
/* the memory image was created, remove it on errors */
|
||||||
|
if (!memory_existing)
|
||||||
memory_unlink = true;
|
memory_unlink = true;
|
||||||
|
|
||||||
/* forbid any further manipulation */
|
/* forbid any further manipulation */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user