On Thu, Feb 11, 2021 at 16:37:56 +0100, Peter Krempa wrote:
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(a)redhat.com>
---
src/qemu/qemu_migration.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 37f0d43d24..36424f8493 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -834,6 +834,32 @@ 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;
+
+ if (!jobPriv->migTempBitmaps)
+ return 0;
This check is pretty much redundant as the loop will do exactly the
same.
+
+ 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,
...
Reviewed-by: Jiri Denemark <jdenemar(a)redhat.com>