mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 19:45:21 +00:00
Recheck disk backing chains after snapshot
When a snapshot operation finishes we have to recheck the backing chain of all disks involved in the snapshot. And we need to do that even if the operation failed because some of the disks might have changed if QEMU did not support transactions.
This commit is contained in:
parent
34cc3b2f10
commit
eec2f65946
@ -12949,6 +12949,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
||||
bool persist = false;
|
||||
bool reuse = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
virErrorPtr orig_err = NULL;
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
@ -13040,6 +13041,17 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
cleanup:
|
||||
/* recheck backing chains of all disks involved in the snapshot */
|
||||
orig_err = virSaveLastError();
|
||||
for (i = 0; i < snap->def->ndisks; i++) {
|
||||
if (snap->def->disks[i].snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
|
||||
continue;
|
||||
qemuDomainDetermineDiskChain(driver, vm, vm->def->disks[i], true);
|
||||
}
|
||||
if (orig_err) {
|
||||
virSetError(orig_err);
|
||||
virFreeError(orig_err);
|
||||
}
|
||||
|
||||
if (ret == 0 || !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
|
||||
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0 ||
|
||||
|
Loading…
Reference in New Issue
Block a user