mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-08 02:45:45 +00:00
qemu_snapshot: prepare data for non-active leaf external snapshot deletion
In this case there is no need to run block commit and using qemu process at all. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
a3152a506b
commit
d84538fbad
@ -2759,34 +2759,43 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this also serves as validation whether the snapshot can be deleted */
|
/* Leaf non-active snapshot doesn't have overlay files for the disk images
|
||||||
if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, &tmpData) < 0)
|
* so there is no need to do any merge and we can just delete the files
|
||||||
return -1;
|
* directly. */
|
||||||
|
if (snap != virDomainSnapshotGetCurrent(vm->snapshots) &&
|
||||||
if (!virDomainObjIsActive(vm)) {
|
snap->nchildren == 0) {
|
||||||
if (qemuProcessStart(NULL, driver, vm, NULL, VIR_ASYNC_JOB_SNAPSHOT,
|
if (qemuSnapshotDeleteExternalPrepareData(vm, snap, false, externalData) < 0)
|
||||||
NULL, -1, NULL, NULL,
|
|
||||||
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
|
|
||||||
VIR_QEMU_PROCESS_START_PAUSED) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*stop_qemu = true;
|
|
||||||
|
|
||||||
/* Call the prepare again as some data require that the VM is
|
|
||||||
* running to get everything we need. */
|
|
||||||
if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, externalData) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
qemuDomainJobPrivate *jobPriv = vm->job->privateData;
|
/* this also serves as validation whether the snapshot can be deleted */
|
||||||
|
if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, &tmpData) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
*externalData = g_steal_pointer(&tmpData);
|
if (!virDomainObjIsActive(vm)) {
|
||||||
|
if (qemuProcessStart(NULL, driver, vm, NULL, VIR_ASYNC_JOB_SNAPSHOT,
|
||||||
|
NULL, -1, NULL, NULL,
|
||||||
|
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
|
||||||
|
VIR_QEMU_PROCESS_START_PAUSED) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* If the VM is running we need to indicate that the async snapshot
|
*stop_qemu = true;
|
||||||
* job is snapshot delete job. */
|
|
||||||
jobPriv->snapshotDelete = true;
|
|
||||||
|
|
||||||
qemuDomainSaveStatus(vm);
|
/* Call the prepare again as some data require that the VM is
|
||||||
|
* running to get everything we need. */
|
||||||
|
if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, externalData) < 0)
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
qemuDomainJobPrivate *jobPriv = vm->job->privateData;
|
||||||
|
|
||||||
|
*externalData = g_steal_pointer(&tmpData);
|
||||||
|
|
||||||
|
/* If the VM is running we need to indicate that the async snapshot
|
||||||
|
* job is snapshot delete job. */
|
||||||
|
jobPriv->snapshotDelete = true;
|
||||||
|
|
||||||
|
qemuDomainSaveStatus(vm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user