mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: migration: Clean up temporary bitmaps when cancelling a migration
In case when the block migration job required temporary bitmaps for merging the appropriate checkpoints we need to clean them up when cancelling the job. On success we don't need to do that though as the bitmaps are just temporary thus are not written to disk. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
f7eb3e233d
commit
1475baed36
@ -840,6 +840,29 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuMigrationSrcCancelRemoveTempBitmaps(virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virQEMUDriverPtr driver = priv->driver;
|
||||
qemuDomainJobPrivatePtr jobPriv = priv->job.privateData;
|
||||
GSList *next;
|
||||
|
||||
for (next = jobPriv->migTempBitmaps; next; next = next->next) {
|
||||
qemuDomainJobPrivateMigrateTempBitmapPtr t = next->data;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
qemuMonitorBitmapRemove(priv->mon, t->nodename, t->bitmapname);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static virStorageSourcePtr
|
||||
qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(virDomainDiskDefPtr disk,
|
||||
const char *host,
|
||||
@ -4003,6 +4026,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
||||
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
dconn);
|
||||
|
||||
qemuMigrationSrcCancelRemoveTempBitmaps(vm, QEMU_ASYNC_JOB_MIGRATION_OUT);
|
||||
|
||||
if (priv->job.current->status != QEMU_DOMAIN_JOB_STATUS_CANCELED)
|
||||
priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_FAILED;
|
||||
}
|
||||
@ -5705,6 +5730,9 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver,
|
||||
QEMU_ASYNC_JOB_NONE, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuMigrationSrcCancelRemoveTempBitmaps(vm, QEMU_ASYNC_JOB_NONE) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user